/* =====================================================================
   Мониторинг БПЛА — оформление в тёмно-зелёной «радарной» гамме.
   Все цвета заданы переменными; цвета статусов совпадают с config.colors.
   ===================================================================== */
:root {
  color-scheme: dark;
  --bg: #0D0F12;
  --bg-elev: #111317;
  --panel: #15181C;
  --panel-2: #1A1D22;
  --panel-3: #21252B;
  --line: #262A31;
  --line-2: #323740;
  --text: #E8EAED;
  --text-2: #BEC3CA;
  --muted: #8E949D;
  --faint: #626873;
  --accent: #4ADE80;
  --accent-2: #86EFAC;
  --accent-ink: #03140A;
  --accent-soft: rgba(74, 222, 128, 0.12);
  --accent-line: rgba(74, 222, 128, 0.38);
  --st-active: #4ADE80;
  --st-warning: #FBBF24;
  --st-zone: #F87171;
  --st-lost: #8A9099;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  --gap: 12px;
  /* Ширина боковых панелей мониторинга; по ней же выравниваются уведомления. */
  --left-w: 300px;
  --right-w: 340px;
  --sans: Inter, 'Segoe UI', Roboto, system-ui, sans-serif;
  --mono: 'JetBrains Mono', Consolas, 'Cascadia Mono', monospace;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-width: 320px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(74, 222, 128, 0.3); }
* { scrollbar-width: thin; scrollbar-color: #3A3F48 transparent; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 5000; transform: translateY(-160%); background: var(--panel); padding: 10px 14px; border: 1px solid var(--accent); border-radius: var(--radius-sm); transition: transform 150ms; }
.skip-link:focus { transform: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--st-active)); flex: 0 0 auto; }
.dot-dim { opacity: 0.45; }
[data-status="active"] { --c: var(--st-active); }
[data-status="warning"] { --c: var(--st-warning); }
[data-status="in_zone"] { --c: var(--st-zone); }
[data-status="lost"] { --c: var(--st-lost); }

/* ---------- Шапка ---------- */
.topbar {
  display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr); align-items: center; gap: 16px;
  padding: 10px 18px; background: var(--bg-elev); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 12px; color: var(--accent);
  background: radial-gradient(circle at 50% 50%, rgba(74, 222, 128, 0.22), rgba(74, 222, 128, 0.04) 70%);
  border: 1px solid var(--accent-line);
}
.brand-mark .icon { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.brand-demo { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--st-warning); background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.28); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; align-self: flex-start; }
.brand-demo i { width: 6px; height: 6px; border-radius: 50%; background: var(--st-warning); flex: 0 0 auto; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
  border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: color 150ms, background 150ms;
}
.tab .icon { width: 16px; height: 16px; }
.tab:hover { color: var(--text); background: var(--panel-3); }
.tab.is-active { color: var(--accent-ink); background: var(--accent); font-weight: 600; }
.tab-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--st-zone); color: #2A0707; font-size: 11px; font-weight: 700; font-family: var(--mono);
}
/* На ПК счётчик висит в углу вкладки и не меняет её ширину, поэтому панель вкладок не сдвигается. */
@media (min-width: 1024px) {
  .tab-badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px; box-shadow: 0 0 0 2px var(--panel); }
}

.topbar-status { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.sim-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); white-space: nowrap;
}
.sim-badge time { color: var(--muted); }
.sim-badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sim-badge[data-state="running"] { border-color: var(--accent-line); }
.sim-badge[data-state="running"] .sim-badge-dot { background: var(--accent); box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); animation: ping 1.8s ease-out infinite; }
.sim-badge[data-state="paused"] .sim-badge-dot { background: var(--st-warning); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); } 80%, 100% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.clock-label { font-size: 10px; letter-spacing: 0.12em; color: var(--faint); font-weight: 600; }
.clock time { font-size: 13px; color: var(--text-2); white-space: nowrap; }

