/* gdziezalozycoki.pl – wspólny arkusz stylów */
:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #edf2f1;
  --text: #12201e;
  --text-2: #40514e;
  --muted: #586966;
  --border: #d8e2e0;
  --accent: #0f8576;        /* elementy graficzne, obramowania */
  --accent-ink: #0b6e64;    /* linki, tekst w kolorze akcentu, przyciski */
  --accent-soft: #e0f1ee;
  --on-accent: #ffffff;
  --note-bg: #fff7e6;
  --note-border: #e6c070;
  /* serie wykresu kalkulatora – zweryfikowane walidatorem palety */
  --s-oki: #008a7a;
  --s-reg: #c2410c;
  --good: #12754f;  --good-soft: #e2f3ec;
  --warn: #9a5200;  --warn-soft: #fdf0dd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 30, 28, .05), 0 4px 16px rgba(15, 30, 28, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1716;
    --surface: #152120;
    --surface-2: #1c2b29;
    --text: #e6eeec;
    --text-2: #b2c3bf;
    --muted: #8da09c;
    --border: #283b38;
    --accent: #2fb3a0;
    --accent-ink: #5fd3c2;
    --accent-soft: #143430;
    --on-accent: #0f1716;
    --note-bg: #2a2416;
    --note-border: #6e5728;
    --s-oki: #2a9d8f;
    --s-reg: #d9622b;
    --good: #5fcf9e;  --good-soft: #12302a;
    --warn: #f0b45a;  --warn-soft: #33270f;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--font);
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Nagłówek */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; font-size: 19px; letter-spacing: -.01em; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.logo span b { color: var(--accent-ink); font-weight: 750; }
.nav ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.nav a { display: block; padding: 8px 9px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 550; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav-mobile { display: none; position: relative; }
.nav-mobile summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-weight: 600; font-size: 15px; }
.nav-mobile summary::-webkit-details-marker { display: none; }
.nav-mobile ul { flex-direction: column; position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.12); z-index: 5; }

@media (max-width: 960px) {
  .nav-desktop { display: none !important; }
  .nav-mobile { display: block; }
}

/* Okruszki i nagłówek artykułu */
.crumbs { font-size: 14px; color: var(--muted); margin: 24px 0 8px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { margin: 0 6px; }

h1, h2, h3 { line-height: 1.22; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(30px, 5vw, 44px); margin: 8px 0 14px; font-weight: 780; }
h2 { font-size: clamp(23px, 3.2vw, 28px); margin: 44px 0 12px; font-weight: 740; scroll-margin-top: 16px; }
h3 { font-size: 19px; margin: 28px 0 8px; font-weight: 700; }
p { margin: 0 0 16px; }
.lead { font-size: 19px; color: var(--text-2); margin-bottom: 20px; }
.meta { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 24px; }

article ul, article ol { padding-left: 22px; margin: 0 0 18px; }
article li { margin-bottom: 6px; }
article li::marker { color: var(--accent-ink); }
strong { font-weight: 680; }

/* Spis treści */
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 8px 0 28px; }
.toc p { font-weight: 700; margin: 0 0 6px; font-size: 15px; }
.toc ol { margin: 0; padding-left: 20px; font-size: 15px; }
.toc li { margin: 3px 0; }

