:root {
  --bg: #16181d;
  --panel: #1c1f26;
  --view: #0b0d11;
  --line: #2a2e37;
  --fg: #e8eaed;
  --fg-2: #9aa0aa;
  /* третичный текст: светлее макетного #6b7280, чтобы держать контраст ≥ 4.5:1 на панели */
  --fg-3: #8a909b;
  --accent: #4a8cff;
  --accent-a16: rgba(74, 140, 255, 0.16);
  /* фон кнопок с белым текстом: контраст ≥ 4.5:1 */
  --accent-solid: #2f6fe0;
  --sev1: #f2c14e;
  --sev2: #e8772e;
  --sev3: #b8322a;
  --hot: #fff3b0;
  --ref: #7fd1ff;
  --err: #ff8f85;
  --warn: #f2c14e;
  --h: 36px;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  color-scheme: dark;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font:
    400 13px/1.45 Inter,
    system-ui,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  min-width: 1280px;
}
.mono {
  font-family: "JetBrains Mono", monospace;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: 248px 1fr 336px;
  height: 100vh;
  min-height: 620px;
}

/* левая панель */
.ident {
  margin: 2px 0 20px;
}
.ident .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 600 17px/1.2 Inter;
  letter-spacing: -0.005em;
}
.ident .brand svg {
  width: 22px;
  height: 22px;
}
.ident .aoi {
  margin: 4px 0 0 31px;
  font-size: 12.5px;
  color: var(--fg-2);
}
.left {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 12px 12px 16px;
}
.grp {
  margin-bottom: 18px;
}
.grp h2 {
  font: 500 12px Inter;
  color: var(--fg-2);
  margin: 0 0 8px;
}
.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.tool {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #20242c;
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 12px;
  color: var(--fg-2);
}
.tool svg {
  width: 13px;
  height: 13px;
  flex: none;
}
.tool[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--fg);
  background: var(--accent-a16);
}
.boxrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
  color: var(--fg);
}
.boxrow button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  padding: 0;
}
.boxrow button:hover {
  text-decoration: underline;
}
#map.drawing canvas {
  cursor: crosshair !important;
}
.maplibregl-ctrl-group .b3d {
  font: 600 11px Inter;
  color: #e8eaed;
  filter: none !important;
}
.maplibregl-ctrl-group .b3d[aria-pressed="true"] {
  background: var(--accent-solid);
}
.hint {
  font-size: 11.5px;
  color: var(--fg-3);
  margin: 8px 0 0;
  line-height: 1.4;
}
.dates {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.dates label {
  font-size: 11.5px;
  color: var(--fg-3);
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 6px;
}
.dates input {
  background: #20242c;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--fg);
  padding: 5px 7px;
  font: 400 12px Inter;
  font-variant-numeric: tabular-nums;
  width: 100%;
}
.run {
  margin-top: 10px;
  width: 100%;
  border: 0;
  border-radius: 5px;
  background: var(--accent-solid);
  color: #fff;
  padding: 7px;
  font-weight: 500;
}
.run:hover {
  background: #2963cc;
}
.layer {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 28px;
  font-size: 12.5px;
  color: var(--fg);
}
.layer input {
  accent-color: var(--accent);
  margin: 0;
}
.layer .sw {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}
.layer .cnt {
  margin-left: auto;
  color: var(--fg-3);
  font-size: 11.5px;
}

/* центр */
.center {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#map {
  flex: 1;
  min-height: 0;
  background: var(--view);
  position: relative;
}
.maplibregl-ctrl-attrib {
  background: rgba(22, 24, 29, 0.75) !important;
  color: var(--fg-3) !important;
  font-size: 10px;
}
.maplibregl-ctrl-attrib a {
  color: var(--fg-2) !important;
}
.maplibregl-ctrl-group {
  background: var(--panel) !important;
  border: 1px solid var(--line);
}
.maplibregl-ctrl-group button:not(.fitbtn) {
  filter: invert(0.85);
}
.maplibregl-ctrl-group .fitbtn svg path,
.maplibregl-ctrl-group .fitbtn svg circle {
  stroke: #e8eaed;
}
.maplibregl-ctrl-group .fitbtn svg circle {
  fill: #e8eaed;
}
.legend {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  background: rgba(22, 24, 29, 0.88);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--fg-2);
  backdrop-filter: blur(6px);
}
.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  display: block;
  width: 12px;
  height: 9px;
  border-radius: 2px;
}
.legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 6px 2px rgba(255, 190, 60, 0.8);
}
.legend .dash {
  width: 14px;
  height: 0;
  border-top: 1.5px dashed var(--ref);
  border-radius: 0;
}
.popup {
  font: 400 12px Inter;
  color: var(--fg);
}
.maplibregl-popup-content {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: none;
}
.maplibregl-popup-tip {
  border-top-color: var(--panel) !important;
  border-bottom-color: var(--panel) !important;
}
.popup b {
  font-weight: 500;
}
.popup .k {
  color: var(--fg-3);
}

/* ненавязчивый индикатор загрузки: тонкая полоса по верху карты */
.busy {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  z-index: 3;
  overflow: hidden;
  background: rgba(74, 140, 255, 0.25);
  pointer-events: none;
}
.busy::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  background: var(--accent);
  animation: busy 1.1s ease-in-out infinite;
}
@keyframes busy {
  from {
    left: -30%;
  }
  to {
    left: 100%;
  }
}

