/* Czytnik SF - style wspólne (system „Kartoteka × Urząd”, kierunek A „Arkusz”).
   Wymaga tokens.css. Specyfikacja: web/docs/design/README.md. */

/* ===== Fonty (lokalnie, podzbiory latin + latin-ext) ===== */
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/public-sans-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/public-sans-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/fonts/public-sans-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/fonts/public-sans-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/public-sans-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/public-sans-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Public Sans'; font-style: italic; font-weight: 400; font-display: swap; src: url('/static/fonts/public-sans-latin-400-italic.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Public Sans'; font-style: italic; font-weight: 400; font-display: swap; src: url('/static/fonts/public-sans-latin-ext-400-italic.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/ibm-plex-mono-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/ibm-plex-mono-latin-ext-500-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ===== Podstawy ===== */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
}
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.label {
    font-size: var(--fs-label);
    letter-spacing: var(--ls-label, .12em);
    text-transform: uppercase;
    color: var(--ink-2);
    font-weight: 500;
}

/* ===== Pasek globalny ===== */
.topbar {
    height: var(--header-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: var(--hdr);
    color: var(--hdr-ink);
    border-bottom: 1px solid var(--hdr-line);
    overflow: hidden;
}
.topbar__brand {
    display: flex;
    align-items: baseline;
    gap: 2px;
    flex-shrink: 0;
    color: #fff;
    text-decoration: none;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__code { font-family: var(--font-mono); font-weight: 500; font-size: 14px; letter-spacing: .04em; }
.topbar__name { font-style: italic; font-size: 21px; }
.topbar__nav {
    display: flex;
    gap: 2px;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
}
.topbar__nav a {
    padding: 7px 13px;
    font-size: 14px;
    color: #fff;
    text-decoration: none;
}
.topbar__nav a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.topbar__nav a[aria-current="page"] { background: #fff; color: #0b0c0c; }
.topbar__nav .short { display: none; }
.topbar__spacer { flex: 1; }
.topbar__formats {
    font-size: 12.5px;
    color: #d0d3d4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.topbar__theme {
    flex-shrink: 0;
    border: 1px solid var(--hdr-line);
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 12.5px;
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
}
.topbar__theme .on-dark { display: none; }
:root[data-theme="dark"] .topbar__theme .on-dark { display: inline; }
:root[data-theme="dark"] .topbar__theme .on-light { display: none; }

@media (max-width: 859px) {
    .topbar__nav .long { display: none; }
    .topbar__nav .short { display: inline; }
    .topbar__formats { display: none; }
}
@media (max-width: 520px) {
    .topbar { gap: 8px; padding: 0 10px; }
    .topbar__nav a { padding: 7px 8px; font-size: 13px; }
    .topbar__name { font-size: 18px; }
}

/* ===== Treść stron ===== */
.page {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 30px clamp(18px, 3vw, 44px) 90px;
}

/* ===== Przyciski ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: var(--btn-h);
    padding: 0 20px;
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { text-decoration: none; background: var(--accent-bg); }
.btn--primary { background: var(--ink); color: var(--paper); font-weight: 700; }
.btn--primary:hover { background: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .35; cursor: default; text-decoration: none; }

/* ===== Komunikaty (zgodność ze starszymi szablonami) ===== */
.alert {
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--ink);
    background: var(--paper);
    font-size: var(--fs-ui);
    line-height: 1.5;
}
.alert-success { border-left: 4px solid var(--ok); }
.alert-error { border: 3px solid var(--err); }

/* Karta ze starszych szablonów - bez zaokrągleń i cieni */
.card {
    background: var(--paper);
    border: 1px solid var(--rule);
    margin-bottom: 16px;
}
.card-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--rule);
    font-size: var(--fs-label);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-2);
    font-weight: 500;
}
.card-header svg { display: none; }
.card-body { padding: 18px; }

