:root {
  --bg: #0f1420; --panel: #171e2e; --panel-2: #1f2840; --text: #e6eaf3; --muted: #8e98b3;
  --accent: #4fd1c5; --served: #f25f5c; --history: #9aa7c7; --border: #2a3450;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans CJK SC", sans-serif; }
body { display: flex; flex-direction: column; min-height: 100vh; }
header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--border); }
header h1 { font-size: 17px; margin: 0; font-weight: 600; }
.header-right { display: flex; gap: 8px; }
.badge { padding: 2px 8px; border-radius: 10px; background: var(--accent); color: #062; font-size: 12px; font-weight: 600; }
.badge.muted { background: var(--panel-2); color: var(--muted); }
.badge.warn { background: #f2994a; color: #311; }
.badge.ok { background: #6fcf97; color: #042; }
main { flex: 1; display: grid; grid-template-columns: 1fr 380px; min-height: 0; }
#map-panel { position: relative; min-height: 420px; }
#map { position: absolute; inset: 0; }
.legend { position: absolute; left: 10px; bottom: 10px; z-index: 500; background: rgba(23,30,46,.92);
  padding: 8px 10px; border-radius: 6px; font-size: 12px; border: 1px solid var(--border); }
.legend .sw { display: inline-block; width: 22px; height: 4px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
#side-panel { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.card h2 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
label { display: flex; align-items: center; gap: 8px; margin: 6px 0; white-space: nowrap; }
select, button { font: inherit; background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; }
select { flex: 1; min-width: 0; max-width: 100%; }
button { cursor: pointer; background: var(--accent); color: #062; font-weight: 600; }
button:disabled { opacity: .6; cursor: wait; }
.row { display: flex; align-items: flex-start; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.row button { white-space: nowrap; flex-shrink: 0; }
#run-status { word-break: break-word; min-width: 0; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--served); }
dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; }
dt { color: var(--muted); } dd { margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
th, td { text-align: right; padding: 3px 4px; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
tr.served td { color: var(--served); font-weight: 600; }
tr.best td { text-decoration: underline; }
#agents-body { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.agent { border-left: 3px solid var(--accent); background: var(--panel-2); padding: 8px 10px; border-radius: 0 6px 6px 0; }
.agent.baseline { border-left-color: #f2994a; }
.agent.skipped { opacity: .55; border-left-style: dashed; }
.legend .sw.dashed { background: none; height: 0; border-top: 3px dashed; }
.agent .hd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.agent .name { font-weight: 600; }
.agent .kind { font-size: 11px; color: var(--muted); }
.agent .t { font-size: 12px; color: var(--muted); white-space: nowrap; }
.agent .io { margin-top: 4px; font-size: 12.5px; }
.agent .io b { color: var(--muted); font-weight: 500; }
.agent pre { white-space: pre-wrap; margin: 2px 0 0; font-size: 12px; max-height: 180px; overflow: auto;
  background: var(--panel); padding: 6px; border-radius: 4px; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
footer { display: flex; justify-content: space-between; padding: 6px 16px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border); background: var(--panel); }
footer a { color: var(--accent); }
.prov { font-size: 12.5px; }
.prov .kind { font-weight: 600; }
.prov.synthetic .kind { color: #f2994a; }
.prov.model .kind { color: #6fcf97; }
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: 55vh auto; }
  #side-panel { overflow: visible; }
}
button.secondary { background: var(--panel-2); color: var(--text); font-weight: 500; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.tabs button { background: var(--panel-2); color: var(--text); font-weight: 500; padding: 4px 10px; }
.tabs button.active { background: var(--accent); color: #062; font-weight: 600; }
#vessel-search { flex: 1; min-width: 0; font: inherit; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
#vessel-list { list-style: none; margin: 6px 0; padding: 0; max-height: 190px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 6px; }
#vessel-list li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; cursor: pointer; font-size: 12.5px;
  border-bottom: 1px solid var(--border); }
#vessel-list li:last-child { border-bottom: none; }
#vessel-list li:hover { background: var(--panel-2); }
#vessel-list li.selected { background: #24324f; outline: 1px solid var(--accent); }
#vessel-list .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
#vessel-list .mmsi { font-variant-numeric: tabular-nums; }
#vessel-list .grp { color: var(--muted); flex: 1; }
#vessel-list .n { color: var(--muted); font-variant-numeric: tabular-nums; }
#vessel-title { font-weight: 600; margin-top: 4px; }
.slider-row { align-items: center; }
#win-slider { flex: 1; accent-color: var(--accent); }
.ship-icon { background: none; border: none; }
.ship-icon svg { overflow: visible; filter: drop-shadow(0 0 1px rgba(0,0,0,.8)); }
.legend .types { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.legend .types span.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
header label.lang { margin: 0; gap: 6px; color: var(--muted); font-size: 12.5px; }
header label.lang select { flex: 0 0 auto; padding: 3px 6px; font-size: 12.5px; }
.header-right { align-items: center; flex-wrap: wrap; }
@media (max-width: 700px) { header { flex-direction: column; align-items: flex-start; gap: 6px; } header h1 { font-size: 15px; } }
.view-tabs { margin: 0; }
.view-tabs button { flex: 1; padding: 8px 10px; font-size: 13.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid2 label { margin: 4px 0; }
label.chk { gap: 6px; font-size: 12.5px; white-space: normal; }
.clock { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 8px; letter-spacing: .02em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.stat { background: var(--panel-2); border-radius: 6px; padding: 6px 8px; }
.stat .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--muted); line-height: 1.25; }
.stat.wide { grid-column: span 3; }
.stat .bars div { display: flex; justify-content: space-between; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.stat .bars div.sys { color: var(--served); font-weight: 600; }
h3.sub { font-size: 12px; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
#s-feed { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow-y: auto; font-size: 12px;
  border: 1px solid var(--border); border-radius: 6px; }
#s-feed li { padding: 3px 8px; border-bottom: 1px solid var(--border); cursor: pointer; }
#s-feed li:hover { background: var(--panel-2); }
#s-feed li .tm { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
#s-feed li.truth { color: #cfd6e6; }
#s-feed li .crit { color: #f2c94c; }
#s-feed li .land { color: #f2994a; }
.stream-label { background: rgba(23,30,46,.9); color: var(--text); border: 1px solid var(--border); font-size: 11px; padding: 1px 4px; }
.caveat { border-left: 3px solid #f2c94c; padding-left: 8px; }
.attribution { font-size: 11px; margin-top: 6px; }
