/* Asekura — wspólne style stron kalkulatorów.
   Layout: sticky navbar → breadcrumb → H1 + lead → [formularz | wynik (sticky)] → wykres/tabela
   → slot reklamy → artykuł SEO z FAQ i źródłami → powiązane kalkulatory → stopka.
   Jeden ciemny motyw (jak strona główna). */
:root {
  color-scheme: dark;
  --bg: #06100c;
  --surface: #0b1813;
  --surface-2: #10211a;
  --line: #1b3128;
  --line-2: #27443a;
  --fg: #e4efe8;
  --muted: #8fa89c;
  --emerald: #2fd08a;
  --lime: #b5f36b;
  --teal: #3cc8c0;
  --warn: #f2c14e;
  --bad: #ff8a7a;
  --grad: linear-gradient(115deg, var(--emerald) 0%, var(--lime) 100%);
  --font-display: "Bricolage Grotesque Variable", "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --wrap: 1200px;
  --c: var(--emerald); /* kolor grupy, nadpisywany na <body data-group> */
  /* serie wykresów: stała kolejność, sprawdzona walidatorem (ciemne tło #0b1813: jasność, CVD, kontrast 3:1) */
  --s1: #5fa82a; --s2: #8b78ee; --s3: #d0712a; --s4: #24a59c;
  accent-color: var(--emerald);
  scrollbar-color: #2b4a3d var(--bg);
}
body[data-group="ubezpieczenia"] { --c: var(--emerald); }
body[data-group="kredyty"] { --c: var(--lime); }
body[data-group="oszczedzanie"] { --c: var(--teal); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 16px/1.6 var(--font-body); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--bg); }
::selection { background: var(--emerald); color: var(--bg); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
.wrap {
  max-width: var(--wrap); margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) {
  .wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); }
}
.num { font-variant-numeric: tabular-nums; }

/* ---------- NAV ---------- */
.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font: 800 21px/1 var(--font-display); letter-spacing: -0.03em; white-space: nowrap; }
.logo b { font-weight: inherit; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; }
.logo-mark svg { width: 18px; height: 18px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-links > a, .dd-trigger { padding: 8px 12px; border-radius: 8px; color: var(--muted); font: 500 15px/1.6 var(--font-body); transition: color .2s, background .2s; }
.nav-links > a:hover { color: var(--fg); background: var(--surface-2); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-links > a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }
.search { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 14px; min-width: 210px; }
.search kbd { margin-left: auto; font: 500 11px/1 var(--font-mono); padding: 4px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); }
.pill { padding: 5px 9px; border-radius: 99px; border: 1px solid currentColor; }
.pill.ins { color: var(--emerald); } .pill.fin { color: var(--lime); } .pill.inv { color: var(--teal); }
.eyebrow { font: 500 12px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .14em; color: var(--emerald); display: inline-flex; align-items: center; gap: 10px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sec-rule { height: 2px; margin-bottom: 32px; border-radius: 2px; background: var(--grad) no-repeat 0 0 / 120px 100%, var(--line); }
.stub-note { padding: 16px 18px; border-radius: 12px; border: 1px dashed var(--line-2); color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 10px; font: 600 15px/1 var(--font-body); border: 1px solid transparent; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; }
.btn-primary { background: var(--grad); color: #04130c; }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-ghost { border-color: var(--line); color: var(--fg); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); }
.burger { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
@media (max-width: 980px) { .nav-links, .search { display: none; } .burger { display: grid; place-items: center; } }
@media (max-width: 480px) { .nav .btn-primary { display: none; } }

.nav-dd { position: relative; }
.dd-trigger { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer; }
.dd-trigger svg { transition: rotate .2s; }
.dd-trigger:hover, .dd-trigger[aria-expanded="true"], .dd-trigger.is-current { color: var(--fg); background: var(--surface-2); }
.dd-trigger[aria-expanded="true"] svg { rotate: 180deg; }
.dd-panel { position: fixed; inset: auto; margin: 0; top: calc(env(safe-area-inset-top, 0px) + 68px); left: 50%; translate: -50% 0; width: min(940px, calc(100dvw - 32px)); overflow: visible; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--fg); box-shadow: 0 24px 60px -20px rgb(0 0 0 / .7); }
.dd-panel::before { content: ""; position: absolute; inset-inline: 0; bottom: 100%; height: 20px; }
.dd-panel:not(:is(:popover-open, .\:popover-open)) { display: none; }
.dd-panel:is(:popover-open, .\:popover-open) { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .dd-panel { transition: opacity .18s, translate .18s, display .18s, overlay .18s; transition-behavior: allow-discrete; }
  .dd-panel:not(:is(:popover-open, .\:popover-open)) { opacity: 0; translate: -50% -6px; }
  @starting-style { .dd-panel:is(:popover-open, .\:popover-open) { opacity: 0; translate: -50% -6px; } }
}
.dd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 20px; max-height: calc(100dvh - 150px); overflow: auto; }
.dd-col { display: grid; align-content: start; gap: 6px; min-width: 0; }
.dd-title { margin: 4px 12px 6px; font: 500 12px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--gc); display: flex; align-items: center; gap: 8px; }
.dd-title::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--gc); }
.dd-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.dd-col a { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; transition: background .15s; }
.dd-col a:hover, .dd-col a[aria-current="page"] { background: var(--surface-2); }
.dd-col a:hover .dd-name, .dd-col a[aria-current="page"] .dd-name { color: var(--gc); }
.dd-name { font-weight: 600; font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; transition: color .15s; }
.dd-desc { font-size: 13px; color: var(--muted); line-height: 1.4; }
.dd-badge { font: 500 11px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; padding: 4px 6px; border-radius: 5px; background: rgb(181 243 107 / .12); color: var(--lime); }
.dd-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 14px 32px; border-top: 1px solid var(--line); background: var(--bg); font-size: 13px; color: var(--muted); border-radius: 0 0 18px 18px; }
.dd-foot a { color: var(--emerald); font-weight: 500; }
@media (max-width: 760px) { .dd-grid { grid-template-columns: 1fr; } }

