* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow: hidden;
}

:root {
  --bg-light: #F0F0F0;
  --bg-white: #FFFFFF;
  /* Основной акцент — цвет шапки (тёмно-синий) */
  --blue-dark: #0d2139;
  --blue-light: #152a47;
  --text-dark: #0d2139;
  --text-secondary: #4a5a7a;
  --border-color: #b8c5d9;
  --accent-blue: #0d2139;
  --accent-green: #1a7f37;
  --accent-orange: #c47100;
  --accent-yellow: #b38600;
  /* Шапка в стиле The Baltic Sentinel */
  --header-bg: #0d2139;
  --header-text: #ffffff;
  --header-text-muted: rgba(255, 255, 255, 0.85);
  --header-border: rgba(255, 255, 255, 0.15);
  --header-height: 83px;
  --header-padding-x: 1.95rem;
  --header-logo-height: 68px;
  --header-title-size: 1.76rem;
  --header-subtitle-size: 0.94rem;
  --header-nav-link-size: 1.3rem;
  --header-nav-icon-size: 26px;
  --header-auth-size: 1.24rem;
  --header-auth-pad-y: 0.52rem;
  --header-auth-pad-x: 0.98rem;
  --header-auth-slot-width: 8.4rem;
  /* Frosted glass panels */
  --glass-bg:     rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.45);
  --glass-shadow: 0 4px 24px rgba(13, 33, 57, 0.16), 0 1px 6px rgba(13, 33, 57, 0.10);
  --glass-blur:   14px;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  animation: pageFadeIn 0.12s ease both;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

/* Header — тёмно-синий фон, белый текст, подчёркивание при наведении */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  min-height: var(--header-height);
  max-height: var(--header-height);
  padding: 0 var(--header-padding-x);
  background: var(--header-bg);
  border-bottom: 3px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.3rem;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--header-text);
}

.logo-herzen {
  height: var(--header-logo-height);
  min-height: var(--header-logo-height);
  max-height: var(--header-logo-height);
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.brand h1 {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: var(--header-title-size);
  font-weight: 700;
  color: var(--header-text);
  letter-spacing: 0.015em;
  line-height: 1.2;
}

.subtitle {
  display: block;
  font-size: var(--header-subtitle-size);
  color: var(--header-text-muted);
  margin-top: 0.13rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.98rem;
  margin-left: auto;
  padding-right: 0.65rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.46rem;
  padding: 0.65rem 0.98rem;
  white-space: nowrap;
  color: var(--header-text);
  text-decoration: none;
  font-size: var(--header-nav-link-size);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  border-radius: 0;
  transition: text-decoration 0.15s, opacity 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.nav-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
  opacity: 1;
}

.nav-link.active {
  background: transparent;
  color: var(--header-text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-link.active:hover {
  color: var(--header-text);
  text-decoration: underline;
  text-underline-offset: 4px;
  opacity: 0.9;
}

.nav-link svg {
  width: var(--header-nav-icon-size);
  height: var(--header-nav-icon-size);
  flex-shrink: 0;
  color: var(--header-text);
  stroke: var(--header-text);
}

#auth-nav-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: 0.5rem;
  min-width: var(--header-auth-slot-width);
  min-height: 44px;
}

.nav-auth-btn {
  padding: var(--header-auth-pad-y) var(--header-auth-pad-x);
  border-radius: 0;
  font-size: var(--header-auth-size);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--header-text);
  background: transparent;
  color: var(--header-text);
  text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  transition: text-decoration 0.15s, opacity 0.15s;
}

.nav-auth-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.9;
  background: transparent;
  color: var(--header-text);
}

.nav-auth-logout {
  color: var(--header-text);
  border-color: var(--header-text-muted);
}

.auth-error {
  color: #c53030;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  min-height: 1.25rem;
}

.nav-link-db {
  margin-left: 0;
}

.nav-link-settings {
  margin-left: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.nav-link-settings.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Main layout */
.main {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Sidebar — плавающая панель поверх карты */
.sidebar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  bottom: 1rem;
  width: 360px;
  min-width: 300px;
  z-index: 450;

  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);

  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.event-feed {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 0.85rem 1rem;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.feed-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-dark);
  letter-spacing: 0.01em;
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--blue-dark);
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-refresh:hover {
  background: var(--bg-light);
  border-color: var(--blue-dark);
}

