/* Základ dokumentu (dřív ho dodával obal artefaktu). */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding: 0; }
img { max-width: 100%; }
[hidden]:not([hidden=until-found i]) { display: none !important; }

/* Rozvržení: kalkulačka nahoře (vstupy | výsledek a graf), pod ní přesnost na reálných inzerátech, tabulky koeficientů, zapojení do filtru a zdroje.
   Motiv: česká SPZ – bílé pole, černé písmo, modrý pruh EU. */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #0f141b;
  --ink-2: #474f60;
  --muted: #6e7686;
  --line: #dde2e9;
  --line-strong: #c3cad5;
  --accent: #1c46ad;
  --accent-ink: #ffffff;
  --accent-soft: #e5ebf8;
  --series: #2a78d6;
  --series-2: #eb6834;
  --band: rgba(42, 120, 214, 0.13);
  --ok: #1d6b3c;
  --ok-soft: #e1f2e7;
  --warn: #8a5100;
  --warn-soft: #fbeedb;
  --plate-bg: #ffffff;
  --plate-ink: #0f141b;
  --plate-blue: #1d3fa6;
  --plate-eu-ink: #ffffff;
  --plate-star: #f5c518;
  --shadow: 0 1px 2px rgba(15, 20, 27, 0.05), 0 10px 30px rgba(15, 20, 27, 0.06);
  --font-display: "Barlow Semi Condensed", "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f13;
    --surface: #151a21;
    --surface-2: #1b212a;
    --ink: #edf0f4;
    --ink-2: #b6bdca;
    --muted: #8d95a4;
    --line: #29303a;
    --line-strong: #3b4453;
    --accent: #86a8ff;
    --accent-ink: #0c0f13;
    --accent-soft: #1a2746;
    --series: #3987e5;
    --series-2: #d95926;
    --band: rgba(57, 135, 229, 0.22);
    --ok: #74d29d;
    --ok-soft: #12301f;
    --warn: #f2bb62;
    --warn-soft: #36270f;
    --plate-bg: #e8ebf0;
    --plate-ink: #0f141b;
    --plate-blue: #2a4fc0;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0f13;
  --surface: #151a21;
  --surface-2: #1b212a;
  --ink: #edf0f4;
  --ink-2: #b6bdca;
  --muted: #8d95a4;
  --line: #29303a;
  --line-strong: #3b4453;
  --accent: #86a8ff;
  --accent-ink: #0c0f13;
  --accent-soft: #1a2746;
  --series: #3987e5;
  --series-2: #d95926;
  --band: rgba(57, 135, 229, 0.22);
  --ok: #74d29d;
  --ok-soft: #12301f;
  --warn: #f2bb62;
  --warn-soft: #36270f;
  --plate-bg: #e8ebf0;
  --plate-ink: #0f141b;
  --plate-blue: #2a4fc0;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 64px;
  display: grid;
  gap: 56px;
}
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h2 { font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 20px; line-height: 1.2; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* Hlavička */
.head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; }
.head h1 { font-size: 44px; line-height: 1.02; font-weight: 700; letter-spacing: -0.01em; margin-top: 6px; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 64ch; margin-top: 12px; }
.plate-box { display: grid; justify-items: end; gap: 6px; }
.plate {
  display: inline-flex; align-items: stretch; height: 46px; border: 2px solid var(--plate-ink); border-radius: 6px;
  background: var(--plate-bg); overflow: hidden;
}
.plate .eu {
  position: relative; background: var(--plate-blue); color: var(--plate-eu-ink); width: 26px; display: grid;
  align-content: end; justify-items: center; padding-bottom: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.plate .eu::before {
  content: ""; position: absolute; top: 6px; left: 50%; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%;
  border: 1.5px dotted var(--plate-star);
}
.plate .cislo {
  font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: 0.08em; color: var(--plate-ink);
  padding: 0 14px; display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.plate-box small { font-size: 13px; color: var(--muted); }

/* Kalkulačka */
.calc {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}
.calc-in { padding: 22px; border-right: 1px solid var(--line); display: grid; gap: 16px; align-content: start; }
.calc-out { padding: 22px 24px 24px; display: grid; gap: 18px; align-content: start; min-width: 0; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 13px; color: var(--muted); line-height: 1.4; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2-wide { grid-template-columns: 1.4fr 1fr; }
input[type="number"], select {
  width: 100%; height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2);
  color: var(--ink); font: inherit; font-size: 16px; padding: 0 10px; font-variant-numeric: tabular-nums;
}
input[type="number"]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.inline-btn {
  justify-self: start; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); background: none;
  border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }

.res-label { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.hero { font-family: var(--font-display); font-size: 52px; line-height: 1; font-weight: 600; margin-top: 6px; }
.hero .approx { font-size: 34px; color: var(--muted); margin-right: 6px; font-weight: 500; }
.range { font-size: 18px; color: var(--ink-2); margin-top: 8px; }
.range strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.note { font-size: 14px; color: var(--muted); margin-top: 4px; }
.error { color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 8px; font-size: 15px; }

.vypocet { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; }
.tok { display: grid; gap: 1px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.tok b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tok span { font-size: 12px; color: var(--muted); line-height: 1.25; }
.times { align-self: center; color: var(--muted); font-size: 15px; }
.budget-line { font-size: 16px; color: var(--ink-2); padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.budget-line strong { color: var(--ink); }

figure.chart { margin: 0; display: grid; gap: 8px; min-width: 0; }
.chart-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; }
.chart-head h3 { font-size: 17px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); align-items: center; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key-line { width: 18px; height: 2px; background: var(--series); border-radius: 1px; }
.key-band { width: 18px; height: 10px; background: var(--band); border-radius: 2px; }
.key-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--series-2); }
.toggle {
  font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.toggle[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.chart-box { position: relative; min-width: 0; outline: none; border-radius: 8px; }
.chart-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box text { font-family: var(--font-body); font-size: 12px; fill: var(--muted); }
.chart-box text.lab { fill: var(--ink-2); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--ink-2); box-shadow: 0 6px 18px rgba(15, 20, 27, 0.12);
  min-width: 150px; display: grid; gap: 3px; z-index: 2;
}
.tip .v { font-size: 17px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.tip .r { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.tip .lk { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--series-2); }

/* Sekce a tabulky */
.sec { display: grid; gap: 20px; }
.sec-intro { color: var(--ink-2); max-width: 72ch; }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 40px; align-items: start; }
.col { display: grid; gap: 36px; min-width: 0; align-content: start; }
.block { display: grid; gap: 10px; min-width: 0; }
.block > p { color: var(--ink-2); font-size: 15px; }
.tscroll { overflow-x: auto; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--line-strong); }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.n:last-child, th.n:last-child { padding-right: 0; }
tr.grp th { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); padding-top: 16px; border-bottom-color: var(--line); }
td small { display: block; font-size: 13px; color: var(--muted); line-height: 1.35; margin-top: 1px; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.chip.cz { background: var(--ok-soft); color: var(--ok); }
.chip.eu { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip.odhad { background: var(--warn-soft); color: var(--warn); }
.age-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }

/* Přesnost */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 860px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; gap: 2px; align-content: start; }
.stat .v { font-family: var(--font-display); font-size: 32px; font-weight: 600; line-height: 1.05; }
.stat .l { font-size: 14px; color: var(--ink-2); }
.acc { max-width: 860px; }
.acc td:first-child { font-weight: 600; }
td.err { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.err.hi { color: var(--warn); font-weight: 600; }
td.err.hi::after { content: " !"; }
details { border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details .tscroll { margin-top: 10px; max-height: 520px; overflow-y: auto; }

/* Postup */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: krok; max-width: 84ch; }
.steps li { counter-increment: krok; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; color: var(--ink-2); }
.steps li::before {
  content: counter(krok); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px;
}
.steps li strong { color: var(--ink); }
.formula {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; white-space: pre; color: var(--ink);
}
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.92em; }

.lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 40px; }
.lists ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--ink-2); }
.lists li strong { color: var(--ink); font-weight: 600; }
footer { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }

@media (max-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr); }
  .calc-in { border-right: 0; border-bottom: 1px solid var(--line); }
  .cols2, .lists { grid-template-columns: minmax(0, 1fr); }
  .cols2 { gap: 36px; }
  .col { display: contents; }
  .o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; } .o5 { order: 5; } .o6 { order: 6; }
}
@media (max-width: 560px) {
  .head { grid-template-columns: minmax(0, 1fr); }
  .plate-box { justify-items: start; }
  .head h1 { font-size: 36px; }
  .hero { font-size: 42px; }
  .calc-in, .calc-out { padding: 18px 16px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .age-tables { grid-template-columns: minmax(0, 1fr); }
  h2 { font-size: 26px; }
}
@media (prefers-reduced-motion: no-preference) {
  .toggle { transition: background-color 0.15s ease; }
}

/* Doplněno pro web */
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
footer#footer { display: grid; gap: 8px; }
footer#footer p { margin: 0; }
footer#footer a { color: var(--muted); }
.kontakt-email { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.nacitani { color: var(--muted); }