/* ---------- PAGE HEAD ---------- */
.page-head { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.page-head::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(50% 90% at 90% 0%, color-mix(in oklab, var(--c) 18%, transparent), transparent 70%); }
.page-head .wrap { position: relative; padding-block: 28px 44px; display: grid; gap: 18px; }
/* okruszki zawsze w jednej linii; gdy się nie mieszczą (mobile) — przewijanie w poziomie */
.crumbs {
  display: flex; flex-wrap: nowrap; gap: 8px; font-size: 14px; color: var(--muted);
  white-space: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.crumbs::-webkit-scrollbar { display: none; }
.crumbs > * { flex: 0 0 auto; }
.crumbs a:hover { color: var(--fg); }
.crumbs span[aria-hidden] { opacity: .5; }
.page-head h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.02; font-weight: 800; max-width: 22ch; }
.lead { font-size: 18px; color: var(--muted); max-width: 64ch; }
/* mobile: mniejszy nagłówek i opis, żeby pierwszy ekran nie był samym tytułem */
@media (max-width: 600px) {
  .page-head h1 { font-size: 30px; line-height: 1.08; }
  .lead { font-size: 16px; line-height: 1.55; }
}
.data-stamp { display: flex; flex-wrap: wrap; gap: 8px 18px; font: 400 13px/1.4 var(--font-mono); color: var(--muted); }
.data-stamp b { color: var(--c); font-weight: 500; }

