/* Recsys prehľad, design v3.
   Always light (Peter: white page, also when the OS is dark). Neutral greys, one blue for data,
   last year = neutral grey dashed on the same axis. No gradients, no warm tones. System font. */
:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --soft: #f7f8fa;          /* quiet fills: table hover, callouts, code */
  --ink: #111827;           /* 17.7:1 on white */
  --ink-2: #4b5563;         /* 7.6:1 */
  --muted: #6b7280;         /* 4.8:1 */
  --faint: #9ca3af;         /* decorative only */
  --line: #e7e9ee;
  --line-2: #f0f2f5;
  --grid: #eef0f3;
  --axis: #d5d9e0;
  --series: #2a78d6;        /* data marks */
  --series-ink: #1d5fb3;    /* blue text: 6.1:1 */
  --series-soft: #e8f1fc;
  --series-tint: #f3f8fe;
  --prev: #a1a8b3;
  --good: #067647;
  --good-bg: #ecfdf3;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  --shadow-1: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 3px rgba(17, 24, 39, 0.03);
  --shadow-2: 0 12px 32px rgba(17, 24, 39, 0.10), 0 2px 6px rgba(17, 24, 39, 0.05);
  --r: 14px;
  --r-sm: 9px;
}

* { box-sizing: border-box; }
html, body { background: var(--page); }
body { margin: 0; color: var(--ink); font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0; }
h1 { font-size: 15px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 2px; font-weight: 640; letter-spacing: -0.015em; line-height: 1.35; }
h3 { font-size: 14px; margin: 0 0 6px; font-weight: 620; }
.sub, .hint, .note { color: var(--muted); margin: 2px 0 0; font-size: 13px; }
.hint { margin-bottom: 14px; max-width: 76ch; }
button { font: inherit; color: inherit; }
code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--series); outline-offset: 2px; border-radius: 4px; }

/* ---------- frame ---------- */
.layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px 22px; }
.mark { width: 32px; height: 32px; border-radius: 9px; background: var(--series-ink); color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 15px; flex: none; letter-spacing: -0.02em; }
.brand .sub { font-size: 12px; margin-top: 0; }
.pages { display: flex; flex-direction: column; gap: 2px; margin-bottom: 22px; }
.pages button { display: flex; align-items: center; gap: 11px; text-align: left; background: none; border: 0; border-radius: var(--r-sm); padding: 8px 10px; cursor: pointer; color: var(--ink-2); font-weight: 520; transition: background 0.12s, color 0.12s; }
.pages button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; color: var(--faint); transition: color 0.12s; }
.pages button:hover { background: var(--soft); color: var(--ink); }
.pages button[aria-current="page"] { background: var(--series-tint); color: var(--series-ink); }
.pages button[aria-current="page"] svg { color: var(--series); }
.subpages { display: flex; flex-direction: column; gap: 1px; margin: 0 0 4px 18px; padding-left: 9px; border-left: 1px solid var(--line); }
.pages .subpages button { padding: 6px 10px; font-size: 13px; font-weight: 500; }
.pages button.in-section { color: var(--ink); font-weight: 600; }   /* "Produkty" while one of its pages is open */
.pages button.in-section svg { color: var(--series); }
.sub-off { display: none !important; }
/* menu groups use the same labels as the cards, so "Odporúčania" / "Celý e-shop" read the same everywhere */
.side-group { display: block; padding: 12px 6px 4px; }
.side-group .scope { margin: 0; font-size: 13.5px; font-weight: 700; padding: 4px 12px; }
.side-group .scope-all { color: var(--ink); background: #eceef2; }
.subpages .side-group:first-child { padding-top: 6px; }
.side-label { font-size: 11px; color: var(--muted); padding: 0 10px; margin: 0 0 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.search { display: block; position: relative; }
.search input { width: 100%; font: inherit; font-size: 13px; color: var(--ink); background: var(--soft); border: 1px solid transparent; border-radius: var(--r-sm); padding: 8px 10px 8px 32px; margin-bottom: 6px; transition: border-color 0.12s, background 0.12s; }
.search::before { content: ""; position: absolute; left: 11px; top: 11px; width: 10px; height: 10px; border: 1.6px solid var(--faint); border-radius: 50%; }
.search::after { content: ""; position: absolute; left: 21px; top: 21px; width: 5px; height: 1.6px; background: var(--faint); transform: rotate(45deg); }
.search input:focus { outline: none; background: var(--surface); border-color: var(--series); box-shadow: 0 0 0 3px var(--series-soft); }
.group-title { font-size: 11px; color: var(--muted); margin: 16px 10px 4px; display: flex; justify-content: space-between; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.client-list { list-style: none; margin: 0; padding: 0; }
.client-btn { width: 100%; display: flex; align-items: center; gap: 9px; background: none; border: 0; border-radius: 8px; padding: 6px 10px; cursor: pointer; text-align: left; transition: background 0.1s; }
.client-btn:hover { background: var(--soft); }
.client-btn .s-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--axis); flex: none; }
.client-list[data-group="active"] .s-dot { background: var(--series); }
.client-btn[aria-current="true"] { background: var(--series-tint); box-shadow: inset 0 0 0 1px var(--series-soft); }
.client-btn[aria-current="true"] .client-name { color: var(--series-ink); font-weight: 620; }
.client-btn[aria-current="true"] .client-val { color: var(--series-ink); }
.client-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; color: var(--ink); }
.client-val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.main { padding: 0 36px 64px; min-width: 0; max-width: 1280px; }
.top { position: sticky; top: 0; z-index: 6; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between;
  margin: 0 -36px 24px; padding: 22px 36px 18px; background: rgba(255, 255, 255, 0.94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--series-ink); }