.basemap {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  width: 74px;
  height: 74px;
  border-radius: 7px;
  overflow: hidden;
  border: 2px solid rgba(232, 234, 237, 0.85);
  padding: 0;
  background: #222 center/cover no-repeat;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.basemap span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 0 4px;
  font: 500 11px Inter;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  text-align: center;
}
.basemap:hover {
  border-color: #fff;
}
.fitbtn svg {
  width: 16px;
  height: 16px;
  display: block;
  margin: auto;
}
.maplibregl-ctrl-group .fitbtn {
  filter: none !important;
  color: #1c1f26;
}

/* лента времени */
.tl {
  flex: none;
  height: 148px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 8px 14px 10px;
  display: flex;
  flex-direction: column;
}
.tl-h {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--fg-2);
  margin-bottom: 4px;
}
.tl-h b {
  color: var(--fg);
  font-weight: 500;
}
.tl-h .k {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tl-h .k i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: block;
}
.tl-h .sp {
  flex: 1;
}
.tlbtns {
  flex: none;
  white-space: nowrap;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.tlbtns button {
  border: 0;
  border-left: 1px solid var(--line);
  background: #20242c;
  color: var(--fg-2);
  padding: 3px 10px;
  font-size: 12px;
}
/* группа обрезает содержимое по скруглению, поэтому кольцо фокуса — внутрь */
.tlbtns button:focus-visible {
  outline-offset: -2px;
}
.tlbtns button:first-child {
  border-left: 0;
}
.tlbtns button:hover {
  color: var(--fg);
  background: #262b34;
}
.tlbtns button[aria-pressed="true"] {
  background: var(--accent-a16);
  color: var(--fg);
}
.tlbtns button:disabled {
  opacity: 0.35;
  cursor: default;
}
/* год сезона между стрелками — в стиле кнопок ленты */
.tlbtns .yr {
  border-left: 1px solid var(--line);
  background: #20242c;
  color: var(--fg);
  padding: 3px 10px;
  font-size: 12px;
  min-width: 48px;
  text-align: center;
}
#tl {
  flex: 1;
  width: 100%;
  display: block;
  cursor: crosshair;
  user-select: none;
}

/* справка */
.right {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rep {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.15s;
}
.rep.stale,
.list.stale {
  opacity: 0.55;
}
.per {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--fg-2);
}
.per b {
  color: var(--fg);
  font-weight: 500;
}
.per .psum {
  color: var(--fg-3);
  font-size: 12px;
}
.per .psum b {
  color: var(--fg-2);
  font-weight: 500;
}
.rep .cap {
  font-size: 12px;
  color: var(--fg-2);
}
.total {
  font: 600 34px/1.1 Inter;
  letter-spacing: -0.01em;
  margin: 4px 0 2px;
}
.total small {
  font: 500 15px Inter;
  color: var(--fg-2);
  margin-left: 6px;
}
.sub {
  font-size: 12px;
  color: var(--fg-3);
}
.warn,
.err {
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}
.warn {
  color: var(--warn);
}
.err {
  color: var(--err);
}
.bar {
  display: flex;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  margin: 14px 0 10px;
  background: #262a33;
}
.bar i {
  display: block;
  height: 100%;
}
.sev {
  display: grid;
  grid-template-columns: 12px 1fr auto 48px;
  gap: 8px;
  align-items: center;
  height: 26px;
  font-size: 12.5px;
}
.sev i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.sev .ha {
  font-weight: 500;
}
.sev .pc {
  text-align: right;
  color: var(--fg-2);
}
.list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.list h2,
.exp h2 {
  font: 500 12px Inter;
  color: var(--fg-2);
  margin: 0;
  padding: 10px 16px 6px;
  display: flex;
}
.list h2 span {
  margin-left: auto;
  color: var(--fg-3);
  font-weight: 400;
}
.empty {
  padding: 6px 16px 12px;
  font-size: 12.5px;
  color: var(--fg-2);
}
.empty p {
  margin: 0 0 10px;
}
.empty button {
  border: 1px solid var(--line);
  background: #20242c;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--fg);
}
.empty button:hover {
  border-color: #3a3f4a;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th {
  font-weight: 500;
  color: var(--fg-3);
  text-align: left;
  padding: 4px 16px;
  position: sticky;
  top: 0;
  background: var(--panel);
}
td {
  padding: 4px 16px;
  border-top: 1px solid #23272f;
  color: var(--fg-2);
}
td:first-child {
  white-space: nowrap;
  font-family: "JetBrains Mono";
  font-size: 11px;
  color: var(--fg);
}
td.r,
th.r {
  text-align: right;
}
tr:hover td,
tr:focus-visible td {
  background: #22262e;
  cursor: pointer;
}
tbody tr:focus-visible {
  outline-offset: -2px;
}
td.more {
  font-family: inherit;
  color: var(--fg-3);
  cursor: default;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: block;
}
.exp {
  border-top: 1px solid var(--line);
  padding-bottom: 14px;
}
.exp-b {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 16px;
}
.exp-b a,
.exp-b button {
  border: 1px solid var(--line);
  background: #20242c;
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
}
.exp-b a:hover,
.exp-b button:hover {
  border-color: #3a3f4a;
}
.exp-b a:not([href]),
.exp-b button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}
/* снимок готовится: кнопка неактивна, но подпись читается полностью */
.exp-b button[aria-busy="true"] {
  opacity: 0.8;
  cursor: progress;
}
.exp-b + h2 {
  padding-top: 12px;
}
.exp-b a span,
.exp-b button span {
  color: var(--fg-3);
  font-size: 11px;
  margin-left: auto;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
  .busy::after {
    left: 0;
    width: 100%;
  }
}
