:root {
  --navy: #0d2038;
  --navy-2: #16324f;
  --navy-3: #24466a;
  --gold: #b1872f;
  --gold-2: #d9b768;
  --gold-soft: #f6edd7;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #101c2e;
  --ink-2: #3d4d63;
  --muted: #74839a;
  --line: #e2e7ee;
  --line-2: #edf0f5;
  --good: #0d7357;
  --good-bg: #e6f4ee;
  --warn: #8f6200;
  --warn-bg: #fcf2da;
  --bad: #ab2a20;
  --bad-bg: #fbeae7;
  --info: #175d8c;
  --info-bg: #e8f1f8;
  --pink-1: #fdeaf3;
  --pink-2: #f8bdd7;
  --pink-3: #e56aa4;
  --pink-4: #c23b7d;
  --pink-5: #8e1450;
  --rose-ink: #6d0f3c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 28, 46, .05), 0 18px 40px -30px rgba(16, 28, 46, .35);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --display: Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
button { font-family: inherit; }
select, input { font-family: inherit; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

/* ---------- utility buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: #c9d2df; color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.gold:hover { background: #9a7425; border-color: #9a7425; }
.btn.small { padding: 5px 10px; font-size: 11.5px; }
.btn.danger { color: var(--bad); border-color: #eccac5; background: #fffafa; }
.btn.danger:hover { background: var(--bad-bg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ico { flex: 0 0 auto; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); font-size: 26px;
  line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.icon-btn:hover { color: var(--ink); background: var(--line-2); }
.linkbtn {
  border: 0; background: transparent; color: var(--info); font-size: 11.5px;
  padding: 2px; cursor: pointer; font-weight: 600;
}
.linkbtn:hover { text-decoration: underline; }

/* ---------- data bar ---------- */
.databar {
  background: #0a182a;
  color: #c9d5e2;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 11.5px;
}
.databar-inner {
  max-width: 1560px; margin: 0 auto; padding: 8px 28px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.databar-lead { display: flex; align-items: center; gap: 7px; letter-spacing: .12em; text-transform: uppercase; font-size: 10px; color: #e3c98c; font-weight: 600; }
.databar-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 0 3px rgba(217,183,104,.15); }
.databtn { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.16); color: #dce6f1; padding: 5px 10px; font-size: 11.5px; }
.databtn:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.28); }
.dstatus { margin-left: auto; color: #93a6bb; font-size: 11px; }

/* ---------- top bar ---------- */
.topbar {
  background:
    radial-gradient(900px 220px at 12% -60%, rgba(217, 183, 104, .18), transparent 70%),
    radial-gradient(640px 260px at 88% -30%, rgba(229, 106, 164, .16), transparent 70%),
    linear-gradient(120deg, #0b1b30 0%, #10263f 55%, #14304d 100%);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}
.topbar-inner {
  max-width: 1560px; margin: 0 auto; padding: 22px 28px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 18px; }
.monogram {
  width: 54px; height: 54px; border-radius: 14px;
  border: 1px solid rgba(217, 183, 104, .55);
  background: linear-gradient(150deg, rgba(217, 183, 104, .22), rgba(229, 106, 164, .08));
  display: grid; place-items: center;
  font-family: var(--display); font-size: 19px; letter-spacing: .06em; color: #f2dfae;
  flex: 0 0 auto;
}
.eyebrow {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: #d9b768; font-weight: 600; margin-bottom: 4px;
}
.eyebrow.dark { color: var(--gold); }
.topbar h1 {
  font-family: var(--display); font-size: 26px; letter-spacing: .01em;
  font-weight: 500; line-height: 1.15;
}
.topbar-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: #c2cfdd; }
.meta-pill {
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .05);
  border-radius: 999px; padding: 6px 11px; letter-spacing: .03em; white-space: nowrap;
}
.meta-pill strong { color: #fff; font-weight: 600; }

/* ---------- toolbar / tabs ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 18px -16px rgba(16, 28, 46, .5);
}
.toolbar-inner {
  max-width: 1560px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.tabs { display: flex; gap: 2px; }
.tab {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  padding: 14px 15px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; letter-spacing: .01em;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
.toolbar-note { font-size: 11px; color: var(--muted); letter-spacing: .02em; }

/* ---------- pages ---------- */
main { max-width: 1560px; margin: 0 auto; padding: 20px 28px 44px; }
.page { display: none; }
.page.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin: 6px 0 18px; flex-wrap: wrap;
}
.page-head h2 { font-family: var(--display); font-size: 25px; font-weight: 500; color: var(--navy); }
.page-sub { color: var(--muted); font-size: 12.5px; max-width: 760px; margin-top: 5px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 0; margin-bottom: 16px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
}
.panel-head h3 { font-size: 13.5px; color: var(--navy); letter-spacing: .01em; }
.panel-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; white-space: nowrap;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface-2);
}
.pill.subtle { background: var(--surface-2); }
.pill.good { background: var(--good-bg); border-color: #c7e6da; color: var(--good); }
.pill.warn { background: var(--warn-bg); border-color: #ecdbaf; color: var(--warn); }
.pill.bad { background: var(--bad-bg); border-color: #eccac5; color: var(--bad); }
.fine { color: var(--muted); font-size: 11.5px; line-height: 1.5; }

/* ---------- filters ---------- */
.filterbar {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow);
  position: relative; z-index: 45;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.field > span { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.field select, .field input {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); border-radius: 7px; padding: 7px 10px; font-size: 12px; min-width: 0;
  height: 33px;
}
.field select { padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 13px) 14px, calc(100% - 8px) 14px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.field input:focus, .field select:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(217,183,104,.16); }
.field.postal input { width: 126px; }
.filterbar > .btn { margin-left: auto; }

/* multiselect */
.multiselect { position: relative; min-width: 180px; }
.ms-toggle {
  height: 33px; width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 7px; padding: 0 10px; font-size: 12px; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer;
  text-align: left;
}
.ms-toggle:hover { border-color: #c9d2df; }
.ms-toggle svg { color: var(--muted); flex: 0 0 auto; }
.ms-panel {
  position: absolute; top: calc(100% + 5px); left: 0; width: 300px; z-index: 1200;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 18px 44px -18px rgba(16,28,46,.45); padding: 8px;
}
.ms-search input {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px;
  font-size: 12px; background: var(--surface-2);
}
.ms-actions { display: flex; justify-content: space-between; padding: 6px 2px 4px; }
.ms-list { max-height: 260px; overflow: auto; padding-top: 2px; }
.ms-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 7px; border-radius: 6px;
  font-size: 12px; cursor: pointer; color: var(--ink-2);
}
.ms-item:hover { background: var(--pink-1); }
.ms-item input { accent-color: var(--pink-4); }
.ms-item .ms-sub { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.ms-empty { padding: 12px 8px; color: var(--muted); font-size: 12px; }

/* ---------- KPI grid ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px 11px; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); }
.kpi.pink::before { background: var(--pink-3); }
.kpi .kpi-label { font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.kpi .kpi-value { font-size: 22px; font-weight: 600; color: var(--navy); margin-top: 5px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .kpi-sub { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.kpi .official { font-size: 8.5px; letter-spacing: .08em; color: var(--good); background: var(--good-bg); border-radius: 3px; padding: 1px 4px; font-weight: 600; }

/* ---------- map layout ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: stretch; }
.map-panel {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 640px;
}
.map-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border-bottom: 1px solid var(--line-2); background: var(--surface);
  flex-wrap: wrap; z-index: 600;
}
.crumbs { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.crumbs button { border: 0; background: transparent; color: var(--info); font-size: 11.5px; cursor: pointer; padding: 1px 2px; font-weight: 600; }
.crumbs button:hover { text-decoration: underline; }
.crumbs .sep { color: #c2cbd7; }
.crumbs .current { color: var(--ink); font-weight: 600; }
.map-modes { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; }
.mode {
  border: 0; background: transparent; font-size: 10.5px; font-weight: 600; color: var(--muted);
  padding: 5px 8px; border-radius: 5px; cursor: pointer;
}
.mode.active { background: var(--navy); color: #fff; }
#map { flex: 1; min-height: 590px; background: #e9eef2; z-index: 1; }
.leaflet-container { font-family: var(--font); background: #e9eef2; }
.leaflet-control-attribution { font-size: 9px; background: rgba(255,255,255,.8); }
.leaflet-control-zoom a { color: var(--navy); }
.leaflet-tooltip.map-tip {
  background: rgba(13,32,56,.96); color: #f5f8fc; border: 0; border-radius: 7px;
  box-shadow: 0 10px 24px -12px rgba(0,0,0,.5); font-size: 11.5px; padding: 7px 9px;
}
.leaflet-tooltip.map-tip::before { border-top-color: rgba(13,32,56,.96); }
.map-tip .tt-title { font-weight: 600; font-size: 12px; color: #fff; }
.map-tip .tt-sub { color: #c2cfdd; font-size: 10.5px; }
.map-tip .tt-row { display: flex; justify-content: space-between; gap: 14px; margin-top: 3px; }
.map-tip .tt-row b { color: #f2dfae; font-weight: 600; }
.legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 700;
  background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; box-shadow: 0 10px 24px -16px rgba(16,28,46,.4); width: 214px;
  font-size: 9.5px; color: var(--ink-2);
}
.legend-title { font-weight: 600; font-size: 10px; letter-spacing: .04em; color: var(--navy); margin-bottom: 5px; }
.legend-scale { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
.legend-scale .ls { flex: 1; }
.ls.light { background: var(--pink-1); }
.ls.mid { background: var(--pink-3); }
.ls.dark { background: var(--pink-5); }
.legend-ends { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 8.5px; line-height: 1.25; margin-top: 4px; }
.legend-ends span:last-child { text-align: right; }
.legend-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ink-2); font-size: 9.5px; }
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.swatch.store { background: #e0172a; border: 2px solid #fff; box-shadow: 0 0 0 1px #b7bfc9; }
.swatch.review { background: #ff8a00; border: 2px solid #fff; box-shadow: 0 0 0 1px #b7bfc9; }
.swatch.nodata { background: #e4e9ef; border: 1px solid #c7d0da; border-radius: 2px; }
.swatch.postal { background: #ffd400; border: 2px solid #4a3600; box-shadow: 0 0 0 1px #fff; width: 8px; height: 8px; }
.store-pin, .postal-pin { transition: none; }
.store-pin:hover, .postal-pin:hover, .store-pin:focus, .postal-pin:focus { opacity: 1 !important; fill-opacity: 1 !important; }
.map-status {
  position: absolute; right: 12px; bottom: 12px; z-index: 700;
  background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 9px; font-size: 10px; color: var(--muted); max-width: 300px;
}
.route-card {
  position: absolute; left: 12px; top: 54px; z-index: 700;
  width: 272px; max-width: calc(100% - 24px);
  background: rgba(255,255,255,.97); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 10px 24px -16px rgba(16,28,46,.4); padding: 9px 11px;
  font-size: 11px; color: var(--ink-2);
}
.route-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 9.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--navy); }
.route-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.route-close:hover { color: var(--ink); }
.route-stop { display: flex; gap: 8px; margin-top: 8px; align-items: flex-start; }
.route-stop .n { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 9.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.route-stop b { display: block; font-size: 11.5px; color: var(--ink); line-height: 1.25; }
.route-stop span { font-size: 9.5px; color: var(--muted); }
.route-metrics { display: flex; gap: 12px; margin-top: 9px; border-top: 1px solid var(--line-2); padding-top: 8px; }
.route-metric { flex: 1; }
.route-metric .lab { font-size: 8.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.route-metric .val { font-size: 15px; font-weight: 600; color: var(--navy); margin-top: 2px; }
.route-note { font-size: 9px; line-height: 1.4; color: var(--muted); margin-top: 8px; }
.route-hint { font-size: 10px; line-height: 1.4; color: var(--muted); margin-top: 8px; }
.route-error { font-size: 10px; line-height: 1.4; color: var(--bad); margin-top: 8px; }

/* ---------- info panel ---------- */
.info-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; overflow: auto; max-height: calc(100vh - 190px);
}
.info-eyebrow { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.info-empty h2 { font-family: var(--display); font-size: 21px; font-weight: 500; color: var(--navy); margin: 5px 0 7px; }
.info-empty p { color: var(--muted); font-size: 12px; }
.info-hints { margin-top: 20px; display: grid; gap: 10px; }
.info-hints > div { border-top: 1px solid var(--line-2); padding-top: 9px; display: flex; flex-direction: column; gap: 2px; }
.info-hints b { font-size: 11px; color: var(--ink-2); }
.info-hints span { font-size: 10.5px; color: var(--muted); }

.info-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.info-head h2 { font-family: var(--display); font-size: 21px; font-weight: 500; color: var(--navy); line-height: 1.15; margin-top: 4px; }
.info-head .sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.info-badge { flex: 0 0 auto; }
.info-medal {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: linear-gradient(135deg, #fff 0%, var(--pink-1) 140%);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.info-medal .label { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.info-medal .value { font-size: 28px; font-weight: 600; color: var(--rose-ink); line-height: 1.05; }
.info-medal .rank { text-align: right; font-size: 10.5px; color: var(--muted); }
.info-medal .rank b { display: block; font-size: 16px; color: var(--navy); font-weight: 600; }
.info-section { margin-top: 14px; }
.info-section h3 { font-size: 10px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.info-cell { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 9px; }
.info-cell .lab { font-size: 9.5px; color: var(--muted); }
.info-cell .val { font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.info-cell .val small { font-size: 9.5px; font-weight: 400; color: var(--muted); }
.info-cell.wide { grid-column: 1 / -1; }
.info-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.info-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.info-list li:last-child { border-bottom: 0; }
.info-list .r { color: var(--muted); font-variant-numeric: tabular-nums; }
.flagbox { margin-top: 12px; border-radius: 8px; padding: 8px 10px; font-size: 10.5px; line-height: 1.45; }
.flagbox.info { background: var(--info-bg); color: var(--info); }
.flagbox.warn { background: var(--warn-bg); color: var(--warn); }
.flagbox.bad { background: var(--bad-bg); color: var(--bad); }
.flagbox b { font-weight: 600; }
.info-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; max-height: 66vh; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.data-table th {
  position: sticky; top: 0; z-index: 2; background: #f7f9fb; color: var(--muted);
  text-align: left; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #fdf7fa; }
.data-table tbody tr.selected { background: var(--pink-1); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .area-name { font-weight: 600; color: var(--navy); }
.data-table .muted { color: var(--muted); }
.data-table.compact td { padding: 6px 8px; }
.data-table.compact th { padding: 6px 8px; font-size: 9px; }
.data-table tbody tr.no-click { cursor: default; }
.data-table tbody tr.no-click:hover { background: transparent; }
.store-select { min-width: 230px; max-width: 300px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font-size: 11px; background: #fff; color: var(--ink-2); }
.score-chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 42px;
  border-radius: 999px; padding: 3px 8px; font-size: 10.5px; font-weight: 600;
  background: var(--pink-1); color: var(--rose-ink); border: 1px solid #f3cadc;
}
.score-chip.high { background: #f7d6e6; color: #7a0b3d; border-color: #eeb2ce; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--good); }
.status-dot.warn { background: var(--warn); }
.status-dot.bad { background: var(--bad); }
.table-note { padding: 9px 12px; border-top: 1px solid var(--line-2); font-size: 10.5px; color: var(--muted); }
.empty-row td { text-align: center; color: var(--muted); padding: 24px; }

/* ---------- ranking ---------- */
.weights-panel .weights { display: flex; align-items: flex-end; gap: 14px; padding: 14px 18px; flex-wrap: wrap; }
.weight-field { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.weight-field span { color: var(--muted); }
.weight-field input { width: 58px; border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; font-size: 12px; text-align: right; }
.weight-field b { color: var(--muted); font-weight: 400; }
.weights-panel .fine { padding: 0 18px 14px; }
.inline-search { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; color: var(--muted); }
.inline-search input { border: 0; background: transparent; outline: none; font-size: 11.5px; width: 210px; color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--gold); }

/* ---------- summary cards ---------- */
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.summary-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; box-shadow: var(--shadow); }
.summary-card .s-label { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.summary-card .s-value { font-size: 23px; font-weight: 600; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.summary-card .s-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.summary-card.pink .s-value { color: var(--rose-ink); }

/* ---------- data center ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; }
.kv-list { padding: 6px 18px 4px; }
.kv-list .kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 11.5px; }
.kv-list .kv:last-child { border-bottom: 0; }
.kv-list .k { color: var(--muted); }
.kv-list .v { color: var(--ink); font-weight: 600; text-align: right; }
.kv-list .v a { color: var(--info); text-decoration: none; }
.kv-list .v a:hover { text-decoration: underline; }
.dataset-table-wrap { max-height: 330px; overflow: auto; border-top: 1px solid var(--line-2); }
.dataset-table-wrap .data-table tbody tr { cursor: default; }
.dataset-table-wrap .data-table tbody tr:hover { background: transparent; }
.check-result { padding: 14px 18px; font-size: 12px; color: var(--ink-2); }
.check-result .check-head { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.check-result ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 11.5px; }
.check-result li { margin-bottom: 3px; }
.check-result .ok { color: var(--good); font-weight: 600; }
.check-result .warn { color: var(--warn); font-weight: 600; }
.history { border-top: 1px solid var(--line-2); padding: 12px 18px; }
.history h4 { font-size: 10px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.history-list { list-style: none; margin: 0; padding: 0; max-height: 210px; overflow: auto; }
.history-list li { display: flex; gap: 10px; font-size: 11px; padding: 6px 0; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
.history-list li:last-child { border-bottom: 0; }
.history-list .when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.import-card { display: flex; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.import-card:nth-child(odd) { border-right: 1px solid var(--line-2); }
.import-card h4 { font-size: 12.5px; color: var(--navy); margin-bottom: 2px; }
.import-card p { font-size: 10.5px; color: var(--muted); margin-bottom: 7px; }
.import-icon {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center;
  background: var(--pink-1); border: 1px solid #f3cadc; color: var(--rose-ink);
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
}
.reset-row { padding: 12px 18px; display: flex; justify-content: flex-end; }

/* ---------- methodology ---------- */
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.method-card { padding: 18px; }
.method-card h3 { font-family: var(--display); font-size: 17px; font-weight: 500; color: var(--navy); margin-bottom: 7px; }
.method-card p { font-size: 12px; color: var(--ink-2); margin-bottom: 7px; }
.method-card .fine { font-size: 11px; }
.method-card ul.tight { margin: 4px 0 0; padding-left: 18px; font-size: 11.5px; color: var(--ink-2); }
.method-card ul.tight li { margin-bottom: 4px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 3000; background: rgba(9, 20, 35, .55);
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px);
}
.modal {
  width: min(880px, 100%); max-height: 90vh; background: var(--surface);
  border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-family: var(--display); font-size: 22px; font-weight: 500; color: var(--navy); margin-top: 3px; }
.modal-body { padding: 14px 20px; overflow: auto; }
.upload-steps { display: flex; gap: 8px; margin-bottom: 14px; }
.ustep { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; display: flex; align-items: center; gap: 5px; }
.ustep b { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--line-2); color: var(--muted); font-size: 9px; }
.ustep.active { border-color: var(--gold-2); color: var(--navy); background: var(--gold-soft); }
.ustep.active b { background: var(--gold); color: #fff; }
.upload-type { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.upload-type .field { min-width: 260px; }
.upload-type .fine { flex: 1; min-width: 220px; }
.dropzone {
  border: 1.5px dashed #cfd8e3; border-radius: 12px; background: var(--surface-2);
  min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; color: var(--muted); cursor: pointer; text-align: center; padding: 16px;
}
.dropzone:hover { border-color: var(--pink-3); background: var(--pink-1); }
.dropzone svg { color: var(--pink-4); }
.dropzone b { color: var(--ink-2); font-size: 13px; }
.dropzone span { font-size: 10.5px; }
.dropzone .fname { color: var(--rose-ink); font-weight: 600; }
.sheet-row { margin-top: 10px; }
.mapping-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.map-field { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.map-field label { display: block; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.map-field select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 11.5px; background: #fff; }
.map-field.req label::after { content: " *"; color: var(--bad); }
.validation { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.validation .flagbox { grid-column: 1 / -1; margin-top: 2px; }
.vbox { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.vbox .v { font-size: 18px; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.vbox .l { font-size: 9.5px; color: var(--muted); }
.vbox.bad .v { color: var(--bad); }
.vbox.good .v { color: var(--good); }
.preview-wrap { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line-2); background: var(--surface-2); }
.modal-status { flex: 1; font-size: 11px; color: var(--muted); }
.modal-status.bad { color: var(--bad); }
.modal-status.good { color: var(--good); }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 4000; display: grid; gap: 8px; width: 340px; }
.toast {
  background: var(--navy); color: #fff; border-radius: 9px; padding: 10px 13px;
  font-size: 12px; box-shadow: 0 18px 40px -14px rgba(0,0,0,.55);
  border-left: 3px solid var(--gold); animation: slidein .2s ease;
}
.toast.bad { border-left-color: #e06a5e; }
.toast.good { border-left-color: #4dbd94; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .map-layout { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1000px) {
  .map-layout { grid-template-columns: 1fr; }
  .info-panel { max-height: none; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .method-grid { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: 1fr; }
  .import-card:nth-child(odd) { border-right: 0; }
}
@media (max-width: 680px) {
  main { padding: 14px 14px 40px; }
  .topbar-inner, .toolbar-inner, .databar-inner { padding-left: 14px; padding-right: 14px; }
  .topbar h1 { font-size: 21px; }
  .toolbar-note { display: none; }
  .tabs { overflow-x: auto; width: 100%; }
  .tab { padding: 12px 10px; white-space: nowrap; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filterbar { padding: 10px; }
  .field { flex: 1 1 130px; min-width: 0; }
  .filterbar > .btn { margin-left: 0; }
  .map-panel { min-height: 500px; }
  #map { min-height: 430px; }
  .legend { width: 190px; }
  .modal { max-height: 94vh; }
  .mapping-grid, .validation { grid-template-columns: 1fr 1fr; }
}

/* hidden must always win over component display rules */
[hidden] { display: none !important; }

/* ---------- print ---------- */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff; font-size: 11px; }
  .databar, .toolbar, .filterbar, .map-modes, .legend, .map-status, .head-actions,
  .panel-tools, .weights-panel, .info-actions, .toast-wrap, .modal-backdrop, .map-toolbar .crumbs { display: none !important; }
  .topbar { border-bottom: 3px solid var(--gold); }
  .topbar-inner { padding: 14px 20px; }
  main { max-width: none; padding: 12px 20px; }
  .page { display: block !important; page-break-before: always; }
  body.printing .page { display: none !important; page-break-before: auto; break-before: auto; }
  body.printing .page.active { display: block !important; page-break-before: auto; break-before: auto; }
  .page#page-map { page-break-before: auto; }
  .panel, .kpi, .summary-card { box-shadow: none; border-color: #cfd8e3; }
  .map-layout { grid-template-columns: 1.6fr 1fr; }
  .map-panel { min-height: 520px; }
  #map { min-height: 480px; }
  .info-panel { max-height: none; overflow: visible; }
  .table-wrap, .dataset-table-wrap { max-height: none; overflow: visible; }
  .data-table th { background: #eef2f7 !important; }
  .page-head h2 { font-size: 20px; }
  .weights-panel .weights { display: none; }
  .weights-panel .fine { display: block; }
}