/* ---------- Основная область ---------- */
main { position: relative; flex: 1; min-height: 0; overflow: auto; }
.view { min-height: 100%; }
.app-message {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1500;
  max-width: min(640px, calc(100% - 32px)); padding: 10px 16px; border-radius: var(--radius);
  background: #16221B; border: 1px solid var(--accent-line); color: var(--accent-2);
  font-size: 13px; box-shadow: var(--shadow);
}
.app-message.is-error { background: #2A1414; border-color: #7F2D2D; color: #FECACA; }
.tab-lock { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px; background: rgba(13, 15, 18, 0.86); backdrop-filter: blur(3px); }
.tab-lock[hidden] { display: none; }
.tab-lock-card { max-width: 460px; padding: 22px 24px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.tab-lock-card h2 { font-size: 18px; font-weight: 600; }
.tab-lock-card .button { justify-self: start; margin-top: 6px; }

/* ---------- Общие элементы ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); min-width: 0; }
.eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint-error { color: #FCA5A5; }
.hint-error:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; font-weight: 500; }
.chip-accent { color: var(--accent-2); background: var(--accent-soft); border-color: var(--accent-line); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 8px 14px;
  border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line-2);
  font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap;
  transition: background 150ms, border-color 150ms, color 150ms;
}
.button .icon { width: 16px; height: 16px; }
.button:hover:not(:disabled) { background: var(--panel-3); border-color: #2F5A47; }
.button:disabled { opacity: 0.45; }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.button-primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.button-wide { width: 100%; }
.button-small { min-height: 30px; padding: 5px 12px; font-size: 12px; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.text-button { color: var(--accent); font-size: 12px; font-weight: 500; padding: 4px 6px; border-radius: 6px; }
.text-button:hover { background: var(--accent-soft); }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--muted); border: 1px solid var(--line); }
.icon-button:hover { color: var(--text); background: var(--panel-3); }
.icon-button .icon { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field, .field + .button, .field-pair + .field, .field + .field-pair, .button + .disclosure, .button-row + .field { margin-top: 14px; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-pair { display: grid; grid-template-columns: 1fr; gap: 14px; }
/* Внутри пары отступ задаёт gap, иначе между полями было 24 px вместо обычных 14. */
.field-pair > .field + .field { margin-top: 0; }
.value-pill { font-size: 11px; color: var(--accent-2); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; }
.input {
  width: 100%; min-width: 0; min-height: 36px; padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line-2); font-size: 13px; color: var(--text);
  transition: border-color 150ms, background 150ms;
}
.input:hover:not(:disabled) { border-color: #2F5A47; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }
.input-compact { min-height: 30px; padding: 4px 8px; font-size: 12px; width: auto; }
select.input { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select.input option { background: var(--panel); color: var(--text); }
input[type="datetime-local"].input, input[type="date"].input { font-size: 12px; }
::-webkit-calendar-picker-indicator { filter: invert(0.75) sepia(1) hue-rotate(80deg); cursor: pointer; }
.search-field { position: relative; }
.search-field .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search-field .input { padding-left: 34px; }

.fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.fieldset:disabled { opacity: 0.55; }

/* Сегментированный переключатель (радиокнопки) */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; text-align: center; padding: 5px 0; border-radius: 5px; font-family: var(--mono); font-size: 12px; color: var(--muted); transition: background 150ms, color 150ms; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.segmented label:hover input:not(:checked) + span { color: var(--text); background: var(--panel-3); }

/* Чипы-переключатели (флажки и радиокнопки) */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle-chip { position: relative; }
.toggle-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle-chip > span {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  font-size: 12px; color: var(--muted); border: 1px solid var(--line-2); background: var(--bg);
  transition: background 150ms, border-color 150ms, color 150ms; white-space: nowrap;
}
.toggle-chip > span b { color: var(--faint); font-weight: 500; font-size: 11px; }
.toggle-chip:hover > span { color: var(--text); }
.toggle-chip input:checked + span { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.toggle-chip input:checked + span b { color: var(--accent-2); }
.toggle-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-chip input:not(:checked) + span .dot { opacity: 0.35; }
.toggle-chip[data-event="detected"] { --c: var(--accent); }
.toggle-chip[data-event="zone_enter"] { --c: var(--st-zone); }
.toggle-chip[data-event="zone_exit"] { --c: #F9A8A8; }
.toggle-chip[data-event="threshold_exceeded"] { --c: var(--st-warning); }
.toggle-chip[data-event="lost"] { --c: var(--st-lost); }
.toggle-chip[data-event] .dot { background: var(--c); }

.chip-button { padding: 6px 11px; border-radius: 999px; font-size: 12px; color: var(--text-2); border: 1px solid var(--line-2); background: var(--bg); transition: background 150ms, border-color 150ms; white-space: nowrap; }
.chip-button:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.chip-button.is-active { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Ползунки */
.range { width: 100%; height: 22px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; --fill: 50%; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--fill), var(--line-2) var(--fill)); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.range:disabled { opacity: 0.5; }

/* Двойной ползунок диапазона: два input range поверх одной дорожки. */
.dual-range { --from: 0%; --to: 100%; position: relative; height: 22px; }
.dual-range::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--line-2) var(--from), var(--accent) var(--from), var(--accent) var(--to), var(--line-2) var(--to)); }
.dual-range input { position: absolute; inset: 0; width: 100%; height: 22px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; pointer-events: none; }
.dual-range input::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.dual-range input::-moz-range-track { background: transparent; }
.dual-range input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); cursor: grab; position: relative; z-index: 2; }
.dual-range input::-moz-range-thumb { pointer-events: auto; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); cursor: grab; }
.dual-range input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px var(--accent-soft); }