.top h2 { font-size: 28px; margin: 0; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.top .sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.top-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.filters select { appearance: none; -webkit-appearance: none; font: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 560; color: var(--ink); background: var(--surface) 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='%236b7280' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 34px 8px 12px; min-width: 180px; box-shadow: var(--shadow-1); cursor: pointer; }
.filters select:focus { outline: none; border-color: var(--series); box-shadow: 0 0 0 3px var(--series-soft); }
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 13px; font-size: 13px; font-weight: 560; cursor: pointer; box-shadow: var(--shadow-1); color: var(--ink-2); transition: background 0.12s; }
.btn:hover { background: var(--soft); color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 540; border-radius: 999px; padding: 2px 10px; color: var(--ink-2); background: var(--soft); }
.badge.ok { color: var(--series-ink); background: var(--series-tint); }
.badge.ok::before, .badge.off::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--series); }
.badge.off::before { background: var(--faint); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 24px; margin-bottom: 20px; min-width: 0; box-shadow: var(--shadow-1); }
.card-head { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: space-between; align-items: flex-start; }
.card > h2:first-child, .card-head h2 { margin-bottom: 3px; }
.stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 18px; margin-bottom: 2px; }
.stats .card { margin-bottom: 18px; position: relative; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.stats.three .card { padding-bottom: 20px; }
.stats.three { grid-template-columns: 1.4fr 1fr 1fr; }
body.client-mode .stats { grid-template-columns: 1.4fr 1fr 1fr; }   /* no reach tile for clients */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.label { font-size: 13px; color: var(--ink-2); font-weight: 540; letter-spacing: -0.005em; }
.hero .label { color: var(--ink); }
.hero-value { font-size: 44px; font-weight: 720; line-height: 1.05; margin-top: 12px; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.tile-value { font-size: 32px; font-weight: 700; margin-top: 12px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.delta { margin-top: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.delta-yoy { margin-top: 2px; }
.delta .up, .delta .down { display: inline-block; font-weight: 640; font-size: 12px; border-radius: 999px; padding: 1px 8px; margin-right: 5px; font-variant-numeric: tabular-nums; }
.delta .up { color: var(--good); background: var(--good-bg); }
.delta .down { color: var(--bad); background: var(--bad-bg); }
.note { line-height: 1.5; }
.spark { margin: auto -24px 0; padding-top: 16px; height: 62px; }
.spark svg { display: block; width: 100%; height: 46px; overflow: visible; }
.spark .s-line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .s-area { fill: var(--series-soft); opacity: 0.85; }
.spark .s-dot { fill: var(--surface); stroke: var(--series); stroke-width: 2; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.callout { border: 1px solid var(--line); padding: 11px 14px 11px 38px; margin: 14px 0 0; color: var(--ink-2); font-size: 13px; background: var(--soft); border-radius: var(--r-sm); box-shadow: none; position: relative; line-height: 1.55; }
.callout::before { content: "i"; position: absolute; left: 13px; top: 12px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--muted); color: var(--muted); font: 700 10px/13px system-ui; text-align: center; }
#products-warn .callout { margin: 0 0 16px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--series-ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; font-weight: 560; }

/* summary card */
.summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; background: var(--series-tint); border-color: var(--series-soft); box-shadow: none; }
.summary .s-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface); border: 1px solid var(--series-soft); display: grid; place-items: center; color: var(--series); }
.summary .s-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.summary h2 { font-size: 14px; color: var(--series-ink); margin-bottom: 4px; }
.summary p { margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--ink); max-width: 95ch; }
.summary b { font-weight: 650; }