/* ---------- CALCULATOR ---------- */
.calc-sec { padding-block: 40px 24px; }
.calc { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 920px) { .calc { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.panel-body { padding: 24px; display: grid; gap: 22px; }
.link-btn { background: none; border: 0; color: var(--muted); font: 500 13px var(--font-body); cursor: pointer; padding: 4px 6px; }
.link-btn:hover { color: var(--fg); }

/* fields */
.field { display: grid; gap: 10px; }
.field-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field label, .field .label { font-weight: 500; font-size: 15px; }
.hint { font-size: 13px; color: var(--muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input, .input-wrap select, .field > select {
  width: 100%; height: 48px; padding: 0 64px 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--fg); font: 500 17px var(--font-mono); font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
/* select: własna strzałka zamiast systemowej; 16 px, żeby iOS nie powiększał strony po dotknięciu */
.input-wrap select, .field > select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 44px; font: 500 16px var(--font-body); text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fa89c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
.input-wrap select:hover, .field > select:hover { border-color: color-mix(in oklab, var(--c) 45%, var(--line-2)); }
.input-wrap select option, .field > select option { background: var(--surface); color: var(--fg); }
/* Chrome/Edge/Android: w pełni własna lista opcji (customizable select); Safari zostaje przy natywnym wyborze */
@supports (appearance: base-select) {
  .input-wrap select, .field > select { appearance: base-select; display: flex; align-items: center; }
  .input-wrap select::picker(select), .field > select::picker(select) { min-width: anchor-size(width); }
  .input-wrap select::picker-icon, .field > select::picker-icon { display: none; }
  .input-wrap select::picker(select), .field > select::picker(select) {
    appearance: base-select; margin-top: 6px; padding: 6px; max-height: min(360px, 60vh); overflow-y: auto;
    border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--fg);
    box-shadow: 0 18px 40px rgb(0 0 0 / .5);
  }
  .input-wrap select option, .field > select option {
    padding: 11px 12px; border-radius: 9px; font: 500 15px var(--font-body); cursor: pointer; min-height: 44px; display: flex; align-items: center;
  }
  .input-wrap select option:hover, .field > select option:hover,
  .input-wrap select option:focus-visible, .field > select option:focus-visible { background: var(--surface-2); outline: none; }
  .input-wrap select option:checked, .field > select option:checked { background: color-mix(in oklab, var(--c) 18%, var(--surface)); color: var(--fg); }
  .input-wrap select option::checkmark, .field > select option::checkmark { content: "✓"; order: 2; margin-left: auto; color: var(--c); }
  .input-wrap select:open, .field > select:open { border-color: var(--c); }
}
.input-wrap input:focus, .input-wrap select:focus, .field > select:focus { outline: none; border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in oklab, var(--c) 22%, transparent); }
.input-wrap input:user-invalid { border-color: var(--bad); }
.unit { position: absolute; right: 14px; font: 500 14px var(--font-mono); color: var(--muted); pointer-events: none; }
input[type="range"] { width: 100%; margin: 0; accent-color: var(--c); }
.range-scale { display: flex; justify-content: space-between; font: 400 12px var(--font-mono); color: var(--muted); margin-top: -4px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.field-error { font-size: 13px; color: var(--bad); }

/* segmented control (radio group) */
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-2); }
.seg label { flex: 1 1 auto; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 9px 12px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted); transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; flex: none; }