/* Ramki */
.note, .key { border-radius: var(--radius); padding: 16px 18px; margin: 22px 0; }
.note { background: var(--note-bg); border: 1px solid var(--note-border); }
.key { background: var(--accent-soft); border: 1px solid transparent; }
.note > :last-child, .key > :last-child { margin-bottom: 0; }
.note strong:first-child, .key strong:first-child { display: block; margin-bottom: 4px; }
.law { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* Przykłady liczbowe */
.ex { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 18px; margin: 16px 0; }
.ex h3 { margin: 0 0 6px; font-size: 17px; }
.ex p { margin: 0 0 6px; }
.ex p:last-child { margin: 0; }
.ex .calc-line { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 15.5px; }
.ex .res { font-weight: 700; }

/* Tabele */
.table-wrap { overflow-x: auto; margin: 18px 0 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.yes { color: var(--good); font-weight: 650; }
.no { color: var(--text-2); }

/* Źródła i powiązane */
.sources { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 15px; color: var(--text-2); }
.sources h2 { font-size: 18px; margin-top: 0; }
.sources ol { padding-left: 20px; }
.sources li { margin-bottom: 6px; word-break: break-word; }
.related { margin: 40px 0 0; }
.related h2 { font-size: 20px; }

/* Karty artykułów */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin: 16px 0; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.card p { margin: 0; font-size: 15px; color: var(--text-2); }
.card .more { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 650; color: var(--accent-ink); }

.points { counter-reset: p; list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 12px; }
.points li { counter-increment: p; position: relative; padding: 14px 16px 14px 56px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 0; }
.points li::before { content: counter(p); position: absolute; left: 16px; top: 14px; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 750; display: grid; place-items: center; font-size: 15px; }
.points strong { display: block; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 650; padding: 15px 0; list-style-position: outside; }
.faq details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.faq details > div { padding-bottom: 6px; }
.faq h2 { font-size: 21px; margin-top: 36px; }

.checklist { list-style: none; padding: 0 !important; }
.checklist li { position: relative; padding-left: 32px; }
.checklist li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 16px; height: 16px; border: 2px solid var(--accent); border-radius: 4px; }

/* Stopka */
.site-footer { margin-top: 64px; background: var(--surface); border-top: 1px solid var(--border); font-size: 14.5px; color: var(--text-2); }
.site-footer .wrap { padding-top: 28px; padding-bottom: 32px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr; } }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--text-2); }
.site-footer .disclaimer { margin: 0 0 8px; }
.site-footer .copy { color: var(--muted); margin: 0; }

.notfound { text-align: center; padding: 60px 0 20px; }
.notfound .code { font-size: 72px; font-weight: 800; color: var(--accent-ink); margin: 0; line-height: 1; }