/* Stats */
.stats {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.stat-box {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  text-align: center;
}

/* ВСЕГО — full-width bar, centered label + value on same baseline */
.stat-box.stat-total {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  background: var(--header-bg);
  border-color: var(--header-border);
  color: var(--header-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  border-radius: 8px;
}

.stat-box.stat-total .stat-label,
.stat-box.stat-total .stat-value {
  color: var(--header-text);
  display: block;
  margin: 0;
  padding: 0;
}

.stat-box.stat-total .stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.stat-box.stat-total .stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

/* Category tiles grid — always 2 columns */
.stats-categories {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.3rem;
  overflow-x: visible;
}

.stat-box-category {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem;
  padding: 0.55rem 0.35rem 0.45rem;
  min-height: 78px;
  overflow: visible;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

button.stat-box-category {
  appearance: none;
  margin: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-light);
}

.stat-box-category:hover {
  border-color: var(--blue-dark);
  background: rgba(13, 33, 57, 0.06);
}

.stat-box-category-selected {
  border: 3px solid var(--blue-dark);
  background: rgba(13, 33, 57, 0.14);
  box-shadow: 0 0 0 1px var(--blue-dark);
}

.stat-box-category-selected .stat-label,
.stat-box-category-selected .stat-value {
  color: var(--blue-dark);
  font-weight: 700;
}

.stat-category-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

/* Icon badge inside category stat tiles */
.stat-category-icon .event-marker-badge {
  width: 36px;
  height: 36px;
  border-width: 2px;
}
.stat-category-icon .event-marker-badge img {
  width: 22px;
  height: 22px;
}
.stat-category-icon .event-marker-dot {
  width: 13px;
  height: 13px;
  border-width: 2px;
}

.stat-category-icon .event-marker-icon,
.stat-category-icon .event-marker-dot {
  display: block;
  line-height: 0;
}

.stat-category-icon .event-marker-icon-img {
  display: block;
  line-height: 0;
}

.stat-category-icon img {
  display: block;
  object-fit: contain;
  vertical-align: bottom;
}

.stat-category-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  text-align: center;
}

/* Label — full text, no clipping, centered */
.stat-box-category .stat-category-text .stat-label {
  margin-bottom: 0;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
  overflow: visible;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.stat-box-category .stat-label {
  text-transform: none;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 0;
  margin-top: 0;
  line-height: 1.25;
  text-align: center;
  color: var(--text-secondary);
}

.stat-label-sub {
  display: block;
  font-size: 0.52rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.stat-box-category .stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--blue-dark);
}

/* Блок военных баз под статистикой */
.stats-bases {
  margin-top: 0.35rem;
}

.stats-bases-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.stats-bases-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.stat-box-base {
  flex: 0 0 auto;
  min-width: 110px;
  padding: 0.35rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.stat-box-base .stat-category-text {
  align-items: flex-start;
}

.stat-box-base .stat-value {
  font-size: 1rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--blue-dark);
}

.stat-highlight {
  border-color: var(--blue-dark);
  background: rgba(0, 51, 153, 0.08);
}

.stat-highlight .stat-value {
  color: var(--blue-dark);
}

/* Filters */
.filters {
  margin-bottom: 0.6rem;
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.filters-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--blue-dark);
}

.btn-reset {
  padding: 0.35rem 0.65rem;
  background: #c53030;
  border: 1px solid #b91c1c;
  border-radius: 4px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-reset:hover {
  background: #b91c1c;
  color: #fff;
}

.search-input {
  width: 100%;
  padding: 0.45rem 0.65rem 0.45rem 2rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23003399' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.5rem center;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.filter-selects {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.filter-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 0.85rem;
  cursor: pointer;
}

.date-inputs {
  display: flex;
  gap: 0.5rem;
}

.date-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.date-label span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.date-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 0.85rem;
}

.date-input::placeholder {
  color: var(--text-secondary);
}

/* Results */
.results {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.results h3 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--blue-dark);
}

/* Лента новостей (Telegram) */
.news-feed {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.news-feed-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--blue-dark);
}

.news-feed-setup {
  margin-bottom: 0.75rem;
}

.news-feed-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.news-feed-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.news-feed-hint code {
  background: var(--bg-light);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8em;
}

.news-feed-input-row {
  display: flex;
  gap: 0.5rem;
}

.news-feed-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 0.85rem;
}

.news-feed-input::placeholder {
  color: var(--text-secondary);
}