/* ===== HTMX: wskaźnik ładowania jako pasek 3px ===== */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }
.progress {
    position: relative;
    display: block;
    height: 3px;
    background: var(--rule-2);
    overflow: hidden;
}
.progress::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -40%;
    width: 40%;
    background: var(--ink);
    animation: progress 1.2s linear infinite;
}
@keyframes progress { to { left: 100%; } }
/* stary spinner w index.html do czasu S2 - kwadrat bez zaokrągleń */
.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: spin 1s linear infinite;
    vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn--small { min-height: 36px; padding: 0 14px; font-size: var(--fs-ui); }
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
.h2 { font-size: var(--fs-h3); font-weight: 700; line-height: 1.2; margin: 0 0 10px; }

/* ===== Konwerter: dwie kolumny ===== */
.converter {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(290px, 370px) minmax(0, 1fr);
    height: calc(100vh - var(--header-h));
    min-height: 0;
}
.converter > * { min-width: 0; overflow: auto; }

.converter__form {
    background: var(--paper);
    border-right: 1px solid var(--rule);
    padding: 26px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
/* przy niskim oknie nic się nie ściska (reCAPTCHA, przycisk) */
.converter__form > *, .upload > * { flex-shrink: 0; }
.upload { display: flex; flex-direction: column; gap: 18px; }

.field__error { display: none; margin: 0 0 8px; font-size: var(--fs-ui); font-weight: 700; color: var(--err); }
.field--err { border-left: 4px solid var(--err); padding-left: 12px; }
.field--err .field__error { display: block; }
.field--err .dropzone { border-color: var(--err); }

.dropzone {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 22px 20px;
    border: 2px dashed var(--ink-2);
    background: var(--paper);
    cursor: pointer;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--ink); background: var(--row-hover); }
.dropzone:focus-within { outline: 3px solid var(--focus); box-shadow: inset 0 -4px 0 #0b0c0c; }
.dropzone__title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.dropzone__pick { font-size: var(--fs-ui); }
.dropzone__hint { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

.picked {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--ink);
    background: var(--accent-bg);
}
.picked__name { flex: 1; min-width: 0; font-size: var(--fs-small); overflow-wrap: anywhere; }
.picked__size { flex-shrink: 0; font-size: var(--fs-meta); color: var(--ink-2); white-space: nowrap; }
.picked__remove {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
}
.picked.hidden { display: none !important; }

.captcha { min-height: 78px; }

.contents { border-top: 1px solid var(--rule); padding-top: 14px; }
.contents__list { list-style: none; margin: 8px 0 10px; padding: 0; font-size: 13.5px; }
.contents__list li { padding: 6px 0; border-bottom: 1px solid var(--rule-2); line-height: 1.35; }
.contents__note { margin: 0; font-size: 13px; line-height: 1.5; }
.converter__note { margin: 0; font-size: var(--fs-small); line-height: 1.5; }
.converter__links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-small); }

.converter__result { background: var(--bg); }

/* ===== Prawa kolumna: stany i wynik ===== */
.result {
    max-width: var(--content-max);
    padding: 30px clamp(18px, 3vw, 44px) 90px;
}
.result--empty { max-width: 620px; padding-top: 70px; }
.result-kicker { font-size: var(--fs-small); color: var(--ink-2); }
.result-title {
    font-size: clamp(28px, 3.4vw, 42px);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -.01em;
    margin: 6px 0 12px;
    text-wrap: balance;
}
.result-title--file { font-size: clamp(24px, 3vw, 36px); overflow-wrap: anywhere; }
.result-lead { font-size: 16px; line-height: 1.6; margin: 0 0 24px; text-wrap: pretty; }
.result-progress-note { font-size: var(--fs-ui); margin: 12px 0 0; }

.steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.steps li {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 0;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule-2);
    font-size: 15px;
}
.steps .mono { color: var(--ink-2); font-size: 13px; }