/* results */
.result { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 88px); }
.result .panel-body { gap: 18px; }
.big { display: grid; gap: 4px; padding: 20px; border-radius: 14px; background: radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--c) 16%, transparent), transparent 60%), var(--bg); border: 1px solid color-mix(in oklab, var(--c) 35%, var(--line)); }
.big-label { font-size: 14px; color: var(--muted); }
.big-value { font: 800 clamp(34px, 4.4vw, 46px)/1.05 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--fg); }
.big-sub { font-size: 14px; color: var(--muted); }
.kv { display: grid; gap: 0; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 15px; }
.kv dd { margin: 0; font: 500 15px var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.kv .total dt { color: var(--fg); font-weight: 600; }
.kv .total dd { color: var(--c); }
.note { font-size: 13px; color: var(--muted); padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.note.warn { border-color: rgb(242 193 78 / .35); background: rgb(242 193 78 / .06); color: #f6dc9c; }
.note.good { border-color: color-mix(in oklab, var(--emerald) 35%, transparent); background: color-mix(in oklab, var(--emerald) 7%, transparent); color: #bdf0d6; }

/* stacked bar breakdown */
.stack { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); }
.stack i { display: block; height: 100%; transition: flex-basis .3s; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* chart + table panel */
.viz { margin-top: 20px; }
.viz .panel-body { gap: 16px; }
.chart-box { position: relative; width: 100%; min-width: 0; }
.chart { display: grid; gap: 12px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--fg); }
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend .key-rect { width: 12px; height: 12px; border-radius: 3px; }
.chart-legend .key-line { width: 16px; height: 2px; border-radius: 2px; }
.chart-plot { position: relative; }
.chart-plot svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart-plot svg:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; border-radius: 8px; }
.chart-plot .grid { stroke: var(--line); stroke-width: 1; }
.chart-plot .axis { stroke: var(--line-2); stroke-width: 1; }
.chart-plot .tick { fill: var(--muted); font: 400 12px var(--font-mono); font-variant-numeric: tabular-nums; }
.chart-plot .axis-title { fill: var(--muted); font: 500 12px var(--font-body); }
.chart-plot .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart-plot .band-hl { fill: rgb(255 255 255 / .04); }
.chart-plot .end-dot { stroke: var(--surface); stroke-width: 2; }
.chart-tip { position: absolute; z-index: 2; pointer-events: none; min-width: 190px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); box-shadow: 0 12px 28px -12px rgb(0 0 0 / .8); display: grid; gap: 6px; font-size: 13px; }
.chart-tip .tip-head { font-weight: 600; color: var(--fg); }
.chart-tip .tip-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; color: var(--muted); }
.chart-tip .tip-row i { width: 12px; height: 2px; border-radius: 2px; }
.chart-tip .tip-row b { color: var(--fg); font: 500 13px var(--font-mono); font-variant-numeric: tabular-nums; }
.chart-tip .tip-total { border-top: 1px solid var(--line); padding-top: 6px; }
.chart-hint { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 4px; }
.tabs button { background: transparent; border: 1px solid transparent; color: var(--muted); font: 500 14px var(--font-body); padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--fg); border-color: var(--line-2); }
.table-scroll { overflow: auto; max-height: 460px; border: 1px solid var(--line); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font: 400 14px var(--font-mono); font-variant-numeric: tabular-nums; }
table.data th { position: sticky; top: 0; background: var(--surface-2); text-align: right; font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { text-align: right; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data tr:hover td { background: rgb(255 255 255 / .02); }
table.data tr.year td { background: var(--bg); color: var(--c); font-weight: 500; }

/* ---------- SEO ARTICLE ---------- */
.article-sec { padding-block: 32px 72px; }
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; }
@media (max-width: 980px) { .article-grid { grid-template-columns: 1fr; } }
.prose { max-width: 72ch; min-width: 0; font-size: 17px; line-height: 1.75; color: #cfdcd5; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: clamp(26px, 3vw, 32px); line-height: 1.15; color: var(--fg); margin-top: 2em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 21px; line-height: 1.3; color: var(--fg); margin-top: 1.6em; }
.prose strong { color: var(--fg); font-weight: 600; }
.prose a { color: var(--c); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--c); }
.prose code, .formula { font-family: var(--font-mono); font-size: .92em; }
.formula { display: block; padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--fg); overflow-x: auto; white-space: pre; line-height: 1.6; }
.prose .table-scroll { max-height: none; }
.prose table.data { font-size: 14px; }
.prose table.data td, .prose table.data th { white-space: normal; }
/* kwoty nigdy się nie łamią (np. „4 806 zł”); szeroka tabela przewija się w poziomie w .table-scroll */
.prose table.data td.num { white-space: nowrap; }
.prose table.data th.num { min-width: 6.5em; }
.prose table.data td:first-child { min-width: 8.5em; }
.example { padding: 20px 22px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.example > * + * { margin-top: .7em; }
.example-label { font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--c); }

.faq { display: grid; gap: 10px; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 48px 16px 18px; position: relative; font-weight: 600; color: var(--fg); font-size: 16px; line-height: 1.45; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 14px; font: 400 20px var(--font-mono); color: var(--c); transition: rotate .2s; }
.faq details[open] summary::after { rotate: 45deg; }
.faq details > div { padding: 0 18px 18px; font-size: 16px; }
.sources { font-size: 14px; color: var(--muted); }
.sources li + li { margin-top: .3em; }

aside.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 92px); display: grid; gap: 16px; }
.side-box { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 20px; display: grid; gap: 12px; }
.side-box h3 { font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 14px; }
.toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.toc a:hover { background: var(--surface-2); color: var(--fg); }
@media (max-width: 980px) { aside.side { position: static; } }