.btn-apply-channel {
  padding: 0.5rem 0.75rem;
  background: var(--blue-dark);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-apply-channel:hover {
  background: var(--blue-light);
}

.hidden {
  display: none !important;
}

.news-feed-content {
  flex: 1;
  min-height: 0;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow-y: auto;
  padding: 0.75rem;
}

.news-feed-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

.news-feed-link-wrap {
  margin-bottom: 0.75rem;
}

.news-feed-channel-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--blue-dark);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

.news-feed-channel-link:hover {
  background: var(--blue-light);
  color: #fff;
}

.news-feed-rss-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.news-feed-rss-item {
  display: block;
  padding: 0.5rem 0.75rem;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-dark);
  transition: border-color 0.15s, background 0.15s;
}

.news-feed-rss-item:hover {
  border-color: var(--blue-dark);
  background: rgba(0, 51, 153, 0.04);
}

.news-feed-rss-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--blue-dark);
  margin-bottom: 0.2rem;
}

.news-feed-rss-date {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.news-feed-rss-loading,
.news-feed-rss-error {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.5rem 0;
}

.news-feed-rss-error {
  color: #c53030;
}

.event-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.event-card {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.event-card:hover {
  border-color: var(--blue-dark);
  background: rgba(0, 51, 153, 0.06);
}

.event-card.active {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 2px rgba(0, 51, 153, 0.2);
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.event-card-header h4 {
  font-size: 0.9rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  color: var(--blue-dark);
}

.event-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.event-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.tag-category {
  background: var(--blue-dark);
  color: white;
}

.tag-economy {
  background: var(--accent-green);
  color: white;
}

.tag-diplomacy {
  background: #5a4ab3;
  color: white;
}

.tag-security {
  background: #c42d2d;
  color: white;
}

.tag-confirmed {
  background: rgba(26, 127, 55, 0.25);
  color: var(--accent-green);
}

.tag-unconfirmed {
  background: rgba(74, 90, 122, 0.2);
  color: var(--text-secondary);
}

.badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.badge-high {
  background: rgba(196, 45, 45, 0.2);
  color: #c42d2d;
}

.badge-medium {
  background: rgba(195, 113, 0, 0.2);
  color: var(--accent-orange);
}

.badge-low {
  background: rgba(0, 51, 153, 0.15);
  color: var(--blue-dark);
}

.event-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.event-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.event-meta svg {
  stroke: var(--text-secondary);
}

/* Map section — занимает всё свободное пространство */
.map-section {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: #a8c8f0;
  overflow: hidden;
}

/* Fix Leaflet tile seams — GPU compositing eliminates subpixel gaps */
.leaflet-tile-pane {
  transform: translateZ(0);
  will-change: transform;
}
.leaflet-tile {
  image-rendering: auto;
}

.map-container {
  position: relative;
}

/* ── Timeline slider ─────────────────────────────────────────────────── */
.timeline-bar {
  position: absolute;
  bottom: 1rem;
  left: calc(360px + 1.75rem);
  right: calc(210px + 1.75rem);
  z-index: 448;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
  padding: 0.55rem 1.1rem 0.5rem;
  user-select: none;
}

.timeline-dates-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.tl-date-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--blue-dark);
  min-width: 5rem;
}

.tl-date-label.tl-label-right {
  text-align: right;
}

.tl-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-align: center;
  flex: 1;
}

.timeline-track-wrap {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

.tl-bg-track {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  z-index: 0;
}

.tl-fill {
  position: absolute;
  height: 4px;
  background: var(--blue-dark);
  border-radius: 2px;
  z-index: 1;
  pointer-events: none;
}

.tl-thumb {
  position: absolute;
  left: 0;
  width: 100%;
  height: 20px;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  outline: none;
  z-index: 2;
}

.tl-thumb::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue-dark);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 6px rgba(13,33,57,0.4);
  cursor: ew-resize;
  pointer-events: auto;
}

.tl-thumb::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue-dark);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 6px rgba(13,33,57,0.4);
  cursor: ew-resize;
  pointer-events: auto;
}

.tl-ticks {
  position: relative;
  height: 20px;
  margin-top: 0.25rem;
}

.tl-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.52rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  line-height: 1;
}

/* Show every month on timeline */
.tl-tick-month {
  font-size: 0.5rem;
  font-weight: 700;
  color: rgba(13, 33, 57, 0.82);
}

