:root {
  --page:#f9f9f7; --surface:#fcfcfb; --raised:#ffffff; --ink:#0b0b0b; --ink-2:#52514e; --muted:#898781;
  --line:#e1e0d9; --accent:#2a78d6; --hover:#f0efec;
  --shadow:0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.08);
  /* Sequential blue, light -> dark (dataviz reference ramp, steps 100/250/400/550/700) */
  --q0:#cde2fb; --q1:#86b6ef; --q2:#3987e5; --q3:#1c5cab; --q4:#0d366b;
  --seen:#c3c2b7;
  color-scheme: light;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html, body { height:100%; margin:0; background:var(--page); color:var(--ink);
  font:14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
#map { position:absolute; inset:0; }
.card { background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); }
button, input { font:inherit; color:inherit; }
a { color:var(--accent); }

#panel { position:absolute; left:12px; top:12px; bottom:12px; width:368px; z-index:4; display:flex;
  flex-direction:column; overflow:hidden; }
#panel .scroll { flex:1 1 auto; min-height:0; overflow-y:auto; scrollbar-gutter:stable; padding:16px 18px 18px; }
.brand { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
.brand img { display:block; height:15px; width:auto; }
.brandlink { font-size:12.5px; text-decoration:none; white-space:nowrap; }
.brandlink:hover { text-decoration:underline; }
.eyebrow { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }
h1 { font-size:20px; line-height:1.2; margin:2px 0 6px; font-weight:680; letter-spacing:-.015em; }
h2 { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:600; margin:18px 0 8px; }
.fine { font-size:12px; color:var(--muted); margin:8px 0 0; }

.seg { display:flex; flex-wrap:wrap; gap:2px; background:var(--hover); border-radius:8px; padding:2px; }
.seg button { flex:1 1 auto; border:0; background:none; padding:5px 8px; border-radius:6px; cursor:pointer; font-size:12.5px;
  color:var(--ink-2); white-space:nowrap; }
.seg button[aria-pressed="true"] { background:var(--raised); color:var(--ink); font-weight:600; box-shadow:0 1px 2px rgba(0,0,0,.08); }
.seg button:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }

.tiles { display:grid; gap:8px; margin-top:14px; }
.tile { border:1px solid var(--line); border-radius:10px; padding:10px 12px 11px; background:var(--raised); }
.tile > small { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:600; margin-bottom:2px; }
.tile > b { display:block; font-size:26px; font-weight:680; letter-spacing:-.02em; font-variant-numeric:tabular-nums; line-height:1.15; }
.tile > span { display:block; font-size:12.5px; color:var(--ink-2); line-height:1.4; margin-top:3px; }
.tile > b em { font-style:normal; font-size:14px; font-weight:500; color:var(--ink-2); letter-spacing:0; }

.info { border:0; background:none; padding:0 2px; margin:0; cursor:help; color:var(--muted); font-size:12px; line-height:1;
  vertical-align:baseline; text-transform:none; letter-spacing:0; font-weight:400; }
.info:hover, .info:focus-visible { color:var(--accent); }
h1 .info { font-size:13px; }

h1 { font-variant-numeric:tabular-nums; }
.sub { margin:0; font-size:13px; color:var(--ink-2); }
.stage { display:flex; align-items:center; gap:8px; margin-top:12px; font-size:12.5px; color:var(--ink-2); }
.stage > span { white-space:nowrap; }
.stage .seg { flex:1; }
.cta { display:block; margin-top:16px; padding:8px 12px; border-radius:8px; background:var(--ink); color:#fff;
  text-align:center; text-decoration:none; font-weight:600; font-size:13px; }
.cta:hover { background:#2b2b2a; }
.region { display:flex; align-items:baseline; gap:10px; margin-top:12px; }
.region .fine { margin:0; }
#area { border:0; background:transparent; padding:0 16px 0 0; font-size:15px; font-weight:650; cursor:pointer; appearance:none;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2352514e' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 2px center; }
#area:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:4px; }
.link { border:0; background:none; padding:0; color:var(--accent); cursor:pointer; font-size:12.5px; white-space:nowrap; }
.funnel { margin-top:14px; }
.frow { display:grid; grid-template-columns:1fr auto; gap:3px 8px; font-size:12.5px; }
.frow .bar { grid-column:1 / -1; height:8px; border-radius:4px; background:var(--hover); overflow:hidden; display:flex; gap:2px; }
.frow .bar i { display:block; height:100%; border-radius:4px; }
.frow b { font-variant-numeric:tabular-nums; font-weight:600; }
.keys { display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:5px; font-size:12px; color:var(--ink-2); }
.keys b { color:var(--ink); font-variant-numeric:tabular-nums; font-weight:600; }
.key { display:inline-block; width:8px; height:8px; border-radius:2px; margin-right:5px; vertical-align:baseline; }

.bank { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:12.5px; color:var(--ink-2); margin-top:16px; }
.bank input { width:72px; padding:4px 6px; border:1px solid var(--line); border-radius:6px; background:var(--raised); text-align:right; font-variant-numeric:tabular-nums; }
.bankOut { margin:5px 0 0; font-size:12.5px; color:var(--ink-2); }
.bankOut b { font-variant-numeric:tabular-nums; color:var(--ink); }

/* The map legend, on the map */
#legend { position:absolute; right:12px; bottom:32px; z-index:3; width:240px; padding:8px 10px 9px; font-size:12px; color:var(--ink-2); }
#legend .seg { margin-bottom:8px; }
#legend .ltitle { font-size:11.5px; }
#legend .ramp { display:flex; gap:2px; margin-top:4px; }
#legend .ramp i { flex:1; height:10px; border-radius:2px; }
/* One label per swatch, at its lower bound */
#legend .ticks { display:grid; grid-template-columns:repeat(5, 1fr); gap:2px; margin-top:2px; font-variant-numeric:tabular-nums; color:var(--muted); font-size:11px; }

details { margin-top:18px; border-top:1px solid var(--line); padding-top:10px; }
summary { cursor:pointer; font-weight:600; font-size:13px; }
details p { font-size:12.5px; color:var(--ink-2); }
table { width:100%; border-collapse:collapse; font-size:12px; }
th { text-align:left; color:var(--muted); font-weight:600; border-bottom:1px solid var(--line); padding:4px 4px 4px 0; }
td { vertical-align:top; border-bottom:1px solid var(--line); padding:5px 4px 5px 0; color:var(--ink-2); }
td:first-child { color:var(--ink); font-weight:550; }
.tag { display:inline-block; font-size:10.5px; padding:1px 5px; border-radius:4px; background:var(--hover); color:var(--ink-2); white-space:nowrap; }

#tip { position:fixed; z-index:6; pointer-events:none; padding:8px 10px; font-size:12px; max-width:240px; }
#tip b { font-variant-numeric:tabular-nums; }

body.loading #map { opacity:.4; }

@media (max-width:820px) {
  #panel { left:0; right:0; top:auto; bottom:0; width:auto; max-height:58vh; border-radius:12px 12px 0 0; }
  #panel .scroll { padding:14px 16px 16px; }
  #legend { top:12px; bottom:auto; right:56px; width:210px; }
}