/* Nagłówek wyniku */
.result-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 28px;
    margin-bottom: 22px;
}
.result-head__main { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; }
.result-head .result-title { font-size: clamp(26px, 3.2vw, 40px); margin-bottom: 8px; }
.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 13.5px;
    color: var(--ink-2);
}
.result-meta > span { white-space: nowrap; }
.result-head__download { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.result-expiry { font-size: var(--fs-meta); color: var(--ink-2); padding-left: 2px; }
a[aria-disabled="true"] { opacity: .35; pointer-events: none; text-decoration: none; }

/* Kafle 4 albo 2×2, nigdy 3+1 */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(calc(25% - 1px), calc((640px - 100%) * 999), calc(50% - 1px)), 1fr));
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
    margin-bottom: 18px;
}
.tile { background: var(--paper); padding: 14px 16px; min-width: 0; }
.tile__label { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.tile__value {
    font-size: clamp(18px, 2vw, 22px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.tile__value--err { color: var(--err); }
.tile--key { background: var(--ink); color: var(--paper); }
.tile--key .tile__label { color: inherit; opacity: .85; }
/* werdykt to tekst, nie kwota - może się zawinąć w wąskim kaflu */
.tile--key .tile__value { white-space: normal; line-height: 1.2; text-wrap: balance; }
.tile--err { background: var(--err); color: #fff; }

/* Uwaga parsera (np. układ mieszany) */
.notice { border: 1px solid var(--ink); background: var(--paper); padding: 12px 14px; margin-bottom: 22px; }
.notice__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 4px; }
.notice__mark { background: var(--mark); color: #0b0c0c; font-size: var(--fs-meta); padding: 1px 6px; white-space: nowrap; }
:root[data-theme="dark"] .notice__mark { color: var(--ink); }
.notice__title { font-size: 14.5px; font-weight: 700; }
.notice p { margin: 0; font-size: var(--fs-ui); line-height: 1.55; text-wrap: pretty; }

/* Dane ogólne + zawartość pliku */
.result-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
    margin-bottom: 30px;
}
.result-sections > section { min-width: 0; }
.facts { margin: 0; font-size: 13.5px; }
.facts > div {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--rule-2);
    line-height: 1.35;
}
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts .mono { font-size: 12.5px; }

.sheets { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.sheet {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--rule-2);
    line-height: 1.35;
}
.sheet__name { font-weight: 700; }
.sheet__count { flex-shrink: 0; font-size: var(--fs-meta); color: var(--ink-2); white-space: nowrap; }
.sheet--missing { color: var(--ink-2); }
.sheet--missing .sheet__name { font-weight: 400; }
.attachments-label { margin: 18px 0 2px; }
.attachment__name { min-width: 0; font-size: var(--fs-small); overflow-wrap: anywhere; }
.attachment__actions { display: flex; flex-shrink: 0; gap: 12px; align-items: baseline; }

/* Podgląd bilansu */
.preview { margin-bottom: 26px; }
.preview__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 10px; }
.preview__head .h2 { margin: 0; }
.preview__caption { font-size: 13px; }
.preview__note { font-size: 13px; margin: 10px 0 0; }

.grid-table { background: var(--paper); border: 1px solid var(--rule); overflow-x: auto; }
.grid-table__inner { min-width: 600px; }
.grid-table__head, .grid-table__row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 136px 136px;
    gap: 10px;
    padding: 7px 14px;
}
.grid-table__head { background: var(--th-bg); color: var(--th-ink); font-size: 12.5px; font-weight: 600; }
.grid-table__row {
    font-size: 13.5px;
    line-height: 1.35;
    border-bottom: 1px solid var(--rule-2);
    font-variant-numeric: tabular-nums;
}
.grid-table__row:last-child { border-bottom: 0; }
.grid-table__row:hover { background: var(--row-hover); }
.grid-table__row.is-bold { font-weight: 700; }
.grid-table__row.is-sum { background: var(--accent-bg); font-weight: 700; text-transform: uppercase; }
.grid-table__row.is-sum:hover { background: var(--row-hover); }
.num { text-align: right; white-space: nowrap; }

.result-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    padding-top: 18px;
    border-top: 1px solid var(--rule);
    font-size: 13.5px;
}

