@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b0e14;
  --bg-2: #0d131f;
  --panel: #121821;
  --panel-2: #1a2436;
  --line: #1e2838;
  --text: #e4eaf1;
  --muted: #8a9bb3;
  --blue: #3b82f6;
  --blue-2: #93c5fd;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --purple: #a78bfa;
  --cyan: #22d3ee;
  --lime: var(--blue-2);
  --lime-2: #152033;
  --teal: var(--cyan);
  --shadow: 0 16px 40px rgba(0, 0, 0, .45);
  --radius: 10px;
  --radius-sm: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, .mono { font-family: "SF Mono", "Cascadia Code", Consolas, ui-monospace, monospace; }
h3 { margin: 10px 0 6px; font-size: 13px; font-weight: 650; }
::selection { background: rgba(59, 130, 246, .28); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(138, 155, 179, .28); border-radius: 4px; }

.app { min-height: 100vh; }
.mast {
  display: flex; align-items: center; gap: 14px;
  max-width: 1440px; margin: 0 auto;
  padding: 12px 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand strong {
  font-size: 18px; font-weight: 700; letter-spacing: -.03em;
  background: linear-gradient(135deg, #f0f4fa, #94a3b8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ver {
  font-size: 10px; color: var(--muted);
  background: rgba(12, 18, 28, .6); border: 1px solid rgba(26, 35, 50, .8);
  border-radius: 4px; padding: 1px 6px;
}
.mark {
  width: 14px; height: 14px; flex: none; border-radius: 4px;
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
.top-meta { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; flex: none; }
.who button {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 4px 8px; font-size: 11px; font-weight: 600;
}
.who button:hover { color: var(--text); border-color: var(--blue); }
.pill {
  border: 1px solid var(--line); background: var(--bg-2);
  border-radius: 999px; padding: 3px 8px; font-size: 11px; color: var(--muted);
}
.pill b { color: var(--text); font-weight: 650; }

.tabs {
  display: flex; align-items: stretch; gap: 0;
  max-width: 1440px; margin: 0 auto;
  padding: 0 12px;
  overflow-x: auto; overflow-y: hidden;
  border-bottom: 1px solid #1a2332;
  position: sticky; top: 0; z-index: 12;
  background: rgba(11, 14, 20, .92);
  backdrop-filter: blur(10px);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-pin, .tabs-rest { display: flex; flex: 0 0 auto; align-items: center; }
.tab-sep { width: 1px; height: 18px; margin: 8px 6px; background: var(--line); flex: none; }
.tabs button {
  flex: 0 0 auto;
  border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted);
  padding: 8px 12px; font-size: 11px; font-weight: 500;
  letter-spacing: .02em; white-space: nowrap;
}
.tabs-pin button { color: var(--text); }
.tabs button:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.tabs button.on { color: var(--text); border-bottom-color: var(--blue); background: rgba(59, 130, 246, .08); }

main { max-width: 1440px; margin: 0 auto; padding: 12px 16px 28px; min-width: 0; }
.page-head { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 10px; }
.page-head h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.kicker { margin: 0; color: var(--blue-2); font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }

.grid { display: grid; gap: 10px; }
.stats { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.stats .value { font-size: 18px; }
.maps-grid { grid-template-columns: 1fr 1fr; }
.card, .ov-kpi {
  background: linear-gradient(145deg, var(--panel), #151e2c);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.card .label, .ov-head .label { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.card .value { margin-top: 2px; font-size: 22px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.card .sub { margin-top: 4px; color: var(--muted); font-size: 11px; }
.split { display: grid; grid-template-columns: 1.4fr .8fr; gap: 10px; }
.note { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 0 0 8px; }
.note strong { color: var(--text); font-weight: 650; }

.ov-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ov-kpi { position: relative; overflow: hidden; padding-left: 16px; }
.ov-kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent, var(--blue));
}
.ov-kpis .card:nth-child(1) { --accent: var(--green); }
.ov-kpis .card:nth-child(2) { --accent: #60a5fa; }
.ov-kpis .card:nth-child(3) { --accent: var(--purple); }
.ov-kpis .card:nth-child(4) { --accent: var(--cyan); }
.ov-kpi .value { color: var(--accent, var(--text)); }
.ov-layout { display: grid; grid-template-columns: 1.7fr .9fr; gap: 10px; margin-top: 10px; }
.ov-cols { display: grid; grid-template-columns: 1.1fr .9fr .9fr; gap: 10px; margin-top: 10px; }
.ov-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: Inter, system-ui, sans-serif; font-size: 10px; fill: var(--muted); }
.meter { display: flex; height: 4px; border-radius: 99px; overflow: hidden; background: #1a2332; }
.meter i { display: block; height: 100%; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.legend b { color: var(--text); font-weight: 650; }
.hbar { display: grid; grid-template-columns: 88px 1fr 42px; gap: 6px; align-items: center; margin: 4px 0; font-size: 11px; }
.hbar span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar div { height: 4px; background: #1a2332; border-radius: 99px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.hbar b { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.feed-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; }
.feed-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.feed-row .dot { width: 8px; height: 8px; border-radius: 99px; background: var(--green); }
.feed-row .dot.bad { background: var(--red); }
.feed-row em { font-style: normal; color: var(--muted); font-family: "SF Mono", Consolas, monospace; font-size: 11px; }

.toolbar {
  display: flex; gap: 8px; align-items: end; flex-wrap: wrap;
  margin-bottom: 10px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
input, select, textarea {
  background: var(--bg-2); border: 1px solid #1a2740; border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 12px; outline: 0; width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: #2f405a; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, .2); }
textarea { min-height: 64px; }
textarea.geo { min-height: 140px; font-family: "SF Mono", Consolas, monospace; font-size: 11px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--line); margin-right: 4px; vertical-align: -1px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 10px; font-weight: 650; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.field.wide, .fields .switch { grid-column: 1 / -1; }
.desk { display: flex; flex-direction: column; gap: 10px; }
.desk-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.desk-head > div { display: flex; align-items: center; gap: 8px; }
.desk-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.desk .table-wrap { max-height: 280px; }
.desk .actions { display: flex; gap: 8px; margin-top: 10px; }
.toolbar input, .toolbar select { width: auto; min-width: min(220px, 70vw); }
button.primary, button.ghost, button.danger {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); padding: 6px 12px; border: 0;
  font-size: 11px; font-weight: 650; line-height: 1.3;
}
button.primary { background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .25); }
button.primary:hover { background: linear-gradient(135deg, #2563eb, #3b82f6); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { color: var(--text); border-color: var(--blue); background: rgba(59, 130, 246, .06); }
button.danger { background: transparent; color: var(--red); border: 1px solid rgba(248, 113, 113, .25); }
button.danger:hover { background: rgba(248, 113, 113, .08); }
button:disabled { opacity: .4; cursor: default; }

table { width: 100%; border-collapse: collapse; font-size: 11px; }
th {
  text-align: left; padding: 4px 8px; color: var(--muted); font-weight: 650;
  font-size: 9px; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 2px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
td { padding: 3px 8px; border-bottom: 1px solid rgba(26, 35, 50, .7); vertical-align: middle; }
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }
tr:hover td { background: rgba(59, 130, 246, .06); }
.table-wrap {
  overflow: auto; max-height: calc(100vh - 168px);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}

.spark { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.spark i { display: block; width: 5px; background: var(--cyan); border-radius: 2px 2px 0 0; opacity: .85; }
.switch { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.switch p { margin: 2px 0 0; }
.switch input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue); margin-top: 2px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: flex; gap: 3px; align-items: center; color: var(--text); font-size: 11px; letter-spacing: 0; text-transform: none; font-weight: 500; }

.drawer {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .65);
  display: flex; justify-content: flex-end; z-index: 20;
  backdrop-filter: blur(6px);
}
.drawer[hidden] { display: none; }
.sheet {
  width: min(460px, 100%); height: 100%; overflow: auto;
  background: var(--panel); border-left: 1px solid var(--line); padding: 18px 18px;
  box-shadow: var(--shadow);
}
.sheet h2 { margin: 0 0 4px; font-size: 15px; font-weight: 650; }
.sheet .actions { display: flex; gap: 8px; margin-top: 14px; }
.toast {
  position: fixed; right: 18px; bottom: 18px;
  background: var(--panel-2); color: var(--text); border: 1px solid #2e405a;
  padding: 10px 14px; border-radius: var(--radius); z-index: 30; font-size: 12px; font-weight: 500;
  box-shadow: var(--shadow);
}
.toast.bad { background: #3a1814; color: #ffb1a6; border-color: #7a3328; }
.gate {
  position: fixed; inset: 0; display: none; place-items: center;
  background: rgba(0, 0, 0, .65); z-index: 40; backdrop-filter: blur(8px);
}
.gate.show { display: grid; }
.gate-card {
  width: min(400px, calc(100% - 28px)); background: var(--panel);
  border: 1px solid rgba(30, 40, 56, .8); border-radius: 16px; padding: 22px;
  box-shadow: var(--shadow);
}
.gate-card h2 { margin: 10px 0 4px; font-size: 16px; }
.gate-card p { color: var(--muted); font-size: 13px; }
.gate-card label { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 10px; font-weight: 650; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.gate-card .primary { width: 100%; margin-top: 6px; }
.err { color: var(--red); min-height: 1.2em; text-transform: none; letter-spacing: 0; font-weight: 500; }
.empty { color: var(--muted); padding: 28px 16px; text-align: center; }

@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ov-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .split, .fields, .maps-grid, .ov-layout, .ov-cols { grid-template-columns: 1fr; }
  .stats, .ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mast { flex-wrap: wrap; }
  .top-meta { margin-left: 0; }
  .who { margin-left: auto; }
  .table-wrap { max-height: none; }
  .sheet { width: 100%; }
}
@media (max-width: 420px) {
  .stats, .ov-kpis { grid-template-columns: 1fr; }
}
.toolbar.ac-filters { align-items: end; }
.toolbar.ac-filters .field { min-width: 0; }
.toolbar.ac-filters .field.grow { flex: 1 1 220px; }
.toolbar.ac-filters .field.grow input { width: 100%; min-width: 180px; }
.toolbar.ac-filters select { min-width: 92px; }
.ac-count { display: flex; gap: 8px; align-items: center; margin: -2px 0 10px; color: var(--muted); font-size: 11px; }
.ac-count span { margin-right: auto; font-variant-numeric: tabular-nums; }
.ac-page .table-wrap { max-height: calc(100vh - 248px); }
.air-map-wrap {
  position: relative; height: 440px; margin: 0 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: #0b0e14;
}
.air-map-wrap #airMap { height: 100%; width: 100%; background: #0b0e14; }
.air-map-wrap .leaflet-container { font: inherit; background: #0b0e14; }
.air-map-wrap .leaflet-control-attribution {
  background: rgba(11, 14, 20, .82); color: var(--muted); font-size: 10px;
}
.air-map-wrap .leaflet-control-attribution a { color: var(--blue-2); }
.air-map-wrap .leaflet-bar a {
  background: var(--panel); color: var(--text); border-color: var(--line);
}
.air-pick {
  position: absolute; z-index: 800; left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: min(440px, calc(100% - 20px));
  background: rgba(18, 24, 33, .94); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 8px;
  box-shadow: var(--shadow);
}
.air-pick[hidden] { display: none; }
.air-pick strong { font-size: 12px; }
.air-pick span { color: var(--muted); font-size: 11px; }
.air-map-wrap ~ .table-wrap { max-height: 280px; }
@media (max-width: 700px) {
  .air-map-wrap { height: 300px; }
}

.rt-tag { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1px solid rgba(138,155,179,.35); color: var(--muted); }
.rt-tag.ok { color: var(--green); border-color: rgba(74,222,128,.45); background: rgba(74,222,128,.08); }
.rt-tag.bad { color: var(--red); border-color: rgba(248,113,113,.45); background: rgba(248,113,113,.08); }
.rt-tag.warn { color: var(--amber); border-color: rgba(251,191,36,.45); }

.rt-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rt-edit input { width: 92px; text-transform: uppercase; }
.rt-edit input[name=v] { width: 120px; }
.rt-err { color: var(--red); font-size: 11px; }

.rt-edit-wide { padding: 10px; margin: 8px 0; border: 1px solid rgba(138,155,179,.25); border-radius: 10px; }
.rt-edit-wide strong { width: 100%; font-size: 12px; }
.rt-day { display: inline-flex; gap: 3px; align-items: center; font-size: 11px; color: var(--muted); margin-right: 4px; }
.rt-day input[type=date] { width: 140px; }
.rt-msg { font-size: 12px; margin: 0 0 8px; }
.rt-msg.ok { color: var(--green); } .rt-msg.bad { color: var(--red); }