/* Переключатели слоёв */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--text-2); cursor: pointer; }
.switch-label { display: inline-flex; align-items: center; gap: 10px; }
.switch { appearance: none; width: 34px; height: 20px; margin: 0; border-radius: 999px; background: var(--panel-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; flex: 0 0 auto; transition: background 150ms, border-color 150ms; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 180ms var(--ease), background 150ms; }
.switch:checked { background: rgba(74, 222, 128, 0.25); border-color: var(--accent-line); }
.switch:checked::after { transform: translateX(14px); background: var(--accent); }
.switch-row + .field { margin-top: 10px; }
.legend-swatch { display: inline-block; width: 14px; height: 14px; flex: 0 0 auto; }
.swatch-zone { border: 1.5px solid var(--st-zone); border-radius: 3px; background: repeating-linear-gradient(45deg, rgba(248, 113, 113, 0.45) 0 2px, rgba(239, 68, 68, 0.1) 2px 5px); }
.swatch-post { border: 1.5px dashed var(--accent); border-radius: 50%; background: rgba(74, 222, 128, 0.12); }
.swatch-boundary { border: 1.5px dashed var(--muted); border-radius: 50%; }
.swatch-track { height: 3px; border-radius: 3px; background: var(--accent); opacity: 0.7; }

.disclosure { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.disclosure summary { display: flex; align-items: center; gap: 6px; padding: 9px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; list-style: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary .icon { width: 14px; height: 14px; transition: transform 150ms; }
.disclosure[open] summary .icon { transform: rotate(90deg); }
.disclosure-body { padding: 4px 10px 12px; }
.disclosure-body .hint { margin-top: 10px; }

/* ================== МОНИТОРИНГ ================== */
.view-monitoring { height: 100%; display: grid; grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); gap: var(--gap); padding: var(--gap); }
.side-panel { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); min-height: 56px; }
.panel-head h2 { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.panel-head h2 .icon { color: var(--accent); width: 18px; height: 18px; }
.panel-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.block { padding: 16px; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.block-head h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }

.sim-readout { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); }
.sim-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.sim-state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sim-state[data-state="running"]::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.sim-state[data-state="paused"]::before { background: var(--st-warning); }
/* Состояние и модельное время — двумя ровными строками (в одну строку они не помещаются ни на одной ширине
   панели и переносились по словам); время стоит под текстом состояния, после точки. */
.sim-clock { font-size: 12px; color: var(--accent-2); padding-left: 15px; white-space: nowrap; }
.button-row > .button { flex: 1; }

/* Карта */
.map-panel { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.map-stage { position: relative; flex: 1; min-height: 0; background: #111316; }
#map, #history-map { position: absolute; inset: 0; background: #111316; }
.map-top { position: absolute; top: 12px; left: 12px; z-index: 800; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: calc(100% - 24px); pointer-events: none; }
.map-toolbar { display: flex; gap: 6px; flex-wrap: wrap; pointer-events: auto; }
.map-button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 12px; border-radius: 999px;
  background: rgba(17, 19, 23, 0.88); border: 1px solid var(--line-2); color: var(--text-2);
  font-size: 12px; font-weight: 500; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color 150ms, color 150ms, background 150ms; white-space: nowrap;
}
.map-button .icon { width: 15px; height: 15px; }
.map-button:hover { color: var(--text); border-color: var(--accent-line); }
.map-button[aria-pressed="true"] { color: var(--accent-2); border-color: var(--accent-line); background: rgba(22, 36, 28, 0.92); }
.map-counters { display: flex; gap: 6px; flex-wrap: wrap; }
.counter { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(17, 19, 23, 0.85); border: 1px solid var(--line); font-size: 12px; color: var(--muted); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.counter b { color: var(--text); font-weight: 600; }
.map-mobile-actions { display: none; }

.map-legend { position: absolute; left: 12px; bottom: 12px; z-index: 800; background: rgba(17, 19, 23, 0.9); border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; color: var(--text-2); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); max-width: 230px; }
.map-legend summary { padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); list-style: none; }
.map-legend summary::-webkit-details-marker { display: none; }
.map-legend summary::after { content: ' +'; color: var(--faint); }
.map-legend[open] summary::after { content: ' −'; }
.map-legend ul { display: grid; gap: 6px; padding: 0 12px 10px; }
.map-legend li { display: flex; align-items: center; gap: 8px; }

.map-notice { position: absolute; top: 100px; left: 12px; right: 12px; z-index: 900; max-width: 460px; padding: 12px 14px; border-radius: var(--radius); background: rgba(42, 33, 12, 0.96); border: 1px solid #7C5E14; color: #FDE68A; font-size: 13px; line-height: 1.5; }
.map-notice .button { margin-top: 10px; }


/* Правая панель */
.pane-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 12px 16px 0; padding: 3px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line-2); }
.pane-switch button { padding: 7px 0; border-radius: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
.pane-switch button b { font-weight: 600; margin-left: 4px; color: var(--accent-2); }
.pane-switch button[aria-selected="true"] { background: var(--panel-3); color: var(--text); }
.pane-switch button:hover { color: var(--text); }
.list-summary { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 10px; }
.list-count { font-size: 13px; color: var(--text-2); font-weight: 500; }
.list-note { font-size: 12px; color: var(--faint); }
.list-note:empty { display: none; }
.drone-list { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 14px; }
.panel-foot { display: flex; gap: 8px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.5; }
.panel-foot .icon { width: 15px; height: 15px; color: var(--accent); margin-top: 1px; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 16px; color: var(--muted); }
.empty-state strong { color: var(--text-2); font-size: 14px; font-weight: 600; }
.empty-state p { font-size: 12px; line-height: 1.5; max-width: 260px; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); color: var(--accent); background: var(--accent-soft); margin-bottom: 6px; }
.empty-icon .icon { width: 26px; height: 26px; }

