:root { --bg: rgba(18, 22, 28, 0.9); --line: rgba(255, 255, 255, 0.12); --fg: #e8eaed; --mut: #9aa3ad; --acc: #f2b632; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--fg); background: #10141a; }
#map { position: absolute; inset: 0; }
button, select, input { font: inherit; color: inherit; }

#topbar { position: absolute; top: 10px; left: 10px; display: flex; gap: 10px; align-items: flex-start; z-index: 3; }
#brand { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; white-space: nowrap; }
#brand b { font-size: 14px; letter-spacing: 0.02em; }
#brand span { color: var(--mut); margin-left: 8px; }
#searchbox { position: relative; width: 320px; }
#q { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; outline: none; }
#q:focus { border-color: var(--acc); }
#results { position: absolute; top: 38px; left: 0; right: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; max-height: 60vh; overflow: auto; }
#results .grp { color: var(--mut); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 12px 2px; }
#results .r { padding: 5px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#results .r:hover, #results .r.on { background: rgba(255, 255, 255, 0.08); }
#results .r small { color: var(--mut); margin-left: 6px; }
#results .none { padding: 8px 12px; color: var(--mut); }

#controls { position: absolute; top: 58px; left: 10px; width: 250px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; z-index: 2; }
.ctl-row { display: flex; align-items: center; gap: 8px; }
.ctl-row label { color: var(--mut); }
#mode { flex: 1; background: #1c222b; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
#legend { margin: 8px 0; }
#legend .li { display: flex; align-items: center; gap: 7px; padding: 1.5px 0; cursor: default; }
#legend .li.tog { cursor: pointer; }
#legend .li.off { opacity: 0.35; }
#legend .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1px solid rgba(0, 0, 0, 0.5); }
#legend .ct { margin-left: auto; color: var(--mut); font-variant-numeric: tabular-nums; }
#legend .note { color: var(--mut); font-size: 11px; margin-top: 4px; }
.toggles { gap: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.toggles label { color: var(--fg); display: flex; align-items: center; gap: 4px; cursor: pointer; }
#focus { margin-top: 8px; background: rgba(242, 182, 50, 0.15); border: 1px solid rgba(242, 182, 50, 0.5); border-radius: 6px; padding: 5px 8px; }
#focus button { float: right; background: none; border: 0; cursor: pointer; color: var(--fg); }
#hint { color: var(--mut); font-size: 11px; margin-top: 8px; }

#panel { position: absolute; top: 10px; right: 10px; bottom: 46px; width: 370px; max-width: calc(100vw - 20px); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; z-index: 4; overflow: auto; padding: 14px 16px; }
#panel-close, #about-close { position: absolute; top: 6px; right: 8px; background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--mut); }
#panel h2 { margin: 0 24px 2px 0; font-size: 16px; }
#panel .sub { color: var(--mut); margin-bottom: 10px; }
#panel table { width: 100%; border-collapse: collapse; }
#panel td { padding: 3px 0; vertical-align: top; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
#panel td:first-child { color: var(--mut); width: 42%; padding-right: 8px; }
#panel a { color: #8ab4f8; cursor: pointer; text-decoration: none; }
#panel a:hover { text-decoration: underline; }
.tag { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.tag.est { background: rgba(242, 182, 50, 0.2); color: var(--acc); border: 1px solid rgba(242, 182, 50, 0.5); }
.tag.rep { background: rgba(61, 220, 132, 0.15); color: #3ddc84; border: 1px solid rgba(61, 220, 132, 0.4); }
.rates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.rates .box { background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 8px 10px; }
.rates .big { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rates .lbl { color: var(--mut); font-size: 11px; }
.chart-wrap { margin-top: 10px; position: relative; }
.chart-wrap h3 { font-size: 12px; margin: 0 0 4px; font-weight: 600; }
.chart-wrap canvas { width: 100%; height: 190px; display: block; }
.chart-key { display: flex; gap: 12px; color: var(--mut); font-size: 11px; margin-top: 2px; }
.chart-key i { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 4px; }
#tip { position: absolute; pointer-events: none; background: #000c; border-radius: 4px; padding: 2px 6px; font-size: 11px; white-space: nowrap; }
.wl { margin-top: 10px; }
.wl h3 { font-size: 12px; margin: 0 0 4px; }
.wl .w { display: flex; gap: 6px; padding: 2px 0; cursor: pointer; }
.wl .w:hover { background: rgba(255, 255, 255, 0.06); }
.wl .w .sw { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex: none; }
.wl .w .rt { margin-left: auto; color: var(--mut); font-variant-numeric: tabular-nums; }
.fine { color: var(--mut); font-size: 11px; margin-top: 10px; }

#disclaimer { position: absolute; left: 10px; right: 10px; bottom: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; z-index: 3; display: flex; gap: 8px; align-items: center; font-size: 12px; }
#disclaimer #dt { font-weight: 600; color: var(--acc); white-space: nowrap; }
#disclaimer .sep { color: var(--mut); }
#disclaimer button { margin-left: auto; background: #1c222b; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; cursor: pointer; white-space: nowrap; }
#about { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 10; display: flex; align-items: center; justify-content: center; }
#about[hidden], #panel[hidden], #results[hidden], #focus[hidden] { display: none; }
#about-card { position: relative; width: 600px; max-width: calc(100vw - 30px); max-height: calc(100vh - 40px); overflow: auto; background: #141a21; border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; }
#about-card h2 { margin: 0 0 8px; font-size: 17px; }
#about-card p { margin: 8px 0; }
#loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; z-index: 5; }
.maplibregl-ctrl-bottom-right { bottom: 40px; }
.maplibregl-ctrl-bottom-left { bottom: 40px; }
@media (max-width: 760px) {
  #brand span, #hint { display: none; }
  #searchbox { width: 210px; }
  #controls { width: 210px; }
  #panel { top: auto; height: 55vh; left: 10px; width: auto; }
  #disclaimer { flex-wrap: wrap; }
}
