/* ===== Tokeny – Liftor Design System (Figma „Liftor | Design System“) =====
   Petrol = brand dark (text, tmavé plochy), Mint = brand accent (CTA, aktivní stav, petrolový text na mintu),
   Slate = neutrální s petrolovým podtónem, Gray = linky. Světlý režim je výchozí. */
:root {
  color-scheme: light;
  --page: #f5f5f5;            /* Slate/50 */
  --surface-1: #ffffff;       /* Base/white – karty */
  --surface-2: #edf3f6;       /* Slate/100 */
  --text-primary: #032a31;    /* Petrol/900 */
  --text-secondary: #5c7175;  /* Slate/600 */
  --text-muted: #7a9195;      /* Slate/500 */
  --grid: #ececec;            /* Gray/100 – divider */
  --baseline: #dcdcdc;        /* Gray/200 */
  --border: rgba(3, 42, 49, 0.08);
  --good: #00873c;            /* Success/600 */
  --bad: #c92928;             /* Error/600 */
  --good-bg: #e5ffe9;         /* Success/50 */
  --bad-bg: #fff4f2;          /* Error/50 */
  --accent: #1e5f6b;          /* Petrol/700 – odkazy, datové řady, aktivní prvky */
  --on-accent: #ffffff;
  --brand: #74f393;           /* Mint/300 – CTA, aktivní záložka */
  --on-brand: #032a31;
  --brand-dark: #032a31;      /* Petrol/900 */
  --hi: #00a84a;              /* Mint/500 – zvýraznění v grafech (na míru, židle) */
  --ghost: rgba(3, 42, 49, 0.05);
  --radius-card: 12px;
  --radius-input: 12px;
  --radius-pill: 999px;
  /* kategorické sloty — pevné pořadí, barva patří eshopu */
  --s-cz: #1e5f6b;
  --s-sk: #e79403;
  --s-hu: #00a84a;
  --s-de: #008ff4;
  --s-ro: #ed4b43;
  --s-dk: #928052;
  --s-pl: #7a5cd6;
  --deemph: #c4c4c4;
  /* ordinální petrolová rampa (Petrol/900 → 300) */
  --ord-1: #032a31;
  --ord-2: #0f424b;
  --ord-3: #1e5f6b;
  --ord-4: #2e7c8b;
  --ord-5: #4b99a9;
  --ord-6: #75b5c3;
  --ord-7: #9bd0dc;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #021c21;
    --surface-1: #032a31;     /* Petrol/900 – surface/contrast */
    --surface-2: #0f424b;     /* Petrol/800 */
    --text-primary: #ffffff;
    --text-secondary: #cdf5fe; /* text/contrast */
    --text-muted: #9bd0dc;     /* text/contrast-secondary */
    --grid: rgba(255, 255, 255, 0.08);
    --baseline: rgba(255, 255, 255, 0.18);
    --border: rgba(255, 255, 255, 0.10);
    --good: #7ae093;
    --bad: #ffada3;
    --good-bg: rgba(122, 224, 147, 0.14);
    --bad-bg: rgba(255, 173, 163, 0.14);
    --accent: #74f393;
    --on-accent: #032a31;
    --brand: #74f393;
    --on-brand: #032a31;
    --brand-dark: #032a31;
    --hi: #74f393;
    --ghost: rgba(255, 255, 255, 0.06);
    --s-cz: #75b5c3;
    --s-sk: #feb558;
    --s-hu: #74f393;
    --s-de: #5caeff;
    --s-ro: #ff7c70;
    --s-dk: #cdbe9a;
    --s-pl: #b8a6ff;
    --deemph: #47595c;
    --ord-1: #e8fbff;
    --ord-2: #b8e6ef;
    --ord-3: #9bd0dc;
    --ord-4: #75b5c3;
    --ord-5: #4b99a9;
    --ord-6: #2e7c8b;
    --ord-7: #1e5f6b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #021c21;
  --surface-1: #032a31;
  --surface-2: #0f424b;
  --text-primary: #ffffff;
  --text-secondary: #cdf5fe;
  --text-muted: #9bd0dc;
  --grid: rgba(255, 255, 255, 0.08);
  --baseline: rgba(255, 255, 255, 0.18);
  --border: rgba(255, 255, 255, 0.10);
  --good: #7ae093;
  --bad: #ffada3;
  --good-bg: rgba(122, 224, 147, 0.14);
  --bad-bg: rgba(255, 173, 163, 0.14);
  --accent: #74f393;
  --on-accent: #032a31;
  --brand: #74f393;
  --on-brand: #032a31;
  --brand-dark: #032a31;
  --hi: #74f393;
  --ghost: rgba(255, 255, 255, 0.06);
  --s-cz: #75b5c3;
  --s-sk: #feb558;
  --s-hu: #74f393;
  --s-de: #5caeff;
  --s-ro: #ff7c70;
  --s-dk: #cdbe9a;
  --s-pl: #b8a6ff;
  --deemph: #47595c;
  --ord-1: #e8fbff;
  --ord-2: #b8e6ef;
  --ord-3: #9bd0dc;
  --ord-4: #75b5c3;
  --ord-5: #4b99a9;
  --ord-6: #2e7c8b;
  --ord-7: #1e5f6b;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.5 "Aktiv Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }
code { font-size: 12px; background: var(--ghost); padding: 1px 4px; border-radius: 4px; }

/* ===== Brána (heslo) ===== */
.gate {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--page); z-index: 50;
}
.gate-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px; width: 320px; display: flex; flex-direction: column; gap: 12px;
}
.gate-card h1 { margin: 0; font-size: 18px; }
.gate-card p { margin: 0; color: var(--text-secondary); }
.gate-card input {
  font: inherit; padding: 8px 10px; border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--text-primary);
}
.gate-card button {
  font: inherit; font-weight: 600; padding: 8px 10px; border: none; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.gate-err { color: var(--bad); }

/* ===== Hlavička a filtry ===== */
.topbar {
  max-width: 1180px; margin: 0 auto; padding: 18px 20px 6px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.brand { font-size: 17px; font-weight: 700; }
.brand-mark { color: var(--accent); }
.updated { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 10px; }
.topbar-actions button {
  font: inherit; background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-secondary); padding: 4px 10px; cursor: pointer;
}
.topbar-actions button:hover { background: var(--ghost); }

.filters {
  max-width: 1180px; margin: 0 auto; padding: 8px 20px 16px;
  display: flex; align-items: end; gap: 16px; flex-wrap: wrap;
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.filters select {
  font: inherit; padding: 6px 8px; border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--surface-1); color: var(--text-primary); min-width: 150px;
}
.tabs { margin-left: auto; display: flex; gap: 4px; background: var(--ghost); border-radius: 10px; padding: 3px; }
.tabs button {
  font: inherit; border: none; background: none; color: var(--text-secondary);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 500;
}
.tabs button.active { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ===== Vlastní období ===== */
.range-toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.range-toggle-btn {
  font: inherit; font-size: 13px; padding: 6px 12px; border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--surface-1); color: var(--text-primary); cursor: pointer;
}
.range-toggle-btn.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.range-back-btn {
  font: inherit; font-size: 12.5px; padding: 5px 10px; border: none; background: none;
  color: var(--accent); cursor: pointer; text-decoration: underline;
}
.range-panel { display: flex; flex-direction: column; gap: 12px; }
.range-row { display: flex; gap: 16px; flex-wrap: wrap; }
.range-row.hidden { display: none; }
.range-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.range-row input, .range-row select {
  font: inherit; padding: 6px 8px; border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--text-primary);
}
.range-actions { display: flex; justify-content: flex-end; }
.range-actions button.primary {
  font: inherit; font-weight: 600; padding: 8px 16px; border: none; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.range-actions button.primary:disabled { opacity: 0.6; cursor: default; }
.legend .key-line.dashed { background: none !important; border-top: 2px dashed var(--text-muted); height: 0; }

/* ===== Karty a mřížka ===== */
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 15px; }
.card .sub { margin: 0 0 14px; color: var(--text-muted); font-size: 12px; }
.note { color: var(--text-muted); font-size: 12.5px; }
.warn-note { color: var(--text-secondary); font-size: 12.5px; background: var(--ghost); border-radius: 8px; padding: 8px 10px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.kpi .k-label { font-size: 12px; color: var(--text-secondary); }
.kpi .k-value { font-size: 26px; font-weight: 600; margin-top: 2px; }
.kpi .k-value.hero { font-size: 34px; }
.kpi .k-delta { font-size: 12px; margin-top: 2px; color: var(--text-muted); }
.kpi .k-delta .up { color: var(--good); }
.kpi .k-delta .down { color: var(--bad); }
.kpi .k-note { font-size: 12px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); color: var(--text-secondary); }