/* segmented control, legend, comparison, tabs */
.seg { display: inline-flex; background: var(--soft); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { background: transparent; border: 0; padding: 5px 13px; font-size: 13px; font-weight: 560; cursor: pointer; color: var(--muted); border-radius: 7px; transition: background 0.12s, color 0.12s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12.5px; color: var(--ink-2); margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 20px; height: 0; border-top: 2.5px solid var(--series); border-radius: 2px; }
.legend i.lg-prev { border-top: 2px dashed var(--prev); }
.compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.compare > div { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.compare > div:first-child { background: var(--series-tint); border-color: var(--series-soft); }
.compare .label { font-size: 12px; color: var(--muted); }
.compare .c-val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -0.02em; }
.compare .c-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.diff-up { color: var(--good); font-weight: 640; }
.diff-down { color: var(--bad); font-weight: 640; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.tabs button { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; font-size: 13px; font-weight: 520; cursor: pointer; color: var(--ink-2); transition: background 0.12s, border-color 0.12s; }
.tabs button:hover { background: var(--soft); }
.tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* widget cards */
.wcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 4px 0 6px; }
.wcard { border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 14px; position: relative; background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s; }
.wcard:hover { border-color: var(--axis); box-shadow: var(--shadow-1); }
.wcard .w-name { font-weight: 620; font-size: 14px; line-height: 1.35; padding-right: 8px; }
.wcard .w-model { display: inline-block; margin-top: 5px; font: 11.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2); background: var(--soft); border-radius: 5px; padding: 1px 6px; }
.wcard .w-rev { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; margin-top: 12px; font-variant-numeric: tabular-nums; }
.wcard .w-share { font-size: 12.5px; color: var(--muted); }
.wcard .w-bar { height: 6px; border-radius: 3px; background: var(--grid); margin: 8px 0 12px; overflow: hidden; }
.wcard .w-bar i { display: block; height: 100%; background: var(--series); border-radius: 3px; }
.wcard .w-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.wcard .w-metrics div { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard .w-metrics b { display: block; font-size: 14px; color: var(--ink); font-weight: 640; font-variant-numeric: tabular-nums; margin-top: 1px; }
.wcard.is-best { border-color: #b7e4c7; }
.wcard.is-worst { border-color: #f5c6c2; }
.wcard .w-flag { display: inline-block; margin-top: 8px; font-size: 11px; font-weight: 640; border-radius: 999px; padding: 1px 8px; }
.wcard.is-best .w-flag { color: var(--good); background: var(--good-bg); }
.wcard.is-worst .w-flag { color: var(--bad); background: var(--bad-bg); }

/* ---------- charts ---------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .track { fill: var(--line-2); }
.chart .bar { fill: var(--series); cursor: pointer; transition: opacity 0.12s; }
.chart .bar.partial { fill: var(--series); opacity: 0.32; }
.chart .bar.sel { fill: var(--series-ink); }
.chart .bar:hover, .chart .bar:focus { opacity: 0.8; outline: none; }
.chart .bar.partial:hover { opacity: 0.25; }
.chart .x-label.selected { fill: var(--ink); font-weight: 650; }
.chart .value-label { fill: var(--ink); font-size: 12px; font-weight: 650; }
.chart .row-label { fill: var(--ink); font-size: 13px; font-weight: 520; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-soft); opacity: 0.6; }
.chart .line.prev { stroke: var(--prev); stroke-dasharray: 5 4; stroke-width: 2; }
.chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2.5; }
.chart .dot.partial { fill: var(--surface); stroke: var(--series); stroke-width: 2; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }

/* ---------- tables ---------- */
details > summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }
details { margin-top: 12px; }
details.card { margin-top: 0; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 12px; font-size: 13px; }
table.data th, table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); text-align: right; vertical-align: middle; }
table.data th:first-child, table.data td:first-child { text-align: left; padding-left: 8px; }
table.data td.name { text-align: left; min-width: 180px; }
table.data th { color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: 8px; padding-bottom: 9px; }
table.data td { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
table.data td.name { white-space: normal; font-weight: 520; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background 0.08s; }
table.data tbody tr:hover td { background: var(--soft); }
table.data tbody tr:hover td:first-child { border-radius: 8px 0 0 8px; }
table.data tbody tr:hover td:last-child { border-radius: 0 8px 8px 0; }
table.data tr.selected td { font-weight: 650; background: var(--series-tint); }
table.data tr.total td { font-weight: 700; border-top: 1px solid var(--axis); background: var(--soft); }
table.data tbody tr.link { cursor: pointer; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink); }
table.data th[aria-sort] { color: var(--ink); }
table.data th[aria-sort="descending"]::after { content: " ↓"; }
table.data th[aria-sort="ascending"]::after { content: " ↑"; }
.rank { color: var(--faint); width: 30px; font-weight: 600; }
.cellbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.cellbar .track { width: 84px; display: flex; justify-content: flex-start; background: var(--line-2); border-radius: 4px; height: 7px; overflow: hidden; }
.cellbar i { display: block; height: 7px; border-radius: 4px; background: var(--series); min-width: 2px; }
.model { color: var(--muted); font: 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; }
.table-scroll { overflow-x: auto; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 560; border-radius: 999px; padding: 1px 9px; color: var(--ink-2); white-space: nowrap; background: var(--soft); }
tr[data-client] .pill { background: var(--soft); }
.warn { color: var(--bad); font-weight: 640; }