@media print {
  .site-header, .site-footer, .toc, .related, .finder-form { display: none; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Przyciski i sekcje */
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 24px; }
.btn { display: inline-block; padding: 11px 18px; border-radius: 10px; font-weight: 650; text-decoration: none; font-size: 16px; border: 0; cursor: pointer; font-family: inherit; }
.btn-primary { background: var(--accent-ink); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .btn-primary { background: var(--accent); } }
.btn-ghost { border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.section { padding: 28px 0; }
.section h2 { margin-top: 8px; }
.section-lead { color: var(--text-2); max-width: 720px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel h2, .panel h3 { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

/* Strona główna */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(34px, 6vw, 54px); max-width: 860px; margin: 12px 0 12px; }
.hero .lead { max-width: 760px; font-size: clamp(18px, 2.2vw, 20px); }
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Kafelki z liczbami */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 22px 0 8px; padding: 0; list-style: none; }
@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .stats { grid-template-columns: 1fr; } }
.stats li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stats .label { display: block; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stats .value { display: block; font-size: 26px; font-weight: 780; letter-spacing: -.02em; line-height: 1.2; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stats .sub { display: block; font-size: 14px; color: var(--text-2); line-height: 1.4; }

/* Wyszukiwarka instytucji */
.finder { margin: 8px 0; }
.finder-form { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
@media (max-width: 760px) { .finder-form { grid-template-columns: 1fr; } }
.finder-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.finder-form legend { font-size: 14px; font-weight: 650; color: var(--text-2); margin-bottom: 8px; padding: 0; }
.chips { list-style: none; padding: 0 !important; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.chip-check span { display: inline-block; font-size: 14.5px; font-weight: 600; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text-2); }
.chip-check input:checked + span { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
@media (prefers-color-scheme: dark) { .chip-check input:checked + span { background: var(--accent); border-color: var(--accent); } }
.chip-check input:checked + span::before { content: "✓ "; }
.chip-check input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.finder-type { display: grid; gap: 8px; font-size: 14px; font-weight: 650; color: var(--text-2); }
.finder-type select, .calc-grid input, .calc-grid select { font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px; min-width: 0; width: 100%; }
.finder-type select { min-width: 200px; }
.finder-count { font-size: 15px; font-weight: 650; color: var(--text-2); margin: 16px 2px 10px; }
.inst-list { list-style: none; padding: 0 !important; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.inst { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin: 0 !important; display: flex; flex-direction: column; }
.inst[hidden] { display: none; }
.inst-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.inst-head strong { font-size: 17px; line-height: 1.35; }
.inst-model { font-size: 14.5px; color: var(--text-2); margin: 6px 0 10px; line-height: 1.45; }
.inst-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.inst-tags span { background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: 2px 9px; font-size: 13px; }
.inst-start { margin: auto 0 0; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.finder-empty { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; color: var(--text-2); }
.finder-foot { font-size: 14px; color: var(--muted); margin-top: 14px; }
.badge { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--border); color: var(--text-2); background: var(--surface-2); flex: none; }

/* Kalkulator */
.calc { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.calc h2 { margin-top: 0; font-size: 21px; }
.calc h2 + p { color: var(--text-2); font-size: 15px; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 860px) { .calc-grid { grid-template-columns: 1fr 1fr; } }
.calc-grid label { display: grid; gap: 6px; font-size: 14px; font-weight: 650; color: var(--text-2); align-content: start; }
.calc-grid label small { font-weight: 500; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.calc-grid input { font-variant-numeric: tabular-nums; }
.calc-sep { margin: 22px 0 14px; border: 0; border-top: 1px solid var(--border); }
.mix-sum { font-size: 14px; margin: 10px 0 0; color: var(--muted); }
.mix-sum.err { color: var(--warn); font-weight: 650; }
.calc-result { margin-top: 20px; }
.res-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 16px; }
@media (max-width: 760px) { .res-tiles { grid-template-columns: 1fr; } }
.res-tile { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.res-tile .label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.res-tile .value { display: block; font-size: 25px; font-weight: 780; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.res-tile .sub { display: block; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.sw-oki { background: var(--s-oki); }
.sw-reg { background: var(--s-reg); }
.verdict { border-radius: var(--radius); padding: 14px 18px; border-left: 6px solid; margin-bottom: 18px; }
.verdict p { margin: 0 0 6px; }
.verdict p:last-child { margin: 0; }
.verdict-title { font-size: 18px; font-weight: 720; line-height: 1.35; }
.verdict-good { background: var(--good-soft); border-color: var(--good); }
.verdict-warn { background: var(--warn-soft); border-color: var(--warn); }

/* Wykres słupkowy (CSS) */
.chart { margin: 0 0 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.chart figcaption { font-weight: 700; margin-bottom: 4px; }
.chart .chart-sub { font-size: 14px; color: var(--text-2); margin: 0 0 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--text-2); margin: 0 0 10px; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 6px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-year { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-pair { display: grid; gap: 2px; }
.bar { display: flex; align-items: center; gap: 6px; height: 14px; }
.bar i { display: block; height: 100%; border-radius: 0 3px 3px 0; min-width: 2px; }
.bar b { font-weight: 650; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-oki i { background: var(--s-oki); }
.bar-reg i { background: var(--s-reg); }

.yr-table td, .yr-table th { padding: 8px 10px; font-size: 14.5px; }
.yr-table th { font-size: 12px; }
.calc-notes { font-size: 14px; color: var(--text-2); padding-left: 20px; }
.calc-notes li { margin-bottom: 4px; }
.calc details.more-table { margin-top: 6px; }
.calc details.more-table summary { cursor: pointer; font-weight: 650; color: var(--accent-ink); padding: 6px 0; }
.calc-grid .wide-2 { grid-column: span 2; }
/* wyrównanie pól w wierszu, gdy etykiety mają różną liczbę linii */
@supports (grid-template-rows: subgrid) {
  .calc-grid label { grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; }
}