/* ===== Tabulky ===== */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; }
th:first-child, td:first-child { text-align: left; }
td { font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 1px solid var(--baseline); }
tr:hover td { background: var(--ghost); }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text-primary); }
th.sortable.sorted { color: var(--text-primary); font-weight: 700; }
.delta-up { color: var(--good); font-variant-numeric: tabular-nums; }
.delta-down { color: var(--bad); font-variant-numeric: tabular-nums; }
.anom { font-weight: 700; text-decoration: underline dotted; text-underline-offset: 3px; }
.anom-cell { cursor: help; }
.cmp-pick { font-size: 12.5px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.cmp-pick select { font: inherit; padding: 4px 8px; border: 1px solid var(--baseline); border-radius: 8px; background: var(--surface-1); color: var(--text-primary); }

/* tabulky s pevnou šířkou sloupců (řazení nerozhazuje layout) */
table.fixed { table-layout: fixed; min-width: 760px; }
table.fixed td, table.fixed th { overflow: hidden; text-overflow: ellipsis; }

/* matice eshopy × měsíce */
table.matrix { border-collapse: separate; border-spacing: 0; }
table.matrix td, table.matrix th {
  padding: 5px 9px; font-size: 12.5px;
  border-bottom: 1px solid var(--grid);
  border-right: 1px solid var(--grid);
}
.matrix-wrap { max-height: 70vh; overflow: auto; }
table.matrix thead th {
  position: sticky; top: 0; z-index: 3;
  border-bottom: 2px solid var(--baseline); background: var(--page);
  font-weight: 700; color: var(--text-primary);
}
table.matrix thead th.m-ent { left: 0; z-index: 4; background: var(--page); }
table.matrix thead th.m-met { left: 128px; z-index: 4; background: var(--page); }
table.matrix .m-ent {
  position: sticky; left: 0; z-index: 2; background: var(--surface-1);
  text-align: left; min-width: 128px; width: 128px; max-width: 128px;
  font-weight: 600; vertical-align: top; border-right: 1px solid var(--grid);
}
table.matrix .m-flag { margin-right: 6px; }
table.matrix .m-met {
  position: sticky; left: 128px; z-index: 2; background: var(--surface-1);
  text-align: left; min-width: 118px; width: 118px; max-width: 118px;
  color: var(--text-secondary); font-size: 12px;
  border-right: 2px solid var(--baseline);
}
table.matrix tbody tr.kp-row td { background: var(--surface-2); }
table.matrix tbody tr.kp-row td.m-ent, table.matrix tbody tr.kp-row td.m-met { background: var(--surface-1); }
table.matrix tbody tr.grp-start td { border-top: 2px solid var(--baseline); }
table.matrix tbody tr:hover td { background: var(--surface-2); }
table.matrix tbody tr:hover td.m-ent, table.matrix tbody tr:hover td.m-met,
table.matrix tbody tr.kp-row:hover td.m-ent, table.matrix tbody tr.kp-row:hover td.m-met { background: var(--surface-1); }
table.matrix td { min-width: 62px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: baseline; }
.muted { color: var(--text-muted); }
button.linky {
  font: inherit; font-size: 12.5px; background: none; border: none; color: var(--accent);
  cursor: pointer; padding: 0;
}

/* ===== Grafy ===== */
.chart svg { display: block; width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 2px; font-size: 12.5px; color: var(--text-secondary); }
.legend .item { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: none; background: none; font: inherit; color: inherit; padding: 0; }
.legend .item.off { opacity: 0.35; }
.legend .key-line { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.legend .key-rect { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.seg { display: inline-flex; flex-wrap: wrap; background: var(--ghost); border-radius: 8px; padding: 2px; margin-left: 10px; }
.seg button { font: inherit; font-size: 12px; border: none; background: none; color: var(--text-secondary); padding: 3px 10px; border-radius: 6px; cursor: pointer; }
.seg button.active { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.card-head > div:first-child { flex: 1 1 260px; min-width: 0; }
.card-head .seg { margin-left: auto; flex: 0 0 auto; }
.card-head .seg-group { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.card-head .seg-group .seg { margin-left: 0; }
.daily-cmp { align-items: center; margin: 10px 0 4px; }
.cd { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; white-space: normal; }
.cd .delta-up, .cd .delta-down { font-size: 11.5px; }

/* ===== Tooltip ===== */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.16); padding: 8px 12px; font-size: 12.5px;
  max-width: 320px;
}
.tooltip .tt-title { color: var(--text-muted); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tooltip .tt-val { font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; }
.tooltip .tt-name { color: var(--text-secondary); }

.foot { max-width: 1180px; margin: 0 auto; padding: 0 20px 30px; color: var(--text-muted); font-size: 12px; }
[hidden] { display: none !important; }

/* GA-only podřádky (rozpad Liftor.de) */
tr.subrow td { color: var(--text-secondary); }
td.subrow-label { padding-left: 26px; font-size: 12.5px; }

/* týdenní / měsíční report */
.rep-h { margin: 14px 0 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.rep-p { margin: 10px 0; max-width: 860px; line-height: 1.6; }
.rep-tldr { list-style: none; margin: 6px 0 4px; padding: 0; max-width: 900px; }
.rep-tldr li {
  margin: 8px 0; padding: 9px 14px; line-height: 1.5;
  background: var(--ghost); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
}
.rep-list { list-style: none; margin: 4px 0; padding: 0; max-width: 900px; }
.rep-list li {
  margin: 0; padding: 8px 2px 8px 18px; line-height: 1.55; position: relative;
  border-bottom: 1px solid var(--grid);
}
.rep-list li:last-child { border-bottom: none; }
.rep-list li::before { content: "▸"; position: absolute; left: 0; color: var(--text-muted); }
.rep-sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.rep-badge {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; background: var(--ghost); white-space: nowrap;
}
.rep-heading { font-size: 15px; font-weight: 700; }
.rep-sec { border-left: 3px solid var(--baseline); }
.rep-sec.aud-mgmt { border-left-color: var(--s-cz); }
.rep-sec.aud-ecom { border-left-color: var(--s-hu); }
.rep-sec.aud-mkt { border-left-color: var(--s-sk); }
.rep-watch { list-style: none; margin: 6px 0 2px; padding: 0; max-width: 900px; }
.rep-watch li { margin: 7px 0; padding-left: 26px; position: relative; line-height: 1.5; }
.rep-watch li::before { content: "☐"; position: absolute; left: 2px; color: var(--text-muted); font-size: 15px; }

table.rep-table { max-width: 900px; margin: 4px 0 10px; }
table.rep-table th { font-size: 11.5px; }
table.rep-table td, table.rep-table th { padding: 6px 12px; }

/* report v2 — celkový stav, země, anomálie */
.ov-status { display: inline-block; margin-top: 8px; font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 999px; background: var(--ghost); }
.st-ok { color: var(--good); }
.st-watch { color: #a97400; }
:root[data-theme="dark"] .st-watch { color: #e0a835; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .st-watch { color: #e0a835; } }
.st-problem { color: var(--bad); }
.ov-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0 6px; max-width: 900px; }
.ov-kpi { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.ov-kpi-val { font-size: 21px; font-weight: 700; margin-top: 1px; }
td.wrap, th.wrapcol { white-space: normal; text-align: left; line-height: 1.45; min-width: 260px; }
.rep-anoms { list-style: none; margin: 6px 0 2px; padding: 0; max-width: 900px; }
.rep-anoms li { margin: 8px 0; padding: 9px 12px 9px 12px; background: var(--ghost); border-radius: 8px; line-height: 1.5; display: flex; gap: 10px; align-items: baseline; color: var(--text-primary); }
.rep-anoms .anom-ic { flex: none; }

/* Filtr kanálů (Zdroje) */
.chips-card { padding: 12px 16px; }
.chips-card .sub { margin: 0 0 8px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chips .chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.filter-chips .chip:hover { border-color: var(--text-muted); }
.filter-chips .chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ===== SEO záložka ===== */
th.left, td.left { text-align: left; }
.seo-btn {
  font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border: none; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.seo-loading::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--baseline); border-top-color: var(--accent); border-radius: 50%;
  animation: seo-spin .8s linear infinite;
}
@keyframes seo-spin { to { transform: rotate(360deg); } }
tr.seo-click { cursor: pointer; }
.seo-gray { color: var(--text-muted); opacity: .75; }
.seo-warn-txt { color: var(--bad); font-weight: 600; }
.seo-src { color: var(--s-sk); font-weight: 700; margin-left: 1px; }
.seo-count { color: var(--text-muted); font-size: 12px; }
.seo-caret, .seo-linkbtn { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; }
.seo-caret { color: var(--text-muted); font-size: 11px; width: 14px; text-align: center; }
.seo-linkbtn { text-align: left; }
.seo-linkbtn:hover { text-decoration: underline; }
.seo-caret:focus-visible, .seo-linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.seo-gapnote { color: var(--text-muted); }
.seo-spark { display: inline-block; vertical-align: middle; }
.seo-bands { display: inline-flex; align-items: center; gap: 8px; }
.seo-bandbar { display: inline-flex; width: 90px; height: 10px; border-radius: 3px; overflow: hidden; background: var(--ghost); }
.seo-bandbar > span { display: block; height: 100%; }
.seo-bandtxt { font-size: 12px; color: var(--text-secondary); }
.seo-kpi-bands { display: grid; grid-template-columns: repeat(auto-fit, minmax(66px, 1fr)); gap: 2px 10px; margin-top: 8px; font-size: 13px; }
.seo-kpi-bands .swatch { margin-right: 5px; }
.seo-flags { white-space: normal !important; }
.seo-flag {
  display: inline-block; font-size: 11px; line-height: 1.3; padding: 1px 7px; margin: 1px 4px 1px 0;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); white-space: nowrap;
}
.seo-flag.warn { border-color: var(--bad); color: var(--bad); background: none; font-weight: 600; }
/* KW tabulka: první sloupec drží při horizontálním scrollu */
table.seo-kw { min-width: 1390px; }
table.seo-kw > thead > tr > th:first-child, table.seo-kw > tbody > tr > td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface-1); }
table.seo-kw > tbody > tr:hover > td:first-child, table.seo-kw > tbody > tr.open > td:first-child { background: var(--surface-2); }
table.seo-kw > tbody > tr.open > td { background: var(--ghost); }
table.seo-ov { min-width: 870px; }
tr.seo-exp > td { white-space: normal; text-align: left; padding: 10px 10px 16px; background: var(--surface-1) !important; }
tr.seo-exp > td:first-child { position: static; }
.seo-exp-inner { position: sticky; left: 10px; width: min(1076px, calc(100vw - 104px)); }
table.seo-urls { width: auto; min-width: 0; margin-bottom: 8px; }
table.seo-urls td, table.seo-urls th { font-size: 12.5px; padding: 4px 10px; }
table.seo-urls td:first-child { max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
table.seo-top10-t td.seo-top10-title { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.seo-top10-t tr.seo-ours td { background: var(--ghost); font-weight: 600; }
table.seo-top10-t tr.seo-ours td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.seo-new { color: var(--accent); font-weight: 600; }
.seo-notes { margin: 6px 0 4px; padding-left: 18px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.seo-kwchart { max-width: 900px; }
.tooltip .tt-upd { margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; display: inline; }
details.card > summary::before { content: "▸"; color: var(--text-muted); font-size: 12px; }
details.card[open] > summary::before { content: "▾"; }
details.card[open] > summary { margin-bottom: 10px; }
details.card > summary .sub { margin: 0; }
.seo-rep-body > .card { border: none; padding: 6px 0; margin: 0; background: none; }
.seo-sources a { color: var(--accent); }
@media (max-width: 640px) {
  /* 5 záložek se na úzký displej nevejdou – zalomí se uvnitř lišty (žádný horizontální scroll stránky) */
  .tabs { margin-left: 0; flex-wrap: wrap; max-width: 100%; }
  .tabs button { padding: 6px 10px; }
  .card-head .seg { flex: 0 1 auto; max-width: 100%; margin-left: 0; }
  .card select { max-width: 100%; }
}

/* ===== Produkty (BI) ===== */
.bi-sentinel { height: 1px; }
.bi-toolbar { position: sticky; top: 0; z-index: 20; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px;
  transition: padding .15s, box-shadow .15s; }
.bi-toolbar.stuck {
  padding: 8px 14px; gap: 6px; border-radius: 0 0 12px 12px;
  background: color-mix(in srgb, var(--surface-1) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px -14px rgba(0, 0, 0, 0.5);
}
.bi-toolbar.stuck .bi-nav { padding-bottom: 6px; }
.bi-toolbar.stuck .bi-nav button { padding: 4px 12px; font-size: 13px; }
.bi-toolbar.stuck .bi-field > span, .bi-toolbar.stuck .bi-range-note { display: none; }
.bi-toolbar.stuck .bi-select { min-height: 28px; padding: 3px 8px; font-size: 12.5px; }
.bi-toolbar.stuck .bi-countries .chip { padding: 2px 9px; }
.bi-nav { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--grid); padding-bottom: 10px; }
.bi-nav button { font: inherit; font-size: 14px; font-weight: 600; border: none; background: none; color: var(--text-secondary);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.bi-nav button:hover { background: var(--ghost); color: var(--text-primary); }
.bi-nav button.active { background: var(--accent); color: var(--on-accent); }
.bi-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.bi-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-muted); }
.bi-period { display: flex; gap: 6px; flex-wrap: wrap; }
.bi-select {
  font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--surface-1); color: var(--text-primary); min-height: 32px;
}
.bi-select:focus-visible, .bi-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bi-countries .chip { padding: 4px 11px; font-size: 12px; }
.bi-reset {
  margin-left: auto; font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; min-height: 32px;
  border: 1px solid var(--baseline); border-radius: 8px; background: var(--surface-1); color: var(--accent); cursor: pointer;
}
.bi-reset:hover:not(:disabled) { background: var(--ghost); }
.bi-reset:disabled { color: var(--text-muted); opacity: .55; cursor: default; }
.bi-toolbar.stuck .bi-reset { min-height: 28px; padding: 3px 10px; }
.bi-range-note { font-size: 12px; color: var(--text-muted); }

.bi-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.bi-kpi { display: flex; flex-direction: column; gap: 2px; }
.bi-kpi .k-label { display: flex; align-items: center; gap: 6px; }
.bi-kpi .k-value { font-size: 24px; letter-spacing: -0.01em; }
.bi-kpi-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; margin-top: 2px; position: relative; z-index: 1; }
.bi-kpi-note { color: var(--text-muted); }
.bi-pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-weight: 600; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.bi-pill.good { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); }
.bi-pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
.bi-spark-wrap { margin-top: auto; padding-top: 8px; }
.bi-spark { display: block; width: 100%; height: 24px; opacity: 0.85; }
.bi-info { color: var(--text-muted); cursor: help; font-size: 13px; padding: 0 2px; border-radius: 4px; }
.bi-info:hover, .bi-info:focus-visible { color: var(--accent); outline: none; }
th.bi-has-tip { text-decoration: underline dotted; text-underline-offset: 3px; }
.bi-tip { max-width: 280px; white-space: normal; line-height: 1.4; }

.bi-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bi-grid2 > .card { margin-bottom: 16px; min-width: 0; }
@media (max-width: 900px) { .bi-grid2 { grid-template-columns: minmax(0, 1fr); gap: 0; } }

.bi-bars { display: flex; flex-direction: column; gap: 7px; }
.bi-bar-row { display: grid; grid-template-columns: minmax(110px, 1.4fr) minmax(60px, 2fr) 64px 44px minmax(0, 86px); align-items: center; gap: 8px; font-size: 12.5px; }
.bi-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-bar-track { height: 10px; background: var(--ghost); border-radius: 4px; overflow: hidden; }
.bi-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bi-bar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bi-bar-pct { text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bi-bar-extra { text-align: right; color: var(--text-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bi-table table th { position: sticky; top: 0; background: var(--surface-1); }
td.bi-dbar { position: relative; min-width: 80px; }
.bi-dbar-fill { position: absolute; left: 4px; top: 5px; bottom: 5px; max-width: calc(100% - 8px); background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 3px; }
.bi-dbar-txt { position: relative; }

.bi-local { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.bi-local-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bi-flabel { font-size: 12px; color: var(--text-muted); min-width: 64px; }
.bi-local .chip { padding: 4px 11px; font-size: 12px; }

.bi-presets { margin: 4px 0 10px; }
.bi-presets .chip { padding: 4px 11px; font-size: 12px; }
.bi-pv-ctrl { margin-bottom: 12px; }
.bi-pv-wrap { max-height: 70vh; overflow: auto; }
table.bi-pivot { border-collapse: separate; border-spacing: 0; }
table.bi-pivot th, table.bi-pivot td { padding: 6px 9px; font-size: 12.5px; border-bottom: 1px solid var(--grid); }
table.bi-pivot thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-1); color: var(--text-primary); font-weight: 600; }
table.bi-pivot .bi-pv-corner, table.bi-pivot .bi-pv-rowh { position: sticky; left: 0; z-index: 1; background: var(--surface-1); font-weight: 600; border-right: 1px solid var(--grid); }
table.bi-pivot thead .bi-pv-corner { z-index: 3; }
table.bi-pivot td.bi-heat { text-align: center; min-width: 58px; }
table.bi-pivot .bi-pv-tot { font-weight: 600; border-left: 1px solid var(--baseline); }
table.bi-pivot tr.total td { background: var(--surface-1); }
table.bi-pivot tr:hover td.bi-heat { outline: 1px solid var(--baseline); outline-offset: -1px; }
.bi-foot { margin-top: 8px; }
@media (max-width: 640px) {
  .bi-toolbar { position: static; }
  .bi-flabel { min-width: 0; width: 100%; }
  .bi-bar-row { grid-template-columns: minmax(70px, 1fr) minmax(40px, 1fr) 54px 40px; }
  .bi-bar-extra { display: none; }
}
.bi-live-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 12px; color: var(--text-muted); }
.bi-live-note .bi-live-txt { flex: 1 1 320px; display: flex; gap: 8px; align-items: baseline; }
.bi-live-note .bi-live-dot { position: relative; top: -1px; }
.bi-live-note .bi-refresh { margin-left: auto; }
.bi-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: bi-pulse 2s infinite; flex: none; }
@keyframes bi-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
td.bi-wrap { white-space: normal; min-width: 220px; max-width: 460px; }
tr.bi-storno td { color: var(--text-muted); text-decoration: line-through; }
.bi-toolbar.stuck .bi-live-note { display: none; }
@media (max-width: 640px) {
  .bi-live-note .bi-refresh { margin-left: 0; }
  td.bi-wrap { min-width: 180px; }
}
@media (max-width: 640px) {
  /* poslední objednávky jako karty: čas · země · tržba, pod tím obsah */
  table.bi-orders thead { display: none; }
  table.bi-orders tr { display: grid; grid-template-columns: auto auto 1fr auto; gap: 3px 10px; padding: 9px 2px; border-bottom: 1px solid var(--grid); }
  table.bi-orders td { border: none; padding: 0; }
  table.bi-orders td.bi-o-cas { grid-column: 1; grid-row: 1; font-weight: 600; }
  table.bi-orders td.bi-o-zeme { grid-column: 2; grid-row: 1; }
  table.bi-orders td.bi-o-typ { grid-column: 3; grid-row: 1; color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
  table.bi-orders td.bi-o-czk { grid-column: 4; grid-row: 1; font-weight: 600; }
  table.bi-orders td.bi-o-obsah { grid-column: 1 / -1; grid-row: 2; min-width: 0; max-width: none; font-size: 12.5px; color: var(--text-secondary); }
  table.bi-orders td.bi-o-zisk { display: none; }
}
.bi-bar-sum .bi-bar-label, .bi-bar-sum .bi-bar-val, .bi-bar-sum .bi-bar-pct { font-weight: 700; color: var(--text-primary); }
.bi-bar-sum { padding-top: 6px; margin-top: 2px; border-top: 1px dashed var(--grid); }
.bi-bar-sub .bi-bar-label { padding-left: 14px; color: var(--text-secondary); }
.bi-bar-sub .bi-bar-fill { opacity: .65; }


/* ===== Liftor brand – komponenty (Figma: tlačítka pill, mint CTA s petrolovým textem, karty radius 12) ===== */
h1, h2, h3, .brand, .kpi .k-value { letter-spacing: -0.01em; }
.card { border-radius: var(--radius-card); border-color: var(--border); }
.card h2 { font-size: 17px; font-weight: 600; line-height: 1.35; }
.kpi { border-radius: var(--radius-card); border-color: var(--border); }
.kpi .k-value { font-weight: 600; letter-spacing: -0.02em; }
.brand { font-weight: 600; }
.brand-mark {
  display: inline-block; color: var(--on-brand); background: var(--brand); border-radius: 6px;
  padding: 0 7px; margin-right: 4px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 700;
}
/* hlavní menu: aktivní záložka = petrolová pill s bílým textem, v tmavém režimu mint */
.tabs { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px; }
.tabs button { border-radius: var(--radius-pill); padding: 7px 16px; font-weight: 600; }
.tabs button:hover { color: var(--text-primary); background: var(--ghost); }
.tabs button.active { background: var(--brand-dark); color: #fff; box-shadow: none; }
:root[data-theme="dark"] .tabs button.active { background: var(--brand); color: var(--on-brand); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .tabs button.active { background: var(--brand); color: var(--on-brand); } }
/* sekce (Dnes, Produkty, …) a chipy: mint pill s petrolovým textem */
.bi-nav button { border-radius: var(--radius-pill); }
.bi-nav button.active, .filter-chips .chip.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.filter-chips .chip { border-radius: var(--radius-pill); background: var(--surface-1); border-color: var(--baseline); }
.filter-chips .chip:hover { border-color: var(--text-primary); }
/* CTA tlačítka */
.seo-btn, .gate-card button, .range-actions button.primary {
  background: var(--brand); color: var(--on-brand); border-radius: var(--radius-pill); font-weight: 600;
}
.seo-btn:hover, .gate-card button:hover, .range-actions button.primary:hover { filter: brightness(0.95); }
.bi-reset { border-radius: var(--radius-pill); color: var(--text-primary); border-color: var(--baseline); }
.bi-reset:hover:not(:disabled) { border-color: var(--text-primary); background: var(--surface-1); }
.topbar-actions button { border-radius: var(--radius-pill); }
/* inputy a selecty: radius 12, obrys Gray/400 (3:1) */
.bi-select, .filters select, .gate-card input, .range-row input, .range-row select {
  border-radius: var(--radius-input); border-color: var(--baseline); min-height: 36px;
}
.bi-select:focus-visible, .filters select:focus-visible, .gate-card input:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: 1px; }
/* segmentové přepínače jako pill */
.seg { border-radius: var(--radius-pill); padding: 3px; background: var(--surface-2); }
.seg button { border-radius: var(--radius-pill); }
.seg button.active { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(3, 42, 49, .12); }
/* delta pilulky podle funkčních ramp */
.bi-pill.good { color: var(--good); background: var(--good-bg); }
.bi-pill.bad { color: var(--bad); background: var(--bad-bg); }
/* tabulky */
th { color: var(--text-secondary); font-weight: 600; }
tr:hover td { background: var(--ghost); }
.bi-dbar-fill { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.bi-bar-track { background: var(--surface-2); border-radius: var(--radius-pill); }
.bi-bar-fill { border-radius: var(--radius-pill); }
.tooltip { border-radius: var(--radius-card); box-shadow: 0 8px 24px rgba(3, 42, 49, .14); }

.tab-updated { margin: 0 0 10px; font-size: 12px; }

/* KPI dlaždice 4 × 2 (Objednávky: Dnes, Produkty) */
.bi-kpis.bi-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .bi-kpis.bi-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .bi-kpi .k-value { font-size: 20px; } .bi-kpi { padding: 12px 13px; } }