/* Błąd konwersji */
.result-filename { margin: 40px 0 12px; }
.error-box { border: 3px solid var(--err); background: var(--paper); padding: 18px 20px; margin-bottom: 16px; max-width: 680px; }
.error-box__title { font-size: var(--fs-h3); font-weight: 700; margin: 0 0 8px; }
.error-box__message { font-size: 15.5px; line-height: 1.5; margin: 0 0 8px; }
.error-box__hint { font-size: var(--fs-ui); line-height: 1.5; margin: 0; }

@media (max-width: 859px) {
    .converter { display: block; height: auto; }
    .converter > * { overflow: visible; }
    .converter__form { border-right: 0; border-bottom: 1px solid var(--rule); padding-bottom: 32px; }
    .result--empty { padding-top: 36px; }
}

/* ===== Strony prawne: Regulamin, Polityka prywatności ===== */
.legal-page { flex: 1 0 auto; background: var(--paper); }
.legal-layout {
    max-width: 1080px;
    margin: 0 auto;
    padding: 36px clamp(18px, 3vw, 44px) 90px;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 44px;
}
.legal-nav { position: sticky; top: 20px; align-self: start; display: flex; flex-direction: column; gap: 22px; }
.legal-nav__group { display: flex; flex-direction: column; }
.legal-nav__group .label { margin-bottom: 8px; }
.legal-nav__doc {
    padding: 7px 10px;
    border-left: 3px solid transparent;
    font-size: var(--fs-ui);
    text-decoration: none;
}
.legal-nav__doc:hover { text-decoration: underline; }
.legal-nav__doc[aria-current="page"] { border-left-color: var(--ink); background: var(--accent-bg); font-weight: 700; }
.legal-nav__toc a {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 4px;
    padding: 5px 0;
    border-top: 1px solid var(--rule-2);
    font-size: 13px;
    line-height: 1.35;
    text-decoration: none;
}
.legal-nav__toc a:hover { text-decoration: underline; }
.legal-nav__toc .mono { font-size: var(--fs-meta); color: var(--ink-2); }

.legal { max-width: 720px; min-width: 0; }
.legal__meta { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--ink-2); }
.legal h1 {
    font-size: clamp(30px, 4vw, 44px);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -.01em;
    margin: 6px 0 8px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rule-2);
}
.legal__h2 {
    display: flex;
    gap: 10px;
    align-items: baseline;
    font-size: var(--fs-h3);
    font-weight: 700;
    margin: 28px 0 12px;
    padding-top: 22px;
    border-top: 1px solid var(--rule-2);
    scroll-margin-top: 16px;
}
.legal h1 + .legal__h2 { border-top: 0; padding-top: 4px; }
.legal__num { min-width: 24px; flex-shrink: 0; font-size: 13px; font-weight: 400; color: var(--ink-2); }
.legal h3 { font-size: 15px; font-weight: 700; margin: 18px 0 6px; }
.legal p, .legal ul { font-size: 16px; line-height: 1.65; margin: 0 0 12px; text-wrap: pretty; }
.legal ul { padding-left: 20px; }
.legal .code { font-family: var(--font-mono); font-size: .9em; white-space: nowrap; }
.legal__back { margin-top: 36px; }

.legal-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--ink);
    padding: 14px 16px;
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.55;
}
.legal-card__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; }
.chip { font-family: var(--font-mono); font-size: var(--fs-meta); background: var(--accent-bg); padding: 2px 6px; border-radius: var(--radius-id); white-space: nowrap; }

.legal-rows { margin: 0 0 16px; font-size: 15px; line-height: 1.55; }
.legal-rows > div {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--rule-2);
}
.legal-rows > div:first-child { border-top: 1px solid var(--rule-2); }
.legal-rows dt { font-weight: 700; }
.legal-rows dd { margin: 0; min-width: 0; text-wrap: pretty; }