/* ── Monthly bar chart ───────────────────────────────────────────────── */
.monthly-chart-section {
  flex-shrink: 0;
  padding: 0.5rem 0 0.75rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.4rem;
}

.monthly-chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.monthly-chart-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.monthly-chart-peak {
  font-size: 0.58rem;
  color: var(--text-secondary);
  font-weight: 500;
  opacity: 0.75;
}

/* Bars track */
.monthly-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 78px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: rgba(13, 33, 57, 0.42) rgba(13, 33, 57, 0.08);
  position: relative;
  padding-bottom: 4px;
}

.monthly-chart-bars::-webkit-scrollbar {
  height: 7px;
}

.monthly-chart-bars::-webkit-scrollbar-track {
  background: rgba(13, 33, 57, 0.08);
  border-radius: 999px;
}

.monthly-chart-bars::-webkit-scrollbar-thumb {
  background: rgba(13, 33, 57, 0.42);
  border-radius: 999px;
}

.monthly-chart-bars::-webkit-scrollbar-thumb:hover {
  background: rgba(13, 33, 57, 0.56);
}

.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  flex-shrink: 0;
  position: relative;
  cursor: default;
}

.chart-col-bar {
  width: 13px;
  min-height: 2px;
  background: linear-gradient(to top, var(--blue-dark) 0%, #3b82c4 100%);
  border-radius: 3px 3px 0 0;
  opacity: 0.7;
  transition: opacity 0.15s;
  position: relative;
  flex-shrink: 0;
}

/* Count tooltip above bar on hover — uses data-count attribute */
.chart-col-bar[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  font-weight: 700;
  color: #fff;
  background: var(--blue-dark);
  border-radius: 3px;
  padding: 1px 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.chart-col:hover .chart-col-bar {
  opacity: 1;
}

.chart-col:hover .chart-col-bar[data-count]::after {
  opacity: 1;
}

/* Month/year label in normal flow */
.chart-col-label {
  font-size: 0.48rem;
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1;
  text-align: center;
  min-height: 0.6rem;
}

.chart-col-year {
  display: block;
  font-size: 0.44rem;
  font-weight: 700;
  color: var(--blue-dark);
  opacity: 0.85;
}

/* January column — year separator */
.chart-col-jan {
  margin-left: 5px;
  border-left: 1px dashed rgba(13, 33, 57, 0.22);
  padding-left: 3px;
}

/* Zero-count bar placeholder */
.chart-col-zero .chart-col-bar {
  opacity: 0.15;
  background: var(--border-color);
}

.chart-no-data {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 0.75rem 0;
}

/* Панель стран — плавающая поверх карты справа */
.countries-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: 210px;
  min-width: 180px;
  z-index: 450;

  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);

  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-y: auto;
  padding: 1rem;
}

.countries-panel-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Кнопки zoom Leaflet — правее сайдбара */
.map-section .leaflet-top.leaflet-left {
  left: calc(360px + 1.75rem);
  top: 1.25rem;
}

/* Тонкие скроллбары в стеклянных панелях */
.sidebar .news-feed-content,
.countries-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(13, 33, 57, 0.25) transparent;
}
.sidebar .news-feed-content::-webkit-scrollbar,
.countries-panel::-webkit-scrollbar {
  width: 5px;
}
.sidebar .news-feed-content::-webkit-scrollbar-thumb,
.countries-panel::-webkit-scrollbar-thumb {
  background: rgba(13, 33, 57, 0.25);
  border-radius: 3px;
}
.sidebar .news-feed-content::-webkit-scrollbar-track,
.countries-panel::-webkit-scrollbar-track {
  background: transparent;
}

.countries-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.country-item {
  display: block;
}

/* Группы стран (Россия+Беларусь, НАТО) */
.country-group {
  margin-bottom: 0.5rem;
}

.country-group-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem;
  border-radius: 10px;
  border: 2px solid #c53030; /* красный прямоугольник */
  background: rgba(197, 48, 48, 0.06);
}

.country-group-row .country-alliance-badge {
  align-self: flex-start;
  margin-bottom: 0.1rem;
}

.country-group-nato {
  margin-top: 1rem;
}

.country-nato-box {
  padding: 0.4rem 0.4rem 0.35rem;
  border-radius: 10px;
  border: 2px solid var(--header-bg); /* синий прямоугольник, как у России/Беларуси, но синий */
  background: rgba(13, 33, 57, 0.06);
  text-align: left;
}

