/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, .10);
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s1-wash: rgba(42, 120, 214, .10);
  --s1-band: rgba(42, 120, 214, .28);
  --s2-wash: rgba(235, 104, 52, .10);
  --nodata: #e4e3dd;
  --good: #006300;
  --bad: #c22f2f;
  --notice-bg: #eef4fc;
  --notice-border: #cde2fb;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabs-h: 46px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, .10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --s1-wash: rgba(57, 135, 229, .14); --s1-band: rgba(57, 135, 229, .34); --s2-wash: rgba(217, 89, 38, .16);
    --nodata: #2c2c2a; --good: #0ca30c; --bad: #e66767;
    --notice-bg: #14202f; --notice-border: #1c3a5f; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, .10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --s1-wash: rgba(57, 135, 229, .14); --s1-band: rgba(57, 135, 229, .34); --s2-wash: rgba(217, 89, 38, .16);
  --nodata: #2c2c2a; --good: #0ca30c; --bad: #e66767;
  --notice-bg: #14202f; --notice-border: #1c3a5f; --shadow: none;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- header ---------- */
.top { padding: 18px 0 10px; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 36px; height: 36px; flex: none; }
.logo rect:first-child { fill: var(--s1); }
.logo rect:not(:first-child) { fill: #fff; }
h1 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.sub { color: var(--text-2); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--text-2); stroke-width: 1.8; stroke-linecap: round; }
.icon-btn:hover svg { stroke: var(--text); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- tabs ---------- */
.tabs {
  position: sticky; top: 0; z-index: 21; height: var(--tabs-h);
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.tabs-inner { display: flex; gap: 4px; height: 100%; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; border: 0; background: none; padding: 0 12px; font-size: 14px; font-weight: 550; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--s1); }

/* ---------- filters ---------- */
.filters {
  position: sticky; top: var(--tabs-h); z-index: 20;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.filters-inner { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding-top: 8px; padding-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field select {
  height: 34px; min-width: 150px; max-width: 100%; padding: 0 32px 0 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  appearance: none; -webkit-appearance: none;
}
.field-wide select { min-width: 200px; width: 220px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; height: 34px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 0 10px; border-radius: 7px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg-sm { height: 30px; flex: none; }
.seg-sm button { padding: 0 9px; font-size: 12px; }
.link-btn { border: 0; background: none; color: var(--s1); padding: 0 2px; height: 34px; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- layout ---------- */
main { padding-top: 16px; padding-bottom: 32px; }
.view { display: flex; flex-direction: column; gap: 16px; }
#notice { margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.grid.align-start { align-items: start; }
.kpi-grid > .hero { grid-column: span 7; }
.kpi-grid > .tiles { grid-column: span 5; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g-8-4 > :nth-child(1) { grid-column: span 8; }
.g-8-4 > :nth-child(2) { grid-column: span 4; }
.g-6-3-3 > :nth-child(1) { grid-column: span 6; }
.g-6-3-3 > :nth-child(2), .g-6-3-3 > :nth-child(3) { grid-column: span 3; }
.g-6-6 > * { grid-column: span 6; }
.g-5-7 > :nth-child(1) { grid-column: span 5; }
.g-5-7 > :nth-child(2) { grid-column: span 7; }
.g-7-5 > :nth-child(1) { grid-column: span 7; }
.g-7-5 > :nth-child(2) { grid-column: span 5; }
.grid.inner { margin-top: 18px; }
.grid.inner0 { gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--s1-wash); color: var(--text-2); vertical-align: 1px; margin-left: 2px; }
.mini-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.mini-title.mt { margin-top: 18px; }
.ghost-btn { flex: none; border: 1px solid var(--border); background: transparent; border-radius: 8px; padding: 3px 9px; font-size: 12px; color: var(--text-2); }
.ghost-btn:hover, .ghost-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }

.chart { width: 100%; height: 300px; }
.chart-sm { height: 240px; }
.chart-map { height: 400px; }
.chart-map-sm { height: 260px; }

/* ---------- notice ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--notice-bg); border: 1px solid var(--notice-border); border-radius: 12px; padding: 10px 14px; color: var(--text); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: var(--s1); stroke-width: 2; stroke-linecap: round; }

/* ---------- hero & strip ---------- */
.eyebrow { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.hero { display: flex; flex-direction: column; padding: 20px 22px; }
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero-value { font-size: 52px; line-height: 1.05; font-weight: 650; letter-spacing: -.025em; margin-top: 4px; }
.hero-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.delta { text-align: right; font-size: 13px; color: var(--text-2); padding-top: 4px; }
.delta b { display: inline-flex; align-items: center; gap: 4px; font-size: 18px; font-weight: 650; }
.delta b svg { width: 14px; height: 14px; }
.delta .up { color: var(--good); }
.delta .down { color: var(--bad); }
.delta .flat { color: var(--text-2); }
.delta small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.strip { position: relative; height: 34px; margin: 22px 0 4px; }
.strip > div { position: absolute; top: 12px; height: 10px; }
.strip-track { left: 0; right: 0; background: var(--surface-2); border-radius: 99px; }
.strip-outer { background: var(--s1-wash); border-radius: 99px; outline: 1px solid var(--s1-band); outline-offset: -1px; }
.strip-inner { background: var(--s1-band); border-radius: 99px; }
.strip .strip-median { width: 4px; margin-left: -2px; top: 6px; height: 22px; background: var(--s1); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.strip .strip-you { top: 0; height: 34px; width: 0; }
.strip-you::before { content: ""; position: absolute; left: -7px; top: 10px; width: 14px; height: 14px; border-radius: 50%; background: var(--s2); box-shadow: 0 0 0 2px var(--surface); }
.strip-you span { position: absolute; bottom: 30px; transform: translateX(-50%); white-space: nowrap; font-size: 11.5px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.strip-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
.strip-legend div { min-width: 0; }
.strip-legend dt { font-size: 11px; color: var(--muted); }
.strip-legend dd { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.calc { padding-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; border-top: 1px solid var(--border); margin-top: 18px; }
.hero .calc { margin-top: auto; }
.hero #hero-strip + .calc { margin-top: 18px; }
.calc-label { font-weight: 600; font-size: 13.5px; }
.calc-input { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 0 10px; height: 36px; }
.calc-input input { width: 120px; border: 0; background: transparent; outline: none; font-size: 15px; font-weight: 600; }
.calc-input:focus-within { border-color: var(--s1); }
.calc-input span { color: var(--muted); }
.calc-result { color: var(--text-2); font-size: 13.5px; flex: 1 1 220px; }
.calc-result b { color: var(--text); }

/* ---------- tiles ---------- */
.tile { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; }
.tile-value { font-size: 26px; font-weight: 650; letter-spacing: -.015em; margin-top: 4px; white-space: nowrap; }
.tile-value.small { font-size: 21px; }
.tile-sub { color: var(--muted); font-size: 12.5px; }
.link-tile { cursor: pointer; transition: border-color .15s; }
.link-tile:hover { border-color: var(--s1-band); }

/* ---------- map legend ---------- */
.map-legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); }
.map-legend .ramp { display: flex; align-items: center; gap: 8px; }
.map-legend .ramp i { display: block; width: 150px; height: 10px; border-radius: 99px; }
.map-legend em { font-style: normal; color: var(--text-2); white-space: nowrap; }
.map-legend .ramp { white-space: nowrap; }
.map-legend .nd { display: flex; align-items: center; gap: 6px; }
.map-legend .nd i { width: 14px; height: 10px; border-radius: 3px; background: var(--nodata); display: block; }

/* ---------- ranking & dumbbell lists ---------- */
.rank-card { display: flex; flex-direction: column; }
.rank { list-style: none; padding: 0; margin: 0 -8px; overflow-y: auto; max-height: 430px; flex: 1; scrollbar-width: thin; }
.rank li, .dumb-list li { display: grid; grid-template-columns: 26px minmax(0, 1fr) 72px 64px; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.rank li:hover { background: var(--surface-2); }
.rank li.sel { background: var(--s1-wash); box-shadow: inset 3px 0 0 var(--s1); }
.rank li.nd { color: var(--muted); cursor: default; }
.rank li.more-nd { grid-template-columns: 26px 1fr; font-size: 12px; }
.r-i { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; text-align: right; }
.r-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
li.nd .r-val { font-weight: 400; font-size: 12px; }
.dumb-rank li { grid-template-columns: 26px minmax(0, 1fr) 92px 58px; }
.dumb-list { list-style: none; padding: 0; margin: 8px -8px 0; }
.dumb-list li { grid-template-columns: 4px 62px minmax(0, 1fr) 62px; cursor: default; }

.range { position: relative; height: 14px; display: block; }
.range::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--grid); border-radius: 2px; }
.range .rb { position: absolute; top: 4px; height: 6px; background: var(--s1-band); border-radius: 99px; }
.range .rm { position: absolute; top: 2px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--s1); box-shadow: 0 0 0 2px var(--surface); }

.dumb { position: relative; height: 14px; display: block; }
.dumb::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--grid); border-radius: 2px; }
.dumb i { position: absolute; display: block; }
.dumb .dl { top: 5px; height: 4px; background: var(--axis); border-radius: 2px; }
.dumb .dw, .dumb .dm { top: 2px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.dumb .dw { background: var(--s2); }
.dumb .dm { background: var(--s1); }
.dumb-key { display: flex; align-items: center; gap: 6px; }
.dumb-key i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dumb-key i + span { margin-right: 6px; }
.k-w { background: var(--s2); }
.k-m { background: var(--s1); }

/* ---------- teasers ---------- */
.teaser { display: flex; flex-direction: column; }
.teaser-big { font-size: 34px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.teaser-text { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.cta { align-self: flex-start; margin-top: 12px; border: 0; background: var(--s1-wash); color: var(--text); font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 9px; }
.cta:hover { background: var(--s1-band); }
.mini-list { list-style: none; padding: 0; margin: 0 -8px; }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.mini-list li:hover { background: var(--surface-2); }
.mini-list .mi-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mini-list b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- gender gap ---------- */
.gap-hero { gap: 6px; }
.gap-sentence { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.015em; margin-top: 4px; text-wrap: balance; }
.gap-sentence b { font-weight: 750; }
.gbars { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 6px; }
.gbar { display: grid; grid-template-columns: 52px minmax(0, 1fr) 76px; align-items: center; gap: 10px; font-size: 13px; }
.gbar-l { color: var(--text-2); }
.gbar-t { height: 14px; background: var(--surface-2); border-radius: 99px; overflow: hidden; display: block; }
.gbar-t i { display: block; height: 100%; border-radius: 99px; }
.gbar-w i { background: var(--s2); }
.gbar-m i { background: var(--s1); }
.gbar b { text-align: right; font-variant-numeric: tabular-nums; }
.gap-coin { font-size: 14px; color: var(--text); margin-top: 4px; }
.gap-day { font-size: 13.5px; color: var(--text-2); }
.share-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: auto; padding-top: 14px; }
.share-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; padding: 8px 14px; background: var(--s2); color: #fff; font-weight: 600; font-size: 13.5px; }
.share-btn:hover { filter: brightness(1.06); }
.share-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pd-gap { font-size: 18px; font-weight: 600; line-height: 1.3; }
.note-card h2 { font-size: 15px; font-weight: 650; margin-bottom: 8px; }
.note-card p { color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.foot-note { color: var(--muted); font-size: 11.5px; margin-top: 8px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th.num { text-align: right; }
table.data th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
table.data th button:hover { color: var(--text); }
table.data th button[data-dir]::after { content: " ↓"; }
table.data th button[data-dir="1"]::after { content: " ↑"; }
table.data td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.strong { font-weight: 600; }
table.data .nd { color: var(--muted); font-size: 12px; }
table.data td.muted { color: var(--muted); }
.pos-table .col-range { width: 30%; min-width: 110px; }
.pos-table td.col-name, .gp-table td.col-name { max-width: 0; width: 46%; }
.pname { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pname sup { color: var(--muted); margin-left: 2px; }
.range-cell { display: flex; flex-direction: column; gap: 2px; }
.range-cell small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
tbody tr[data-pos], tbody tr[data-g] { cursor: pointer; }
tbody tr[data-pos]:hover td, tbody tr[data-g]:hover td { background: var(--surface-2); }
tbody tr.sel td { background: var(--s1-wash); }
tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--s1); }
.gp-table tr.low td { color: var(--text-2); }
.pos-empty { color: var(--muted); text-align: center; padding: 18px !important; }
.more-btn { margin-top: 10px; width: 100%; border: 1px dashed var(--border); background: transparent; border-radius: 10px; padding: 7px; color: var(--text-2); font-size: 13px; }
.more-btn:hover { background: var(--surface-2); color: var(--text); }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 0 10px; height: 36px; margin-bottom: 8px; }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; }
.search:focus-within { border-color: var(--s1); }
.table-view { max-height: 420px; overflow: auto; }
.table-view table.data { font-size: 12.5px; }

/* ---------- positions tab ---------- */
.pl-card { position: sticky; top: calc(var(--tabs-h) + 76px); }
.pl-scroll { max-height: calc(100vh - var(--tabs-h) - 250px); min-height: 300px; overflow-y: auto; }
.pd-name { font-size: 26px; font-weight: 650; letter-spacing: -.015em; margin-top: 2px; }
.pd-kpis { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr .8fr; gap: 12px; margin-top: 14px; }
.pd-big { font-size: 34px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.pd-head .strip { margin-top: 26px; }

/* ---------- districts tab & facts ---------- */
.ok-table td:first-child { font-weight: 500; }
.facts { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.facts li { font-size: 14px; color: var(--text-2); padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.facts li:last-child { border-bottom: 0; }
.facts b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- comparison ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 12px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface-2); font-size: 13px; font-weight: 500; }
.chip i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.chip button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; font-size: 15px; line-height: 1; }
.chip button:hover { background: var(--border); color: var(--text); }
.chip-add select { height: 32px; border: 1px dashed var(--border); border-radius: 99px; background: transparent; padding: 0 12px; color: var(--text-2); appearance: none; -webkit-appearance: none; cursor: pointer; }
.cmp-table th:not(:first-child), .cmp-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.cmp-table th .key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.cmp-table th { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--text); }
.cmp-table td:first-child { color: var(--text-2); }
.cmp-table tr.strong td { font-weight: 650; font-size: 14px; }
#ch-cmp-cat { height: 360px; }
#ch-cmp-trend, #ch-cmp-age { height: 260px; }

/* ---------- tooltip ---------- */
.tt { font: 12px/1.45 var(--font); color: var(--text); min-width: 150px; }
.tt-title { font-weight: 600; margin-bottom: 4px; }
.tt-sub { color: var(--muted); margin-bottom: 4px; }
.tt-row { display: flex; align-items: center; gap: 8px; }
.tt-row b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tt-row span { color: var(--text-2); }
.tt-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tt-key.dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- toast & footer ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.foot { border-top: 1px solid var(--border); padding: 22px 0 40px; color: var(--text-2); font-size: 13px; }
.foot h2 { font-size: 13px; font-weight: 650; color: var(--text); margin-bottom: 6px; }
.foot p { max-width: 900px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid > .hero, .kpi-grid > .tiles { grid-column: span 12; }
  .g-8-4 > :nth-child(1), .g-8-4 > :nth-child(2) { grid-column: span 12; }
  .rank { max-height: 360px; }
  .g-6-3-3 > :nth-child(1) { grid-column: span 12; }
  .g-6-3-3 > :nth-child(2), .g-6-3-3 > :nth-child(3) { grid-column: span 6; }
  .g-5-7 > *, .g-7-5 > * { grid-column: span 12 !important; }
  .pl-card { position: static; }
  .pl-scroll { max-height: 420px; }
}
@media (max-width: 860px) {
  .g-6-6 > * { grid-column: span 12 !important; }
  .filters { position: static; }
}
@media (max-width: 640px) {
  :root { --tabs-h: 44px; }
  .wrap { padding: 0 16px; }
  .grid, .view, .stack { gap: 12px; }
  .card { padding: 14px; border-radius: 12px; }
  .g-6-3-3 > :nth-child(2), .g-6-3-3 > :nth-child(3) { grid-column: span 12; }
  .kpi-grid > .tiles { gap: 12px; }
  .hero-value { font-size: 44px; }
  .tile-value { font-size: 21px; }
  .tile-value.small { font-size: 18px; }
  .tabs button { padding: 0 10px; font-size: 13.5px; }
  .filters-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; }
  .filters-inner > .field[data-f="age"] { grid-column: 1 / -1; grid-row: 3; }
  .filters-inner > .link-btn { grid-column: 1 / -1; height: 22px; justify-self: start; }
  .field, .field select, .field-wide select { min-width: 0; width: 100%; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 0 2px; font-size: 12.5px; }
  .seg-sm { width: auto; }
  .hero-head { flex-direction: column; gap: 6px; }
  .delta { text-align: left; padding-top: 0; }
  .chart-map { height: 230px; }
  .map-legend .ramp i { width: 80px; }
  .map-legend { gap: 8px 14px; font-size: 11.5px; }
  .strip-legend dd { font-size: 12px; }
  .top-inner { align-items: flex-start; }
  h1 { font-size: 18px; }
  .sub { font-size: 12px; }
  .rank li { grid-template-columns: 24px minmax(0, 1fr) 64px 60px; }
  .dumb-rank li { grid-template-columns: 24px minmax(0, 1fr) 78px 54px; }
  .pos-table .col-range, .pos-table td:nth-child(3), .col-nwm { display: none; }
  .pos-table td.col-name, .gp-table td.col-name { width: auto; max-width: none; }
  .pname { white-space: normal; }
  .calc-input input { width: 100px; }
  .gap-sentence { font-size: 24px; }
  .pd-kpis { grid-template-columns: 1fr 1fr; }
  .pd-name { font-size: 22px; }
  .card-head { flex-wrap: wrap; }
}