/* Карточка БПЛА */
.drone-card {
  --c: var(--st-active);
  position: relative; display: flex; flex-direction: column; gap: 9px; width: 100%; padding: 12px 12px 12px 15px;
  text-align: left; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line);
  transition: background 150ms, border-color 150ms, transform 150ms;
}
.drone-card::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); }
.drone-card:hover { background: var(--panel-3); border-color: var(--line-2); }
.drone-card[aria-pressed="true"] { border-color: var(--accent); background: #18241E; box-shadow: 0 0 0 1px var(--accent-line); }
.dc-head { display: flex; align-items: center; gap: 8px; }
.dc-glyph { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--bg); color: var(--c); flex: 0 0 auto; border: 1px solid var(--line); }
.dc-glyph svg { width: 18px; height: 18px; fill: currentColor; stroke: none; transform: rotate(var(--heading, 0deg)); transition: transform 300ms linear; }
.dc-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dc-code { font-size: 14px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.dc-type { font-size: 12px; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap; }
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.dc-coords { font-size: 13px; color: var(--accent-2); letter-spacing: 0.01em; }
.dc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.metric { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); min-width: 0; }
.metric small { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.metric b { font-family: var(--mono); font-size: 13px; font-weight: 500; white-space: nowrap; }
.metric b span { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 2px; }
/* Знак градуса пишется слитно с числом: 91°, а не 91 °. */
.metric b .unit-tight { margin-left: 0; }
.dc-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 11.5px; color: var(--muted); }
.dc-facts dt { color: var(--faint); }
.dc-facts dd { color: var(--text-2); font-family: var(--mono); font-size: 11.5px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Зоны и посты в списке */
.scene-group { padding: 14px 16px 4px; }
.scene-group + .scene-group { border-top: 1px solid var(--line); margin-top: 10px; }
.scene-title { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.scene-list { display: flex; flex-direction: column; gap: 6px; }
.scene-group .hint { margin: 10px 0 8px; }
.scene-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line); text-align: left; transition: background 150ms, border-color 150ms; }
.scene-item:hover { background: var(--panel-3); border-color: var(--line-2); }
.scene-item.is-selected { border-color: var(--accent); background: #18241E; }
.scene-item > .icon, .scene-item > svg { width: 20px; height: 20px; color: var(--accent); }
.scene-item .radar-station-icon { fill: currentColor; stroke: none; }
.scene-item .zone-glyph { color: var(--st-zone); }
.scene-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scene-content strong { font-size: 13px; font-weight: 600; }
.scene-content small { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
/* У зоны подпись — название поста, а не числа: обычный шрифт, как у остальных названий. */
.zone-item .scene-content small { font-family: var(--sans); font-size: 12px; }
.scene-meta { font-family: var(--mono); font-size: 11px; color: var(--accent-2); white-space: nowrap; }
.scene-meta.is-busy { color: var(--st-zone); }

/* Карточка «Подробнее» поверх карты */
.details-card {
  --c: var(--st-active);
  position: absolute; top: 12px; right: 12px; z-index: 950; width: 340px; max-height: calc(100% - 24px);
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(21, 24, 28, 0.97); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: slide-in 200ms var(--ease);
}
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } }
.details-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.details-head .dc-glyph { width: 36px; height: 36px; border-radius: 10px; }
.details-head .dc-glyph svg { width: 22px; height: 22px; }
.details-head h2 { font-family: var(--mono); font-size: 16px; font-weight: 600; }
.details-body { overflow: auto; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.details-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.details-metrics .metric b { font-size: 16px; }
.compass { width: 13px; height: 13px; display: inline-block; vertical-align: -1px; margin-right: 4px; color: var(--accent); fill: currentColor; stroke: none; transform: rotate(var(--heading, 0deg)); transition: transform 300ms linear; }
.coords-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.coords-row .mono { font-size: 13px; color: var(--accent-2); }
.coords-row .icon-button { width: 28px; height: 28px; }
.details-facts { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 12px; }
.details-facts dt { color: var(--faint); }
.details-facts dd { text-align: right; font-family: var(--mono); color: var(--text-2); }
.spark-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spark { padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.spark-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-bottom: 4px; }
.spark-head b { color: var(--text-2); font-family: var(--mono); font-weight: 500; }
.spark svg { display: block; width: 100%; height: 34px; overflow: hidden; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark .spark-area { fill: rgba(74, 222, 128, 0.12); stroke: none; }
.spark .spark-limit { stroke: var(--st-warning); stroke-dasharray: 3 3; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.7; }
.details-section-title { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 600; margin-bottom: 6px; }
.mini-events { display: flex; flex-direction: column; gap: 4px; }
.mini-events li { display: grid; grid-template-columns: auto 1fr; gap: 8px; font-size: 12px; color: var(--text-2); align-items: baseline; }
.mini-events time { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.details-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.details-actions .button { min-height: 34px; font-size: 12px; }

/* Уведомления — в левом нижнем углу, внутри левой панели и по её ширине: не закрывают карточки объектов,
   кнопки карты и легенду. */
.toast-region { position: fixed; left: calc(var(--gap) + 6px); bottom: calc(var(--gap) + 6px); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; pointer-events: none; }
.toast {
  --c: var(--st-zone);
  pointer-events: auto; display: flex; align-items: center; gap: 10px; width: calc(var(--left-w) - 12px);
  padding: 10px 12px; border-radius: var(--radius); background: rgba(21, 24, 28, 0.97); border: 1px solid var(--line-2);
  border-left: 3px solid var(--c); box-shadow: var(--shadow); text-align: left; animation: toast-in 220ms var(--ease);
}
.toast .icon { color: var(--c); width: 20px; height: 20px; }
.toast strong { display: block; font-size: 13px; }
.toast span { display: block; font-size: 12px; color: var(--muted); }
.toast.is-leaving { opacity: 0; transform: translateX(-12px); transition: opacity 200ms, transform 200ms; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ================== СТРАНИЦЫ (история, статистика, журнал) ================== */
.view-page { max-width: 1480px; margin: 0 auto; padding: 24px 24px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.lead { font-size: 13px; color: var(--muted); margin-top: 6px; max-width: 720px; line-height: 1.55; }
.head-stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.head-stats div { padding: 8px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); min-width: 110px; }
.head-stats dt { font-size: 11px; color: var(--faint); }
.head-stats dd { font-family: var(--mono); font-size: 16px; font-weight: 500; margin-top: 2px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 14px 16px; margin-bottom: 14px; }
.toolbar .field { margin: 0; min-width: 180px; }
.toolbar .field-grow { flex: 1 1 260px; }
.toolbar .search-field { min-width: 220px; }
/* Ряд чипов высотой с поле ввода: подписи над полями и сами поля стоят на одной линии. */
.toolbar .preset-row, .toolbar .chip-group { min-height: 36px; align-items: center; }

/* Плеер истории */
.player { overflow: hidden; margin-bottom: 14px; }
.player-map { position: relative; height: min(58vh, 560px); min-height: 320px; background: #111316; }
.player-overlay { position: absolute; top: 12px; left: 12px; z-index: 800; padding: 5px 11px; border-radius: 999px; background: rgba(17, 19, 23, 0.88); border: 1px solid var(--line-2); font-size: 12px; color: var(--text-2); }
.player-bar { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--bg-elev); }
.play-button { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: 0 0 auto; transition: transform 150ms, background 150ms; }
.play-button .icon { width: 20px; height: 20px; fill: currentColor; }
.play-button:hover:not(:disabled) { background: var(--accent-2); transform: scale(1.04); }
.play-button:disabled { opacity: 0.4; }
.timeline { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.timeline-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timeline-current { font-size: 15px; color: var(--accent-2); font-weight: 500; }
.timeline-speed { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.timeline-labels { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--faint); }

/* Таблица */
.table-panel { overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-head h2 { font-size: 15px; font-weight: 600; }
.table-scroll { overflow: auto; max-height: 480px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; white-space: nowrap; }
.data-table th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); color: var(--muted); font-weight: 500; font-size: 12px; text-align: left; }
.data-table th, .data-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); }
.data-table td { font-family: var(--mono); color: var(--text-2); }
.data-table td:first-child { color: var(--text); font-weight: 500; }
.data-table tbody tr { cursor: pointer; transition: background 120ms; }
.data-table tbody tr:hover { background: var(--panel-3); }
.data-table tbody tr.is-current { background: rgba(74, 222, 128, 0.1); box-shadow: inset 3px 0 0 var(--accent); }
.data-table .empty-cell { text-align: center; color: var(--muted); font-family: var(--sans); padding: 28px; cursor: default; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Статистика */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.kpi-icon .icon { width: 16px; height: 16px; }
.kpi-value { font-family: var(--mono); font-size: 28px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-value span { font-size: 14px; color: var(--muted); margin-left: 4px; }
.kpi-note { font-size: 11.5px; color: var(--faint); }
.kpi.is-alert .kpi-icon { background: rgba(248, 113, 113, 0.14); color: var(--st-zone); }

.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.chart-card { padding: 18px; display: flex; flex-direction: column; min-width: 0; }
.chart-card:not(.chart-wide):not(.chart-full) { grid-column: span 1; }
.chart-wide { grid-column: span 2; }
.chart-full { grid-column: 1 / -1; }
.chart-grid > .chart-card:nth-last-child(-n + 2) { grid-column: span 1; }
.chart-grid > .chart-card:nth-last-child(2) { grid-column: span 2; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chart-head h2 { font-size: 15px; font-weight: 600; }
.chart-head .hint { margin-top: 2px; }
/* График занимает свободную высоту карточки: у карточек одного ряда «Числовые данные» на одной линии.
   Холст лежит поверх контейнера и не влияет на высоту ряда, иначе Chart.js мог бы только увеличивать её. */
.chart-canvas { position: relative; flex: 1 0 240px; min-height: 240px; }
.chart-canvas canvas { position: absolute; left: 0; top: 0; }
.chart-canvas-donut { flex: 0 0 190px; min-height: 190px; }
.chart-data { margin-top: 12px; font-size: 12px; color: var(--muted); }
.chart-data summary { cursor: pointer; color: var(--faint); }
.chart-data p { margin-top: 8px; line-height: 1.8; font-size: 11.5px; color: var(--text-2); }
.donut-legend { display: grid; gap: 6px; margin-top: 12px; }
.donut-legend li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend b { font-family: var(--mono); font-weight: 500; color: var(--text); }
.donut-legend span:last-child { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 48px; text-align: right; }

.heatmap { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 3px; }
.heat-day, .heat-hour { font-size: 11px; color: var(--faint); display: flex; align-items: center; }
.heat-hour { justify-content: center; font-family: var(--mono); font-size: 10px; }
.heat-cell { height: 24px; border-radius: 4px; background: var(--heat, #1C2026); border: 1px solid rgba(255, 255, 255, 0.02); transition: transform 120ms; }
.heat-cell:hover { transform: scale(1.15); outline: 1px solid var(--accent-2); position: relative; z-index: 1; }
.heat-scale { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--faint); }
.heat-scale span { margin: 0 4px; }
.heat-scale i { width: 14px; height: 10px; border-radius: 3px; }
.heat-scale i:nth-of-type(1) { background: #1C2026; }
.heat-scale i:nth-of-type(2) { background: #14532D; }
.heat-scale i:nth-of-type(3) { background: #15803D; }
.heat-scale i:nth-of-type(4) { background: #22C55E; }
.heat-scale i:nth-of-type(5) { background: #86EFAC; }
.chart-tooltip { position: fixed; z-index: 4000; pointer-events: none; padding: 7px 10px; border-radius: 8px; background: #1A1D22; border: 1px solid var(--line-2); font-size: 12px; color: var(--text); box-shadow: var(--shadow); white-space: nowrap; }
.chart-tooltip b { font-family: var(--mono); color: var(--accent-2); }

/* Журнал */
.event-panel { overflow: hidden; }
.event-list { display: flex; flex-direction: column; }
.event-row {
  --c: var(--accent);
  display: grid; grid-template-columns: 36px 170px 110px minmax(150px, 210px) 1fr 20px; align-items: center; gap: 14px;
  width: 100%; padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; transition: background 120ms;
}
.event-row:last-child { border-bottom: 0; }
.event-row:hover { background: var(--panel-3); }
.event-row:hover .event-go { color: var(--accent); transform: translateX(2px); }
.event-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.event-icon .icon { width: 17px; height: 17px; }
.event-row time { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.event-row .event-code { font-family: var(--mono); font-weight: 600; }
.event-label { color: var(--c); font-weight: 500; }
.event-details { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-go { width: 16px; height: 16px; color: var(--faint); transition: transform 150ms, color 150ms; }
.event-zone_enter { --c: var(--st-zone); }
.event-zone_exit { --c: #F9A8A8; }
.event-threshold_exceeded { --c: var(--st-warning); }
.event-lost { --c: var(--st-lost); }
.empty-row { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ================== Leaflet ================== */
.leaflet-container { font-family: var(--sans); background: #111316; }
/* Светлые тайлы OSM инвертируются и тонируются в тёмно-зелёный; слои данных фильтр не затрагивает. */
.basemap { filter: invert(1) hue-rotate(180deg) grayscale(1) brightness(0.62) contrast(1.15); }
.leaflet-control-zoom, .leaflet-control-attribution, .leaflet-bar { box-shadow: none !important; border: 1px solid var(--line-2) !important; border-radius: var(--radius-sm) !important; overflow: hidden; }
.leaflet-bar a { background: rgba(17, 19, 23, 0.92); color: var(--text-2); border-color: var(--line) !important; width: 34px !important; height: 34px !important; line-height: 34px !important; }
.leaflet-bar a:hover, .leaflet-bar a:focus { background: var(--panel-3); color: var(--accent); }
.leaflet-bar a.leaflet-disabled { background: rgba(17, 19, 23, 0.92); color: var(--faint); }
.leaflet-control-attribution { background: rgba(13, 15, 18, 0.85) !important; color: var(--muted); font-size: 10px !important; padding: 2px 6px !important; }
.leaflet-control-attribution a { color: var(--accent-2); }
.leaflet-control-scale-line { border-color: var(--muted); color: var(--text-2); background: rgba(13, 15, 18, 0.8); font-size: 10px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #1A1D22; color: var(--text); box-shadow: var(--shadow); }
.leaflet-popup-content-wrapper { border: 1px solid var(--line-2); border-radius: var(--radius); }
.leaflet-popup-content { margin: 12px 14px; font-size: 12.5px; line-height: 1.5; min-width: 200px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.popup-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.popup-title strong { font-family: var(--mono); font-size: 14px; }
.popup-line { color: var(--text-2); margin: 2px 0; }
.popup-line.mono { color: var(--accent-2); }
.popup-muted { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.popup-actions { margin-top: 10px; }
.popup-actions .button { width: 100%; min-height: 32px; font-size: 12px; }
.leaflet-tooltip.scene-label { background: rgba(17, 19, 23, 0.9); border: 1px solid var(--line-2); box-shadow: none; color: var(--text-2); padding: 3px 7px; font-family: var(--mono); font-size: 11px; border-radius: 6px; }
.leaflet-tooltip.scene-label::before { display: none; }
.leaflet-tooltip.zone-label { color: #FECACA; border-color: rgba(248, 113, 113, 0.45); }
.leaflet-tooltip.post-label { color: var(--accent-2); }
.map-zoomed-out .zone-label, .map-zoomed-out .post-label { display: none; }
.leaflet-interactive:focus-visible { outline: 2px solid var(--accent); }
.zone-shape { fill: url(#zone-hatch); fill-opacity: 1; }

/* Маркеры */
.uav-marker, .radar-marker { background: transparent; border: 0; }
.uav-symbol { position: relative; width: 26px; height: 26px; color: var(--drone-color); transition: opacity 450ms linear; filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 3px rgba(0, 0, 0, 0.9)); }
.uav-symbol.has-type-icon { width: 28px; height: 28px; }
.uav-symbol > svg { width: 26px; height: 26px; fill: currentColor; stroke: #0B0C0E; stroke-width: 1.2; transform: rotate(var(--heading)); transition: transform var(--heading-duration, 250ms) linear; }
.uav-heading { position: relative; width: 28px; height: 28px; transform: rotate(var(--heading)); transition: transform var(--heading-duration, 250ms) linear; }
.uav-heading svg { display: block; width: 28px; height: 28px; fill: currentColor; stroke: none; }
.uav-unknown-mark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 800 11px/1 var(--sans); color: #0B0C0E; pointer-events: none; }
.uav-unknown .uav-heading, .uav-unknown .uav-heading svg { width: 30px; height: 30px; }
.uav-symbol.uav-unknown { width: 30px; height: 30px; }
.dc-glyph { position: relative; }
.dc-glyph .uav-unknown-mark { font-size: 9px; }
.dc-glyph svg:has(+ .uav-unknown-mark) { width: 22px; height: 22px; }
.details-head .dc-glyph .uav-unknown-mark { font-size: 11px; }
.details-head .dc-glyph svg:has(+ .uav-unknown-mark) { width: 28px; height: 28px; }
.uav-course-vector { position: absolute; left: 13px; top: -10px; width: 2px; height: 10px; border-radius: 1px; background: currentColor; pointer-events: none; }
.uav-symbol.is-estimated > .uav-heading, .uav-symbol.is-estimated > svg, .uav-symbol.is-estimated > .uav-unknown-mark { opacity: 0.45; }
.out-timer { display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 8px; font-size: 12px; color: var(--st-warning); background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.28); }
.out-timer .icon { width: 14px; height: 14px; }
.out-timer { align-self: flex-start; }
.out-timer b { font-size: 13px; }
.out-timer[hidden] { display: none !important; }
.uav-symbol.is-selected::after { content: ''; position: absolute; inset: -8px; border: 2px solid var(--accent); border-radius: 50%; box-shadow: 0 0 12px rgba(74, 222, 128, 0.6); animation: select-ring 1.6s ease-in-out infinite; }
@keyframes select-ring { 50% { inset: -11px; opacity: 0.55; } }
.uav-symbol.is-new, .uav-symbol.is-in-zone { animation: drone-pulse 1.2s ease-in-out 3; }
@keyframes drone-pulse { 50% { opacity: 0.5; } }
.radar-station { width: 32px; height: 32px; padding: 5px; color: var(--accent); background: rgba(13, 15, 18, 0.92); border: 1px solid var(--accent-line); border-radius: 9px; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.08); }
.radar-station svg { display: block; width: 100%; height: 100%; stroke: none; fill: currentColor; }
.radar-sweep, .radar-trail { pointer-events: none; }

/* ================== Адаптивность ================== */
.drawer-close, .drawer-backdrop { display: none; }
.noscript-message { position: fixed; bottom: 20px; left: 20px; right: 20px; z-index: 5000; background: var(--panel); border: 1px solid var(--st-warning); padding: 16px; border-radius: var(--radius); }

@media (max-width: 1360px) {
  :root { --left-w: 270px; --right-w: 310px; }
  .tab { padding: 8px 12px; }
  /* Пять KPI — ряды 3 + 2 без пустой клетки. */
  .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi { grid-column: span 2; }
  .kpi:nth-child(n + 4) { grid-column: span 3; }
  .event-row { grid-template-columns: 36px 160px 100px minmax(130px, 180px) 1fr 20px; }
}
/* Полные подписи в шапке не помещаются: колонки по содержимому, чтобы метка «ДЕМО-РЕЖИМ» не обрезалась. */
@media (max-width: 1260px) and (min-width: 1024px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .tabs { justify-self: center; }
  .sim-badge #sim-badge-label { display: none; }
}
@media (max-width: 1180px) and (min-width: 1024px) {
  /* Правая панель 300 px: в карточке БПЛА в одну строку помещаются ID и самый длинный статус. */
  :root { --left-w: 250px; --right-w: 300px; --gap: 10px; }
  .tab span:not(.tab-badge) { display: none; }
  .map-button span { display: none; }
}
@media (max-width: 1023px) {
  .topbar { grid-template-columns: 1fr auto; padding: 8px 12px; gap: 10px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; border-radius: var(--radius); }
  .tab { flex: 1; justify-content: center; padding: 8px 6px; border-radius: 7px; }
  .sim-badge #sim-badge-label { display: none; }
  .view-monitoring { display: block; padding: 0; height: 100%; }
  .map-panel { height: 100%; border-radius: 0; border: 0; }
  .map-mobile-actions { display: flex; gap: 8px; position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 900; }
  .map-mobile-actions .map-button { min-height: 40px; padding: 8px 16px; font-size: 13px; box-shadow: var(--shadow); }
  .map-mobile-actions b { color: var(--accent-2); }
  .map-legend { bottom: 70px; }
  .map-legend:not([open]) { bottom: 70px; }
  .side-panel { position: fixed; top: 0; bottom: 0; width: min(360px, calc(100vw - 28px)); z-index: 2100; border-radius: 0; visibility: hidden; transition: transform 220ms var(--ease), visibility 220ms; }
  .left-panel { left: 0; transform: translateX(-100%); }
  .right-panel { right: 0; transform: translateX(100%); }
  .side-panel.is-open { transform: translateX(0); visibility: visible; }
  .drawer-close { display: grid; }
  .drawer-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 2000; background: rgba(4, 5, 7, 0.7); }
  .toast-region { left: 10px; right: 10px; bottom: auto; top: 112px; align-items: stretch; }
  .toast { width: auto; }
  .details-card { top: auto; bottom: 64px; right: 10px; left: 10px; width: auto; max-height: 62%; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Две колонки KPI: раскладка 3 + 2 с ПК здесь не нужна. */
  .kpi, .kpi:nth-child(n + 4) { grid-column: auto; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-grid > .chart-card, .chart-wide, .chart-full, .chart-grid > .chart-card:nth-last-child(2) { grid-column: 1 / -1; }
  .view-page { padding: 18px 14px 32px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .head-stats { justify-content: flex-start; }
  .event-row { grid-template-columns: 34px 1fr auto; grid-template-areas: "icon label time" "icon code details"; gap: 2px 12px; padding: 12px 14px; }
  .event-row .event-icon { grid-area: icon; }
  .event-row time { grid-area: time; text-align: right; }
  .event-row .event-code { grid-area: code; }
  .event-row .event-label { grid-area: label; }
  .event-row .event-details { grid-area: details; text-align: right; }
  .event-row .event-go { display: none; }
}
@media (max-width: 600px) {
  .brand-mark { width: 34px; height: 34px; }
  .brand-title { font-size: 15px; }
  .clock-label { display: none; }
  .clock time { font-size: 12px; }
  .sim-badge { padding: 5px 9px; }
  .sim-badge time { display: none; }
  .tab { font-size: 12px; gap: 5px; padding: 8px 4px; }
  .tab .icon { display: none; }
  .map-mobile-actions { bottom: 22px; }
  .brand-demo { font-size: 10px; padding: 2px 7px; white-space: normal; line-height: 1.25; border-radius: 8px; }
  .brand-title { white-space: nowrap; }
  .map-button span { display: none; }
  .map-mobile-actions .map-button span { display: inline; }
  .counter-label { display: none; }
  .map-legend { display: none; }
  .toolbar .field, .toolbar .field-grow, .toolbar .search-field { min-width: 100%; }
  .toolbar > .button { width: 100%; }
  .player-bar { gap: 10px; padding: 12px; }
  .play-button { width: 42px; height: 42px; }
  .timeline-current { font-size: 12px; }
  .heatmap { grid-template-columns: 26px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heat-hour:nth-child(even) { visibility: hidden; }
  .kpi-value { font-size: 22px; }
  .page-head h1 { font-size: 22px; }
}
/* ================== Анимации ==================
   Короткие и мягкие: только opacity и transform, чтобы не нагружать карту.
   При «уменьшить движение» в системе всё отключается правилом ниже. */
/* Смена раздела: страницы всплывают, карта плавно проявляется (без transform,
   иначе выдвижные панели внутри раздела потеряли бы position: fixed). */
.view:not([hidden]) { animation: view-in 320ms var(--ease) backwards; }
.view-monitoring:not([hidden]) { animation-name: fade-in; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade-in { from { opacity: 0; } }

/* Панели и блоки мониторинга появляются по очереди при загрузке. */
@media (min-width: 1024px) {
  .view-monitoring > :is(.left-panel, .map-panel, .right-panel) { animation: rise-in 420ms var(--ease) backwards; }
  .view-monitoring > .map-panel { animation-delay: 60ms; }
  .view-monitoring > .right-panel { animation-delay: 120ms; }
}
.view-page > * { animation: rise-in 420ms var(--ease) backwards; }
.view-page > :nth-child(2) { animation-delay: 50ms; }
.view-page > :nth-child(3) { animation-delay: 100ms; }
.view-page > :nth-child(n+4) { animation-delay: 150ms; }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }

/* Скользящая подсветка активной вкладки (js/layout.js). */
.tabs { position: relative; }
.tab-indicator {
  position: absolute; top: 0; left: 0; z-index: 0; border-radius: 999px; background: var(--accent);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.28); pointer-events: none;
  transition: transform 340ms var(--ease), width 340ms var(--ease), height 340ms var(--ease);
}
.tab-indicator.is-instant { transition: none; }
.tabs.has-indicator .tab { z-index: 1; }
.tabs.has-indicator .tab.is-active { background: transparent; }
.tab .icon { transition: transform 200ms var(--ease); }
.tab:hover .icon { transform: translateY(-1px) scale(1.08); }
.tab-badge.is-bumped { animation: badge-pop 420ms var(--ease); }
@keyframes badge-pop { 40% { transform: scale(1.35); } }

/* Логотип: луч радара медленно обходит круг. */
.brand-mark .icon { animation: brand-sweep 6s linear infinite; }
@keyframes brand-sweep { to { transform: rotate(360deg); } }

/* Кнопки чуть «нажимаются», карточки приподнимаются при наведении. */
.button, .map-button, .icon-button, .chip-button, .text-button { transition-property: background, border-color, color, transform, box-shadow; transition-duration: 150ms; }
.button:active:not(:disabled), .map-button:active, .icon-button:active, .chip-button:active, .play-button:active:not(:disabled) { transform: scale(0.96); }
.button-primary:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(74, 222, 128, 0.25); }
.drone-card:hover, .scene-item:hover { transform: translateY(-1px); }
.drone-card:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28); }
.scene-item { transition: background 150ms, border-color 150ms, transform 150ms; }

/* Новая карточка БПЛА и смена статуса (js/cards.js). */
.drone-card.is-new { animation: card-in 380ms var(--ease) backwards; }
@keyframes card-in { from { opacity: 0; transform: translateX(14px) scale(0.98); } }
.status-pill.is-changed { animation: pill-flash 900ms var(--ease); }
@keyframes pill-flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); transform: scale(1.08); } 100% { box-shadow: 0 0 0 10px transparent; } }
.out-timer:not([hidden]) { animation: fade-in 240ms var(--ease); }

/* Новые строки журнала (js/events.js). */
.event-row.is-new { animation: row-in 420ms var(--ease) backwards; }
@keyframes row-in { from { opacity: 0; transform: translateY(-8px); background: var(--accent-soft); } }

/* Статистика: KPI и ячейки тепловой карты при открытии раздела (js/stats.js). */
.is-intro .kpi { animation: rise-in 460ms var(--ease) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
.is-intro .heat-cell { animation: heat-in 420ms var(--ease) backwards; animation-delay: calc(var(--h, 0) * 18ms + 120ms); }
@keyframes heat-in { from { opacity: 0; transform: scale(0.6); } }
.kpi { transition: border-color 150ms, transform 150ms; }
.kpi:hover { border-color: var(--line-2); transform: translateY(-2px); }

/* Всплывающие слои: сообщение, окно второй вкладки, затемнение под панелью. */
.app-message:not([hidden]) { animation: drop-in 260ms var(--ease); }
@keyframes drop-in { from { opacity: 0; transform: translate(-50%, -8px); } }
.tab-lock:not([hidden]) { animation: fade-in 220ms ease-out; }
.tab-lock:not([hidden]) .tab-lock-card { animation: pop-in 300ms var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94) translateY(6px); } }
.drawer-backdrop:not([hidden]) { animation: fade-in 220ms ease-out; }
.disclosure[open] > :not(summary) { animation: fade-in 200ms ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Открытая карточка «Подробнее» не перекрывает кнопки и счётчики карты. Чем меньше ширина
   карты, тем компактнее они становятся: сначала только значки и числа, затем один столбец слева. */
@media (min-width: 1024px) {
  .map-stage:has(.details-card:not([hidden])) .map-top { max-width: calc(100% - 380px); }
  /* Снизу карточка заканчивается на 12 px выше масштаба, кнопок «+/−» и подписи карты (они занимают 121 px от низа).
     Раньше на невысоком экране они лежали поверх низа карточки и кнопки «В истории»; теперь прокручивается её содержимое. */
  .details-card { max-height: calc(100% - 145px); }
}
@media (min-width: 1024px) and (max-width: 1460px) {
  .map-stage:has(.details-card:not([hidden])) :is(.map-toolbar .map-button span, .counter-label) { display: none; }
}
@media (min-width: 1024px) and (max-width: 1260px) {
  .map-stage:has(.details-card:not([hidden])) .map-top { align-items: stretch; }
  .map-stage:has(.details-card:not([hidden])) :is(.map-toolbar, .map-counters) { flex-direction: column; flex-wrap: nowrap; }
  .map-stage:has(.details-card:not([hidden])) :is(.map-button, .counter) { justify-content: center; }
  /* Легенда ушла бы под карточку; она вернётся, когда карточку закроют. */
  .map-stage:has(.details-card:not([hidden])) .map-legend { display: none; }
}