.country-nato-label {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.country-nato-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.country-nato-list li {
  list-style: none;
}

.country-nato-list .country-popup-trigger {
  width: 100%;
}

/* Бейджи альянсов (НАТО, Россия/Беларусь) */
.country-alliance-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 6px;
  border: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
}

.country-alliance-badge-nato {
  background: var(--header-bg);
  color: #fff;
  border-color: var(--header-bg);
}

.country-alliance-badge-ru {
  background: #c53030;
  color: #fff;
  border-color: #c53030;
}

.country-alliance-badge-active {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.country-popup-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-dark);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  font: inherit;
}

.country-popup-trigger:hover {
  background: rgba(0, 51, 153, 0.08);
  border-color: var(--blue-dark);
}

.country-popup-trigger .country-flag {
  flex-shrink: 0;
  width: 36px;
  height: 27px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

.country-popup-trigger .country-name {
  flex: 1;
  min-width: 0;
  font-size: 1.1rem;
  color: var(--text-dark);
}

/* Всплывающее окно страны */
.country-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.country-popup-overlay.country-popup-open {
  pointer-events: auto;
  opacity: 1;
}

.country-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.country-popup-box {
  position: relative;
  background: var(--bg-white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.country-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.country-popup-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--blue-dark);
}

.country-popup-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
}

.country-popup-close:hover {
  background: var(--bg-light);
  color: var(--text-dark);
}

.country-popup-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  min-height: 80px;
}

/* Leaflet */
.leaflet-control-zoom {
  border: 1px solid var(--border-color) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-white) !important;
  color: var(--blue-dark) !important;
  border: none !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-light) !important;
}

.leaflet-control-home {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 26px !important;
  height: 26px !important;
  background: var(--bg-white) !important;
  color: var(--blue-dark) !important;
  border: none !important;
  text-decoration: none;
}

.leaflet-control-home:hover {
  background: var(--bg-light) !important;
  color: var(--blue-dark) !important;
}

.leaflet-control-attribution {
  display: none !important;
}

/* ===== МАРКЕРЫ СОБЫТИЙ — ЕДИНЫЙ СТИЛЬ SVG-БЕЙДЖ ===== */

/* Контейнер Leaflet-маркера */
.leaflet-marker-icon.kb-marker {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  pointer-events: auto;
  width: 40px !important;
  height: 40px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Цветной круглый бейдж с SVG-иконкой */
.event-marker-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

.kb-marker:hover .event-marker-badge {
  transform: scale(1.15);
}

/* SVG-иконка внутри бейджа */
.event-marker-badge img {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}

/* Fallback-точка (иконка по умолчанию) */
.kb-marker .event-marker-dot {
  border: 2.5px solid #fff;
  border-radius: 50%;
}

/* Выбор значка в форме события */
.event-icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
/* Бейдж в picker — тот же стиль что на карте */
.event-icon-picker-item .event-marker-badge {
  width: 40px;
  height: 40px;
}
.event-icon-picker-item {
  width: 80px;
  height: 80px;
  padding: 0;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.event-icon-picker-item:hover {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 1px var(--blue-dark);
}
.event-icon-picker-item.selected {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 2px var(--blue-dark);
}
.event-icon-picker-item .event-icon-picker-svg,
.event-icon-picker-item .event-icon-picker-img,
.event-icon-picker-item .event-marker-dot {
  width: 48px;
  height: 48px;
  background: transparent;
}
.event-icon-picker-item .event-icon-picker-img {
  background: transparent;
}
.event-icon-picker-item .event-icon-picker-svg svg,
.event-icon-picker-item .event-icon-picker-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;
}
.event-icon-picker-item .event-icon-picker-img.event-icon-filter-red img {
  filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg);
}
.event-icon-picker-item .event-marker-dot {
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

/* Кластер: кружок с числом */
.kb-cluster {
  background: var(--blue-dark) !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cluster-count {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

/* Всплывающее окно кластера: список событий (сверху новый, снизу старый) */
.cluster-popup {
  min-width: 280px;
  max-width: 360px;
}

.cluster-popup-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cluster-popup-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-dark);
  line-height: 1.5;
}

.cluster-popup-item:last-child {
  border-bottom: none;
}

.cluster-popup-item-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.cluster-popup-item-icon .event-marker-badge {
  width: 36px;
  height: 36px;
}

.cluster-popup-item-icon .event-marker-dot {
  width: 20px !important;
  height: 20px !important;
}

.cluster-popup-item-text {
  flex: 1;
  min-width: 0;
}

.cluster-popup-item-text strong {
  color: var(--blue-dark);
}

/* База знаний — страница */
.db-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 1.5rem;
  background: var(--bg-light);
}

