:root {
  --bg: #0a1628; --panel: #0f2138; --panel2: #142c49; --ink: #e8f1fb;
  --muted: #8fb0cf; --accent: #00d4ff; --sarg: #ffb02e; --beached: #ff4d4d;
  --line: #1d3a5c; --ok: #6fd3a0;
  --S3: #c3a6ff; --S2: #6fd0ff; --L8: #ffcf6f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; font-size: 14px; }
button { font: inherit; color: var(--ink); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 9px; cursor: pointer; }
button:hover { border-color: var(--accent); }
a { color: var(--accent); }

#topbar { height: 52px; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: linear-gradient(90deg, #0c1c30, #0a1628); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.subtitle { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lang-switch { display: flex; gap: 4px; align-items: center; color: var(--muted); }
#lang-switch button.on { border-color: var(--accent); color: var(--accent); }

#layout { display: flex; height: calc(100% - 52px); }
#sidebar { width: 380px; overflow-y: auto; padding: 10px; border-right: 1px solid var(--line); }
#map { flex: 1; background: #071120; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px; }
.panel h2 { font-size: 14px; margin: 0 0 8px; color: var(--accent); font-weight: 600; }
.panel h3 { font-size: 13px; margin: 12px 0 6px; color: var(--muted); font-weight: 600; }
.panel.small { font-size: 12px; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

.daynav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
#day-label { flex: 1; text-align: center; font-weight: 600; font-size: 15px; }
.timeline { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.tday { flex: 0 0 auto; width: 30px; padding: 3px 0; border-radius: 6px; text-align: center;
  cursor: pointer; border: 1px solid transparent; font-size: 10px; color: var(--muted); }
.tday:hover { border-color: var(--line); }
.tday.on { border-color: var(--accent); color: var(--ink); background: var(--panel2); }
.tday.m1 { border-left: 1px solid var(--muted); border-radius: 0 6px 6px 0; }
.tday .mon { display: block; height: 12px; color: var(--accent); font-size: 9px; white-space: nowrap; }
.tday .dots { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 3px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2a3f58; }
.dot.sarg { background: var(--sarg); } .dot.clear { background: #4c7a99; }
.dot.fail { background: var(--beached); } .dot.wait { background: #888; outline: 1px dashed #ccc; }
.legend-dots { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--muted); }

.card { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent));
  border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--panel2); }
.card .head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card .name { font-weight: 600; }
.card .badge { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: #23405f; color: var(--muted); }
.card .badge.sarg { background: #5a3c0c; color: #ffd27a; }
.card .badge.fail { background: #5a1d1d; color: #ffb3b3; }
.card .rows { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin-top: 6px; font-size: 12px; }
.card .rows span:nth-child(odd) { color: var(--muted); }
.layers { width: 100%; border-collapse: collapse; font-size: 12px; }
.layers th { color: var(--muted); font-weight: 500; text-align: center; padding: 0 4px 4px; }
.layers th:first-child, .layers td:first-child { text-align: left; }
.layers td { padding: 3px 4px; text-align: center; border-top: 1px solid var(--line); }
.layers td.off { color: var(--muted); opacity: .6; }
.layers input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; margin: 0; }
.layers .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.layers tr.all td { color: var(--muted); }

.lead { display: flex; align-items: center; gap: 8px; }
.lead input { flex: 1; accent-color: var(--accent); }
#lead-label { width: 96px; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }

.files { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.files a { text-decoration: none; }
.files a i { margin-right: 4px; }
.files .sz { color: var(--muted); }

.maplegend { background: rgba(10, 22, 40, .88); color: var(--ink); padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
.maplegend .ramp { width: 160px; height: 10px; border-radius: 3px; margin: 3px 0;
  background: linear-gradient(90deg, rgb(255,236,120), rgb(255,170,40) 40%, rgb(240,80,30) 75%, rgb(170,20,40)); }
.maplegend .ticks { display: flex; justify-content: space-between; width: 160px; color: var(--muted); }
.leaflet-container { background: #071120; }

@media (max-width: 800px) {
  #layout { flex-direction: column-reverse; }
  #sidebar { width: 100%; height: 50%; border-right: 0; border-top: 1px solid var(--line); }
  #map { height: 50%; flex: none; }
  .subtitle { display: none; }
  #topbar { gap: 8px; }
  .brand { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
}