.related { padding-block: 0 80px; }
.related h2 { font-size: 28px; margin-bottom: 20px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.related-grid a { display: grid; gap: 4px; padding: 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: border-color .2s, transform .2s; }
.related-grid a:hover { border-color: var(--gc, var(--c)); transform: translateY(-2px); }
.related-grid b { font-weight: 600; }
.related-grid span { font-size: 14px; color: var(--muted); }
.related-grid em { font: 500 11px var(--font-mono); font-style: normal; text-transform: uppercase; letter-spacing: .1em; color: var(--gc, var(--c)); }

/* ---------- FOOTER ---------- */
footer { border-top: 1px solid var(--line); background: #040b08; }
.foot { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 40px; padding-block: 56px 36px; }
.foot p { color: var(--muted); margin-top: 16px; max-width: 36ch; font-size: 15px; }
.foot .foot-title { margin: 0 0 16px; font: 500 12px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.foot ul a { color: var(--fg); opacity: .85; font-size: 15px; }
.foot ul a:hover { color: var(--emerald); opacity: 1; }
.legal { border-top: 1px solid var(--line); padding-block: 24px 32px; display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; font-size: 13px; color: var(--muted); }
.legal .disc { max-width: 78ch; }
@media (max-width: 820px) { .foot { grid-template-columns: 1fr 1fr; } .foot > div:first-child { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- LISTINGI (najnowsze, kategorie) ---------- */
.page-head h1.wide { max-width: none; }
.listing { padding-block: 40px 88px; }
.article-grid-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 24px; }
@media (max-width: 960px) { .article-grid-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .article-grid-list { grid-template-columns: 1fr; } }
.method-note { padding-block: 0 40px; }
.method-note p { padding: 16px 18px; border-radius: 12px; border: 1px dashed var(--line-2); color: var(--muted); font-size: 15px; }
.method-note a { color: var(--emerald); text-decoration: underline; text-underline-offset: 3px; }
.list-empty { grid-column: 1 / -1; padding: 20px; border-radius: 14px; border: 1px dashed var(--line-2); color: var(--muted); }

/* kalkulatory: 12 kart, każda z jedną aktualną liczbą z jej dziedziny */
.calc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.calc-card {
  --gc: var(--emerald);
  display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px;
  padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  transition: border-color .2s, transform .2s, background .2s;
}
.calc-card:hover { border-color: color-mix(in oklab, var(--gc) 60%, var(--line)); background: var(--surface-2); transform: translateY(-2px); }
.calc-card .g { display: inline-flex; align-items: center; gap: 8px; font: 500 11px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.calc-card .g::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--gc); }
.calc-card h3 { font-size: 19px; line-height: 1.2; font-weight: 700; }
.calc-card p { font-size: 14px; color: var(--muted); }
.calc-card .datum-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 14px; border-top: 1px dashed var(--line); }
.calc-card .d { font: 500 13px/1.3 var(--font-mono); color: var(--fg); font-variant-numeric: tabular-nums; }
.calc-card .go { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--muted); transition: all .2s; }
.calc-card:hover .go { background: var(--gc); border-color: var(--gc); color: var(--bg); }
.calc-card.ins { --gc: var(--emerald); } .calc-card.cre { --gc: var(--lime); } .calc-card.sav { --gc: var(--teal); }
@media (max-width: 1080px) { .calc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .calc-grid { grid-template-columns: 1fr; } }


/* ---------- MENU NA TELEFON (popover) ---------- */
.burger { cursor: pointer; }
.m-menu {
  position: fixed; inset: 0 0 auto auto; margin: 0; height: 100dvh; width: min(380px, 100vw);
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(20px, env(safe-area-inset-right, 0px)) 32px 20px;
  border: 0; border-left: 1px solid var(--line); background: var(--bg); color: var(--fg); overflow-y: auto;
}
.m-menu::backdrop { background: rgb(0 0 0 / .55); }
.m-menu:not(:is(:popover-open, .\:popover-open)) { display: none; }
.m-menu:is(:popover-open, .\:popover-open) { display: grid; align-content: start; gap: 24px; }
@media (prefers-reduced-motion: no-preference) {
  .m-menu { transition: translate .22s ease, opacity .22s ease, display .22s, overlay .22s; transition-behavior: allow-discrete; }
  .m-menu:not(:is(:popover-open, .\:popover-open)) { translate: 24px 0; opacity: 0; }
  @starting-style { .m-menu:is(:popover-open, .\:popover-open) { translate: 24px 0; opacity: 0; } }
}
.m-head { display: flex; align-items: center; justify-content: space-between; }
.m-title { font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.m-close { height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 500 14px var(--font-body); cursor: pointer; }
.m-main { display: grid; border-top: 1px solid var(--line); }
.m-main a { padding: 14px 2px; border-bottom: 1px solid var(--line); font: 700 20px/1.2 var(--font-display); letter-spacing: -0.01em; }
.m-main a[aria-current="page"] { color: var(--emerald); }
.m-group { display: grid; gap: 8px; }
.m-group-title { display: flex; align-items: center; gap: 8px; font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--gc); }
.m-group-title::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--gc); }
.m-group ul { list-style: none; margin: 0; padding: 0; display: grid; }
.m-group a { display: block; padding: 9px 0; color: var(--muted); font-size: 15px; }
.m-group a:hover, .m-group a[aria-current="page"] { color: var(--fg); }
@media (min-width: 981px) { .m-menu { display: none !important; } }