.db-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.db-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-right: auto;
}

.db-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.db-filters label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.db-filter-select {
  padding: 0.5rem 0.75rem;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 0.9rem;
  min-width: 180px;
}

.btn-create-event {
  padding: 0.6rem 1.25rem;
  background: var(--blue-dark);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-create-event:hover {
  background: var(--blue-light);
}

.db-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-backup-download,
.btn-export-data,
.btn-export-csv,
.btn-import-data {
  padding: 0.6rem 1.25rem;
  background: var(--bg-white);
  color: var(--blue-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-backup-download:hover,
.btn-export-data:hover,
.btn-export-csv:hover,
.btn-import-data:hover {
  background: var(--bg-light);
  border-color: var(--blue-dark);
}

.settings-export-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.db-table-wrap {
  flex: 1;
  overflow: auto;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.db-table th,
.db-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.db-table th {
  background: var(--bg-light);
  font-weight: 600;
  color: var(--blue-dark);
  position: sticky;
  top: 0;
  z-index: 1;
}

.db-table tbody tr:hover {
  background: rgba(0, 51, 153, 0.04);
}

.db-th-actions,
.db-td-actions {
  width: 1%;
  white-space: nowrap;
  text-align: center;
}

.db-th-check,
.db-td-check {
  width: 40px;
  min-width: 40px;
  text-align: center;
  padding: 0.5rem 0.25rem !important;
}

.db-row-check,
#db-check-all {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--blue-dark);
}

.db-selection-info {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.25rem 0 0.1rem;
  min-height: 1.4rem;
}

.btn-delete-event {
  padding: 0.35rem 0.65rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-delete-event:hover {
  border-color: #c53030;
  color: #c53030;
  background: rgba(197, 48, 48, 0.06);
}

.btn-edit-event {
  padding: 0.35rem 0.65rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 0.35rem;
}

.btn-edit-event:hover {
  border-color: var(--blue-dark);
  color: var(--blue-dark);
  background: rgba(0, 51, 153, 0.06);
}

.db-category {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.db-actor-select {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-light);
  font-size: 0.9rem;
}

.db-actor-hint {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.actor-multiselect {
  position: relative;
}

.actor-display-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-light);
  font-size: 0.9rem;
  cursor: pointer;
}

.actor-display-input::placeholder {
  color: var(--text-secondary);
}

.actor-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  background: var(--bg-white);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 0.5rem 0.5rem 0.4rem;
  max-height: 260px;
  overflow-y: auto;
  z-index: 20;
  display: none;
}

.actor-dropdown-open {
  display: block;
}

.actor-group {
  margin-bottom: 0.4rem;
}

.actor-group:last-child {
  margin-bottom: 0;
}

.actor-group-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.actor-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
  position: relative;
  padding-right: 1.6rem;
  cursor: pointer;
}

.actor-option input[type="checkbox"] {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  opacity: 0;
  cursor: pointer;
}

.actor-option span {
  flex: 1;
}

.actor-option span::after {
  content: "";
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: transparent;
  box-sizing: border-box;
}

.actor-option input[type="checkbox"]:checked + span::after {
  border-color: var(--header-bg);
  background: var(--header-bg);
  box-shadow: inset 0 0 0 2px #fff;
}

.actor-option-other {
  justify-content: flex-start;
  padding-right: 0;
  cursor: pointer;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  background: var(--bg-light);
  pointer-events: auto;
}

.actor-option-other span::after {
  content: none;
}

/* Настройки — страница */
.settings-main {
  flex: 1;
  min-height: 0;
  padding: 1.5rem;
  background: var(--bg-light);
  overflow-y: auto;
}

.settings-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 1.5rem;
}

.settings-block {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  max-width: 560px;
}

.settings-block-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 0.5rem;
}

.settings-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.settings-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  margin-top: 1rem;
}

.settings-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.settings-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.settings-input::placeholder {
  color: var(--text-secondary);
}