.legal-items { margin: 0 0 16px; border-top: 1px solid var(--rule-2); }
.legal-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--rule-2); font-size: 15px; line-height: 1.6; }
.legal-item__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.legal-item__basis { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }

.pill {
    display: inline-block;
    border: 1px solid currentColor;
    border-radius: var(--radius-pill);
    padding: 1px 9px;
    font-size: var(--fs-meta);
    font-weight: 400;
    white-space: nowrap;
    color: var(--ink-2);
}
.pill--ok { color: var(--ok); }

.legal-table { border: 1px solid var(--rule); overflow-x: auto; margin: 0 0 14px; }
.legal-table__inner { min-width: 560px; }
.legal-table__head, .legal-table__row {
    display: grid;
    grid-template-columns: 150px minmax(180px, 1fr) 80px 100px;
    gap: 10px;
    padding: 9px 14px;
}
.legal-table__head { background: var(--th-bg); color: var(--th-ink); font-size: 12.5px; font-weight: 600; }
.legal-table__row { font-size: 13.5px; line-height: 1.4; border-bottom: 1px solid var(--rule-2); align-items: start; }
.legal-table__row:last-child { border-bottom: 0; }
.legal-table__row .mono { font-size: var(--fs-small); }

.legal-rights { margin: 0 0 14px; border-top: 1px solid var(--rule-2); }
.legal-rights > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--rule-2);
    font-size: 15px;
    line-height: 1.5;
}
.legal-rights .mono { flex-shrink: 0; font-size: var(--fs-small); color: var(--ink-2); white-space: nowrap; }

@media (max-width: 859px) {
    .legal-layout { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
    .legal-nav { position: static; }
    .legal-nav__toc { display: none; }
    .legal-nav__group:first-child { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
    .legal-nav__group:first-child .label { width: 100%; margin-bottom: 2px; }
    .legal-rows > div { grid-template-columns: 1fr; gap: 2px; }
}

/* ===== Wygasły link ===== */
.expired-page { flex: 1 0 auto; background: var(--paper); }
.expired { max-width: 680px; margin: 0 auto; padding: 56px 24px; }
.expired__title {
    font-size: clamp(30px, 4vw, 44px);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -.01em;
    margin: 6px 0 16px;
    text-wrap: balance;
}
.expired__lead { font-size: 17px; line-height: 1.6; margin: 0 0 18px; text-wrap: pretty; }
.expired__server { margin: 0 0 28px; padding: 4px 0 4px 14px; border-left: 4px solid var(--rule); font-size: var(--fs-ui); color: var(--ink-2); }

/* ===== Baner cookies ===== */
.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: center;
    padding: 14px 20px;
    background: #0b0c0c;
    color: #fff;
    border-top: 1px solid #6f777b;
}
.cookie-consent p { margin: 0; flex: 1 1 420px; font-size: 14px; line-height: 1.5; text-wrap: pretty; }
.cookie-consent a { color: #fff; }
.cookie-consent__buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.cookie-consent button {
    height: 40px;
    padding: 0 16px;
    border: 1px solid #fff;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font: 14px var(--font-sans);
    white-space: nowrap;
    cursor: pointer;
}
.cookie-consent .btn-accept { border-color: #fff; background: #fff; color: #0b0c0c; font-weight: 700; }

/* ===== Druk: jasny, bez nawigacji ===== */
@media print {
    :root, :root[data-theme="dark"] {
        --bg: #fff; --paper: #fff; --ink: #0b0c0c; --ink-2: #505a5f;
        --rule: #b1b4b6; --rule-2: #e3e4e5; --accent-bg: #f3f2f1;
        --th-bg: var(--print-th-bg); --th-ink: #0b0c0c;
        color-scheme: light;
    }
    .topbar, .cookie-consent, [data-noprint],
    .converter__form, .result-head__download, .result-foot { display: none !important; }
    .converter { display: block; height: auto; }
    .converter > * { overflow: visible; }
    .grid-table__inner { min-width: 0; }
    .page { max-width: none; padding: 0; }
}