/* notes / methodology */
.notes ul, .possible ul { margin: 12px 0 0; padding-left: 0; list-style: none; color: var(--ink-2); font-size: 13.5px; }
.notes li, .possible li { margin-bottom: 9px; padding-left: 18px; position: relative; line-height: 1.6; }
.notes li::before, .possible li::before { content: ""; position: absolute; left: 3px; top: 0.7em; width: 5px; height: 5px; border-radius: 50%; background: var(--axis); }
details.method > summary { list-style: none; display: flex; align-items: center; gap: 10px; }
details.method > summary::-webkit-details-marker { display: none; }
details.method > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; margin-right: 2px; }
details.method[open] > summary::before { transform: rotate(45deg); }
details.method > summary h2 { display: inline; color: var(--ink); margin: 0; }
details.method > summary .hint { margin: 0; }
.tag { font-size: 10px; font-weight: 700; color: var(--ink-2); background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-right: 6px; letter-spacing: 0.03em; }
.possible h2 { margin-bottom: 8px; }

/* scope label in headings */
.scope { display: inline-block; vertical-align: 2px; margin-left: 8px; font-size: 11px; font-weight: 620; letter-spacing: 0.01em; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.scope-all { color: var(--ink-2); background: var(--soft); }
.scope-rec { color: var(--series-ink); background: var(--series-tint); }
.scope-mix { color: var(--series-ink); background: var(--surface); box-shadow: inset 0 0 0 1px #c9ddf6; }
.kpi-scope { margin: 7px 0 0; align-self: flex-start; }

/* widget table extras */
.explain { margin-top: 16px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.explain > summary { font-weight: 600; color: var(--series-ink); }
.defs { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 14px 0 4px; font-size: 13px; }
.defs dt { font-weight: 620; color: var(--ink); }
.defs dd { margin: 0; color: var(--ink-2); line-height: 1.55; }
.explain h3 { margin-top: 16px; }
.rank-badge { display: inline-block; margin-left: 8px; font-size: 10.5px; font-weight: 640; border-radius: 999px; padding: 1px 8px; vertical-align: 1px; white-space: nowrap; }
.rank-badge.best { color: var(--good); background: var(--good-bg); }
.rank-badge.worst { color: var(--bad); background: var(--bad-bg); }
.insight { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: -6px 0 14px; font-size: 13px; color: var(--ink-2); }
.insight b { color: var(--ink); font-weight: 640; }

/* best / worst products */
.bw-grid { gap: 24px; }
.bw-col h3 { display: flex; align-items: baseline; gap: 6px; font-size: 14px; margin-top: 6px; }
.bw-mark { font-size: 11px; }
.bw-mark.up { color: var(--good); }
.bw-mark.down { color: var(--bad); }
.bw-col table.data td.name { min-width: 140px; }
.bw-col .cellbar .track { width: 56px; }
.bw-col.worst table.data td.zero { color: var(--bad); font-weight: 640; }
@media (max-width: 1500px) { .bw-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; } }

.tooltip { position: fixed; pointer-events: none; z-index: 20; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-2); padding: 10px 12px; font-size: 13px; min-width: 160px; }
.tooltip .tt-value { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.tooltip .tt-label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- client-only layout (reachable by link, #…&view=client) ---------- */
body.client-mode [data-internal] { display: none !important; }
[data-client-only] { display: none !important; }
body.client-mode .layout { grid-template-columns: 256px minmax(0, 1fr); }
body.client-mode .brand { display: none; }
body.client-mode .side-project { display: block !important; padding: 2px 10px 18px; margin-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.side-project h1 { font-size: 19px; font-weight: 720; letter-spacing: -0.015em; line-height: 1.25; margin: 2px 0 3px; overflow-wrap: anywhere; }
.side-project .sub { font-size: 12.5px; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
body.client-mode .main { margin: 0 auto; width: 100%; }   /* auto margins alone make a grid item shrink to its content */

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats, .stats.three { grid-template-columns: 1fr 1fr; }
  .stats .hero { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; }
  .brand { padding-bottom: 12px; }
  body.client-mode .layout { grid-template-columns: minmax(0, 1fr); }
  body.client-mode .side-project { padding-bottom: 10px; margin-bottom: 8px; }
  body.client-mode .pages { margin-bottom: 0; }
  .pages { flex-direction: row; flex-wrap: wrap; margin-bottom: 12px; }
  .subpages { flex-basis: 100%; flex-direction: row; flex-wrap: wrap; margin: 2px 0 0; padding-left: 0; border-left: 0; }
  .subpages .side-group { flex-basis: 100%; padding: 6px 10px 0; }
  .client-scroll { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 4px; }
  .main { padding: 0 16px 44px; }
  .top { position: static; margin: 0 -16px 18px; padding: 16px; }
  .top h2 { font-size: 23px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .stats, .stats.three { grid-template-columns: minmax(0, 1fr); }
  .hero-value { font-size: 38px; }
  .cellbar .track { width: 44px; }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px; }
  .spark { margin: auto -18px 0; }
  .defs { grid-template-columns: minmax(0, 1fr); }
  .defs dd { margin-bottom: 6px; }
  .summary { grid-template-columns: minmax(0, 1fr); }
  .summary .s-icon { display: none; }
}

/* ---------- print / PDF ---------- */
@media print {
  @page { margin: 14mm; }
  body { font-size: 12px; }
  .layout { display: block; }
  .sidebar, .top-actions, .seg, .tabs, #go-product-month, #go-sold-month, .tooltip { display: none !important; }
  .top { position: static; margin: 0 0 16px; padding: 0 0 12px; backdrop-filter: none; }
  .main { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  details.method:not([open]) { display: none; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  body.client-mode .stats { grid-template-columns: repeat(3, 1fr); }
  .table-scroll { overflow: visible; }
}
#table-widgets td.name { min-width: 150px; }
#table-widgets .rank-badge { display: table; margin: 4px 0 0; }
#table-widgets th, #table-widgets td { padding-left: 10px; padding-right: 10px; }
#table-all .cellbar .track { width: 48px; }
#table-all th, #table-all td { padding-left: 9px; padding-right: 9px; }
#table-all td.name { min-width: 120px; }
#table-all td.name .pill { display: table; margin-top: 3px; font-size: 10.5px; font-weight: 560; }
#table-all .pill-active { color: var(--series-ink); background: var(--series-tint); }
#table-all { font-size: 12.5px; }
#table-all th, #table-all td { padding-left: 7px; padding-right: 7px; }
#table-all .cellbar { gap: 7px; }
#table-all .cellbar .track { width: 42px; }
@media (max-width: 1500px) { #products-body .grid-2 { grid-template-columns: minmax(0, 1fr); } }
#table-sold td.name.muted { font-weight: 450; font-size: 12.5px; min-width: 160px; }
