:root {
  color-scheme: light;
  --bg: #f6f8f6;
  --card: #ffffff;
  --panel: #eef3ef;
  --panel-2: #e3ebe5;
  --line: #dfe7e1;
  --ink: #14201a;
  --ink-2: #3f4a44;
  --ink-3: #6e7a73;
  --sidebar: #0f2a1d;
  --sidebar-ink: #c4d3ca;
  --primary: #00602f;
  --primary-2: #17803f;
  --neutral-bar: #7b8a82;  /* non-brand metrics (rating, terrace) */
  --good: #006d30;
  --good-bg: #dff7e4;
  --warn: #8a5300;
  --warn-bg: #fff0d9;

  /* owner palette — validated (dataviz validate_palette.js, light) */
  --o-cg: #17803f;
  --o-ru: #3a7fd6;
  --o-hk: #e8692f;
  --o-craft: #9264c9;
  --o-other: #6b6f73;   /* darker neutral: clearly apart from "no brand" */
  --o-none: #ffffff;    /* "no beer brand" = hollow ring */
  --o-empty: #d5ddd8;   /* empty / not applicable fills */

  --radius: 8px;
  --shadow: 0 1px 3px rgba(19, 27, 46, .06), 0 1px 2px rgba(19, 27, 46, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 13px/18px Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Plus Jakarta Sans", Inter, sans-serif; margin: 0; }
h1 { font-size: 24px; line-height: 32px; letter-spacing: -.02em; }
h2 { font-size: 16px; line-height: 24px; letter-spacing: -.01em; }
h3 { font-size: 14px; line-height: 20px; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }

/* ---------- shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 232px;
  background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 16px; z-index: 20;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark { width: 30px; height: 30px; border-radius: 6px; background: var(--primary-2); color: #fff; display: grid; place-items: center; }
.brand-title { color: #fff; font: 600 15px/18px "Plus Jakarta Sans", sans-serif; }
.brand-sub { color: #9fd6b2; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.street-focus { background: rgba(255,255,255,.06); border-radius: var(--radius); padding: 10px; }
.street-focus .label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.street-focus .value { color: #fff; font-weight: 600; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { color: var(--sidebar-ink); text-decoration: none; padding: 9px 12px; border-radius: var(--radius); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--primary-2); color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; font-size: 11px; line-height: 15px; color: #9ea3b8; }

.shell { margin-left: 232px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10; min-height: 56px; gap: 12px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: rgba(246,248,246,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex: none; }
.btn { white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: var(--radius); padding: 7px 12px; font-weight: 500; font-size: 12px; }
.btn:hover { background: var(--panel); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
main { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1480px; }

/* ---------- primitives ---------- */
.card { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.sub { color: var(--ink-2); font-size: 12px; line-height: 17px; }
.muted { color: var(--ink-3); }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600; background: var(--panel-2); color: var(--ink-2); white-space: nowrap; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-info { background: #dcefe2; color: #0b5a2c; }
#year-chips .chip { padding: 3px 9px; font-size: 11px; }
#year-chips .lbl { font-size: 11px; color: var(--ink-3); padding: 3px 4px 3px 6px; align-self: center; }
.evidence-banner { display: block; background: #dcefe2; color: #0b5a2c; border-radius: var(--radius); padding: 10px 14px; font-size: 12px; line-height: 17px; }
.evidence-banner strong { color: #063f1e; }
.hbar.more { cursor: pointer; }
.hbar.more .name { color: var(--primary); font-weight: 600; }
.hbars-extra { display: flex; flex-direction: column; gap: 10px; }
.hbars-extra[hidden] { display: none; }
.definition { font-size: 12px; line-height: 18px; color: var(--ink-2); background: var(--panel); border-radius: var(--radius); padding: 10px 12px; margin-top: 12px; }
.definition b { color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.note { font-size: 11px; line-height: 15px; color: var(--ink-3); margin-top: 12px; }
.grid { display: grid; gap: 20px; }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-8-4 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* KPI tiles */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.kpi .value { font: 700 28px/32px Inter, sans-serif; letter-spacing: -.02em; }
.kpi .value small { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-left: 4px; }
.kpi .foot { font-size: 12px; color: var(--ink-2); }
.kpi.hero { background: linear-gradient(135deg, #fff 55%, #e2f2e7); }
.kpi.hero .value { color: var(--primary); }
.meter { height: 4px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: 4px; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--primary-2); }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* chips / filters */
.chips { display: flex; gap: 4px; flex-wrap: wrap; background: var(--panel); padding: 4px; border-radius: var(--radius); }
.chip { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; font-size: 12px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* map */
#map { height: 440px; border-radius: 8px; overflow: hidden; margin-top: 14px; background: var(--panel); }
.pin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); cursor: pointer; }
.pin.top { width: 22px; height: 22px; outline: 2px dashed var(--o-cg); outline-offset: 3px; }
.pin.dim { opacity: .18; }
.maplibregl-popup-content { font: 12px/16px Inter, sans-serif; border-radius: 8px; padding: 10px 12px; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.maplibregl-popup-content b { font-size: 13px; }

/* horizontal bars */
.hbars { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.hbar { display: grid; grid-template-columns: 132px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 12px; }
.hbar .name { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 14px; background: var(--panel); border-radius: 4px; position: relative; }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar .val small { color: var(--ink-3); font-weight: 500; }

/* stacked bar */
.stackbar { display: flex; height: 16px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--card); }
.stackbar > span { height: 100%; min-width: 2px; }
.stackbar > span:first-child { border-radius: 4px 0 0 4px; }
.stackbar > span:last-child { border-radius: 0 4px 4px 0; }

/* penetration rows */
.pen { display: flex; flex-direction: column; gap: 4px; }
.pen .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.pen .row b { color: var(--ink); }
.pen .meter { height: 8px; }

.split { display: flex; justify-content: space-between; gap: 12px; background: var(--panel); border-radius: var(--radius); padding: 14px; }
.split .big { font: 700 26px/30px Inter, sans-serif; letter-spacing: -.02em; }
.split .lbl { font-size: 11px; color: var(--ink-2); }

.callout { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; font-size: 12px; line-height: 18px; color: var(--ink-2); }
.callout strong { color: var(--ink); }
.callout .kicker { margin-bottom: 4px; display: block; }

ul.bullets { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
ul.bullets li { position: relative; padding-left: 16px; font-size: 12px; line-height: 18px; color: var(--ink-2); }
ul.bullets li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--primary-2); }
ul.bullets li strong { color: var(--ink); }

/* sections strip */
.sections { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.section { background: var(--panel); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.section .t { font-weight: 600; font-size: 12px; }
.section .s { font-size: 11px; color: var(--ink-3); line-height: 14px; min-height: 28px; }
.section .n { font-size: 12px; color: var(--ink-2); }

/* table */
.toolbar { display: grid; grid-template-columns: minmax(200px, 1.4fr) repeat(5, minmax(0, 1fr)); gap: 8px; }
.toolbar input, .toolbar select { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 7px 10px; font: inherit; color: var(--ink); }
.table-wrap { overflow-x: auto; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; min-width: 1040px; }
th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px; background: var(--panel); position: sticky; top: 0; }
td { padding: 11px 12px; border-top: 1px solid var(--line); vertical-align: top; font-size: 12px; }
tr:hover td { background: #f8fbf9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.c, th.c { text-align: center; }
.vname { font-weight: 600; color: var(--ink); }
.vmeta { color: var(--ink-3); font-size: 11px; margin-top: 2px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 5px; font-size: 11px; background: var(--panel-2); color: var(--ink-2); margin: 0 4px 4px 0; white-space: nowrap; }
.tag.cg { background: #dcefe2; color: #0b5a2c; font-weight: 600; }
.yes { color: var(--good); font-weight: 600; }
.no { color: var(--ink-3); }
.flag { color: var(--warn); font-size: 11px; }

/* heat table */
.heat td { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; border-top: 2px solid var(--card); }
.heat td:first-child { text-align: left; font-weight: 500; }
.heat td.zero { color: var(--ink-3); font-weight: 400; }
.heat th { text-align: center; }
.heat th:first-child { text-align: left; }
.heat table { min-width: 720px; }

/* venn-ish */
.gap4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.gap4 > div { background: var(--panel); border-radius: var(--radius); padding: 12px; }
.gap4 .big { font: 700 24px/28px Inter, sans-serif; }
.gap4 .lbl { font-size: 11px; color: var(--ink-2); line-height: 14px; margin-top: 4px; }

.takeaway { display: flex; gap: 16px; align-items: flex-start; background: var(--panel); }
.takeaway .icon { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }
.takeaway p { font-size: 14px; line-height: 22px; color: var(--ink-2); margin-top: 6px; }
.takeaway p strong { color: var(--ink); }

.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; line-height: 16px; padding: 7px 10px; border-radius: 6px; max-width: 280px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }

@media (max-width: 1200px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-8-4 { grid-template-columns: minmax(0, 1fr); }
  .toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; }
  .shell { margin-left: 0; }
  main { padding: 16px; }
  .g-5, .g-3, .sections, .gap4 { grid-template-columns: minmax(0, 1fr); }
  .topbar { position: static; }
}
@media print {
  .sidebar, .topbar .actions { display: none; }
  .shell { margin-left: 0; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid var(--line); }
}

/* multi-select filters */
.ms { position: relative; }
.ms-btn { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 7px 26px 7px 10px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.ms-btn::after { content: "▾"; position: absolute; right: 10px; color: var(--ink-3); }
.ms-btn.on { border-color: var(--primary-2); background: #e6f3ea; color: var(--primary); font-weight: 600; }
.ms-panel { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20,32,26,.14); padding: 8px; }
.ms-panel[hidden] { display: none; }
.ms-search { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; margin-bottom: 6px; }
.ms-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; }
.ms-opt { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.ms-opt:hover { background: var(--panel); }
.ms-opt[hidden] { display: none; }
.ms-opt span { flex: 1; }
.ms-opt small { color: var(--ink-3); }
.ms-opt input { accent-color: var(--primary-2); }
.ms-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; font-size: 11px; }
.ms-clear { border: 0; background: none; color: var(--primary); font-weight: 600; padding: 2px 4px; }

/* "no beer brand" is shown as a hollow ring, so it differs by shape, not only colour */
.dot.ring, .pin.none { background: #fff !important; box-shadow: inset 0 0 0 2px #6e7a73; }
.pin.none { box-shadow: inset 0 0 0 3px #6e7a73, 0 1px 3px rgba(0,0,0,.35); }
.section .lbl { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.section .n b { color: var(--ink); }
