:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #1d2733; --muted: #66717e; --line: #dde1e6;
  --accent: #1f6fb2; --accent-ink: #fff; --ok: #1a7f4b; --warn: #b26a00; --bad: #b42318;
  --soft: #eef3f8; --notice: #fff6e6; --notice-line: #f0c27a;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161c; --panel: #192029; --ink: #e4e9ef; --muted: #96a1ad; --line: #2c3540;
    --accent: #4d9be0; --soft: #212b36; --notice: #2c2416; --notice-line: #7a5a26; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.topbar { display: flex; gap: 12px; align-items: center; padding: 8px 14px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 650; font-size: 16px; white-space: nowrap; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12.5px; }
.search { position: relative; flex: 1; display: flex; gap: 6px; min-width: 240px; max-width: 620px; }
.search input { flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.results { position: absolute; top: 38px; left: 0; right: 0; z-index: 2000; list-style: none; margin: 0; padding: 4px 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15); max-height: 340px; overflow: auto; }
.results li { padding: 6px 10px; cursor: pointer; }
.results li:hover, .results li.sel { background: var(--soft); }
.results li .src { font-size: 11px; color: var(--muted); }
button, .btn { font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); padding: 7px 12px; text-decoration: none; display: inline-block; }
.btn.primary, .search button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 8px; font-size: 12.5px; }
button:disabled { opacity: .55; cursor: progress; }
.layout { display: flex; height: calc(100% - 52px); }
.panel { width: 420px; max-width: 46vw; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; }
.tabs { display: flex; position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 5; }
.tabs button { flex: 1; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 4px; background: none; font-size: 13px; }
.tabs button.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.tab { display: none; padding: 12px 16px 40px; }
.tab.active { display: block; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.notice { background: var(--notice); border: 1px solid var(--notice-line); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.radio { display: block; margin: 6px 0; }
.sub { margin: 4px 0 8px 22px; }
.row { display: flex; gap: 8px; align-items: end; margin: 4px 0; flex-wrap: wrap; }
.row input { width: 105px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--ink); }
#run { width: 100%; margin-top: 12px; padding: 10px; font-weight: 600; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { padding: 4px 0 4px 26px; position: relative; font-size: 13px; }
.steps li::before { position: absolute; left: 2px; top: 4px; width: 18px; text-align: center; }
.steps li.pending { color: var(--muted); } .steps li.pending::before { content: "○"; }
.steps li.running::before { content: "◌"; animation: spin 1s linear infinite; display: inline-block; color: var(--accent); }
.steps li.done::before { content: "✓"; color: var(--ok); }
.steps li.unavailable::before { content: "!"; color: var(--warn); font-weight: 700; }
.steps li.failed::before { content: "✕"; color: var(--bad); }
.steps .detail { display: block; color: var(--muted); font-size: 12px; }
.steps li.unavailable .detail { color: var(--warn); }
@keyframes spin { to { transform: rotate(360deg); } }
pre#log { font-size: 11px; max-height: 220px; overflow: auto; background: var(--bg); padding: 6px; border-radius: 4px; white-space: pre-wrap; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: var(--soft); text-transform: none; letter-spacing: 0; }
.badge.ok { background: #dff3e8; color: var(--ok); } .badge.warn { background: #fdf0d9; color: var(--warn); }
.badge.bad { background: #fde3e1; color: var(--bad); }
@media (prefers-color-scheme: dark) { .badge.ok { background: #173827; } .badge.warn { background: #3a2c12; } .badge.bad { background: #3d1916; } }
.jobs { list-style: none; padding: 0; margin: 0; }
.jobs li { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; cursor: pointer; font-size: 13px; }
.jobs li:hover { background: var(--soft); }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 6px; border: 1px solid rgba(0,0,0,.2); }
.layer { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.layer label { flex: 1; }
.layer input[type=range] { width: 80px; }
.layer-group { font-size: 11px; color: var(--muted); margin-top: 8px; text-transform: uppercase; }
.downloads { display: flex; gap: 6px; flex-wrap: wrap; }
.crit { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; }
.crit.off { opacity: .75; border-style: dashed; }
.crit .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.bar { height: 6px; background: var(--soft); border-radius: 3px; margin: 6px 0; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.crit p { margin: 4px 0; font-size: 12.5px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--soft); border-radius: 6px; padding: 8px 10px; }
.kpi b { display: block; font-size: 18px; }
.kpi span { font-size: 12px; color: var(--muted); }
.src { border-bottom: 1px solid var(--line); padding: 8px 0; }
.src .top { display: flex; justify-content: space-between; gap: 8px; }
.src p { margin: 3px 0; font-size: 12.5px; }
.mapwrap { flex: 1; position: relative; }
#map { position: absolute; inset: 0; background: #dfe3e8; }
.coords { position: absolute; bottom: 34px; left: 8px; z-index: 900; background: rgba(255,255,255,.92); color: #1d2733;
  font: 12px ui-monospace, Menlo, monospace; padding: 4px 8px; border-radius: 4px; pointer-events: none; }
.banner { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 1000; background: var(--notice);
  border: 1px solid var(--notice-line); padding: 6px 12px; border-radius: 6px; font-size: 13px; max-width: 80%; }
.legend { position: absolute; bottom: 30px; right: 10px; z-index: 900; background: var(--panel); border: 1px solid var(--line);
  padding: 8px 10px; border-radius: 6px; font-size: 12px; max-width: 240px; }
.legend .ramp { height: 10px; border-radius: 2px; margin: 4px 0; }
.legend .ends { display: flex; justify-content: space-between; color: var(--muted); }
.inspect-class { font-size: 15px; font-weight: 650; }
@media (max-width: 760px) {
  .layout { flex-direction: column-reverse; height: auto; }
  .panel { width: 100%; max-width: none; }
  .mapwrap { height: 60vh; flex: none; }
  .topbar .muted { display: none; }
}
.login { position: fixed; inset: 0; z-index: 5000; background: rgba(15, 25, 35, .55); display: grid; place-items: center; padding: 16px; }
.login-box { background: var(--panel); border-radius: 10px; padding: 22px; width: min(360px, 100%); display: grid; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-box h2 { margin: 0; }
.login-box label { display: grid; gap: 4px; font-size: 13px; }
.login-box input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.login[hidden], #user[hidden] { display: none; }

/* parcel tool and plain-language point reading */
textarea { width: 100%; font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; resize: vertical; box-sizing: border-box; background: var(--bg); color: var(--ink); }
#tab-parcel input[type=text] { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-top: 3px; background: var(--bg); color: var(--ink); }
.row-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.row-btns #pc-go { margin-left: auto; }
.pc-best { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.pc-best .head { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.pc-best .head a { font-weight: 500; }
.explain { margin-top: 8px; font-size: 12.5px; }
.explain ul { margin: 3px 0 6px; padding-left: 18px; }
.explain .plus li::marker { content: "+  "; color: #1d7a4c; font-weight: 700; }
.explain .minus li::marker { content: "−  "; color: #a32b20; font-weight: 700; }
.explain .warnl li::marker { content: "!  "; color: #b7791f; font-weight: 700; }
.explain h4 { margin: 6px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pc-num { background: #fff; border: 2px solid #111; border-radius: 50%; width: 22px; height: 22px; line-height: 18px; text-align: center; font: 700 12px system-ui, sans-serif; box-sizing: border-box; }
.pc-num.best { background: #f5c518; }
.pc-vertex { background: #1f6fb2; border: 2px solid #fff; border-radius: 50%; width: 12px; height: 12px; box-sizing: border-box; }
#admin-link[hidden] { display: none; }

.banner.announce { top: auto; bottom: 26px; max-width: min(640px, 90%); }


.pitch { position: relative; overflow: hidden; color: #fff; border-radius: 12px; padding: 16px 16px 14px; margin-bottom: 14px; line-height: 1.5;
  background: linear-gradient(135deg, #0b6fb8 0%, #0e9aa7 55%, #2fb36b 100%); box-shadow: 0 6px 18px rgba(14, 120, 140, .28); }
.pitch::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.25), rgba(255,255,255,0) 70%); }
.pitch b { color: #fff; }
.pitch > b:first-child { display: block; font-size: 1.12em; margin-bottom: 6px; letter-spacing: .2px; }