.btn-save-channel {
  padding: 0.5rem 1rem;
  background: var(--blue-dark);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-save-channel:hover {
  background: var(--blue-light);
}

.settings-current {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.settings-current-empty {
  color: var(--text-secondary);
}

/* Управление лентой: скрытие сообщений */
.btn-load-feed {
  padding: 0.5rem 1rem;
  background: var(--blue-dark);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

.btn-load-feed:hover {
  background: var(--blue-light);
}

.feed-manage-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .feed-manage-lists {
    grid-template-columns: 1fr;
  }
}

.feed-manage-section {
  min-width: 0;
}

.feed-manage-subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 0.5rem;
}

.feed-manage-list {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem;
  background: var(--bg-light);
}

.feed-manage-item {
  padding: 0.5rem 0.6rem;
  background: var(--bg-white);
  border-radius: 6px;
  margin-bottom: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.feed-manage-item:last-child {
  margin-bottom: 0;
}

.feed-manage-item-title {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--text-dark);
}

.feed-manage-item-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: 100%;
}

.btn-feed-hide,
.btn-feed-show {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-dark);
}

.btn-feed-hide:hover {
  border-color: var(--blue-dark);
  color: var(--blue-dark);
}

.btn-feed-show {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.btn-feed-show:hover {
  background: rgba(26, 127, 55, 0.08);
}

.feed-manage-empty {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.5rem 0;
}

.feed-manage-empty.hidden {
  display: none;
}

/* Модальные окна */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.modal.modal-open {
  pointer-events: auto;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-box {
  position: relative;
  background: var(--bg-white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 1.25rem;
}

.db-form label {
  display: block;
  margin-bottom: 1rem;
}

.db-form label span {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.db-form input[type="text"],
.db-form input[type="date"],
.db-form textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.db-form input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
}

.color-palette-wrap {
  margin-bottom: 1rem;
}

.color-palette-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: border-color 0.15s, transform 0.15s;
}

.color-swatch:hover {
  transform: scale(1.08);
}

.color-swatch.selected {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 2px rgba(0, 51, 153, 0.3);
}

.color-swatch-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.color-swatch:hover .color-swatch-remove {
  opacity: 1;
}

.color-swatch-remove:hover {
  background: #c53030;
  color: #fff;
  border-color: #c53030;
}

.btn-add-color {
  padding: 0.4rem 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-add-color:hover {
  border-color: var(--blue-dark);
  background: rgba(0, 51, 153, 0.06);
  color: var(--blue-dark);
}

.db-form textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn-modal-cancel {
  padding: 0.5rem 1rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-modal-cancel:hover {
  background: var(--border-color);
}

.btn-modal-submit {
  padding: 0.5rem 1rem;
  background: var(--blue-dark);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-modal-submit:hover {
  background: var(--blue-light);
}

.modal-box-map {
  max-width: 900px;
}

.map-picker {
  width: 100%;
  height: 400px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}

.modal-map-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Адаптивная вёрстка */
@media (max-width: 1400px) {
  .main {
    flex-wrap: nowrap;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: 300px;
    min-width: 260px;
  }
  .countries-panel {
    width: 180px;
    min-width: 160px;
  }
  .header-nav {
    gap: 0.65rem;
  }
  .nav-link {
    font-size: 1.17rem;
  }
  .nav-link svg {
    width: 23px;
    height: 23px;
  }
  .map-section .leaflet-top.leaflet-left {
    left: calc(300px + 1.75rem);
  }
}

@media (max-width: 768px) {
  /* Sidebar — прикреплён к нижней части экрана как drawer */
  .sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    height: 45vh;
    border-radius: 16px 16px 0 0;
  }
  /* Countries panel — скрыть на мобильных */
  .countries-panel {
    display: none;
  }
  .map-section .leaflet-top.leaflet-left {
    left: 0.5rem;
    top: 0.5rem;
  }
  .logo-herzen {
    height: 52px;
  }
  .brand h1 {
    font-size: 1.3rem;
  }
  .subtitle {
    display: none;
  }
  .country-popup-trigger {
    padding: 0.35rem 0.5rem;
  }
  .country-popup-trigger .country-flag {
    width: 28px;
    height: 21px;
  }
  .country-popup-trigger .country-name {
    font-size: 0.9rem;
  }
  .db-main,
  .settings-main {
    padding: 1rem;
  }
  .db-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .db-toolbar-actions {
    width: 100%;
  }
  .feed-manage-lists {
    grid-template-columns: 1fr;
  }
}

