/* Panel treści KERNAL TV — zwykłe strony HTML, bez frameworka.
   Kolory, kroje, skala i rytm biorą się wyłącznie z ról w tokeny-ui.css —
   tu nie ma ani jednej wartości koloru wpisanej wprost. */
@import "./tokeny-ui.css";

*, *::before, *::after { box-sizing: border-box; }
html { font: 400 var(--t-tresc) / var(--lh-tresc) var(--font); }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-text); }
b, strong { font-weight: 600; }
code, pre, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
code { font-size: 13px; background: var(--surface-raised); padding: 1px 5px; border-radius: 4px; }
::placeholder { color: var(--text-faint); }

/* ——— szkielet: boczna nawigacja (A7) + treść ——————————————— */
.uklad { display: flex; min-height: 100vh; }
.bok { width: 240px; flex: none; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-2); background: var(--surface); border-right: 1px solid var(--border); }
.bok-gora { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 12px; }
.bok .marka { color: var(--text); text-decoration: none; letter-spacing: .04em; font-weight: 600; font-size: var(--t-sekcja); }
.menu-guzik { display: none; }
.bok-org { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-kontrolka); background: var(--surface-raised); }
.bok-org .meta { margin: 0; } .bok-org b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bok-org .przycisk { margin-top: var(--s-1); align-self: flex-start; }
.bok-nav { display: flex; flex-direction: column; gap: var(--s-2); }
.bok-nav .grupa { display: flex; flex-direction: column; gap: 2px; }
.bok-nav .grupa > span { padding: 0 12px 4px; font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); font-weight: 600; color: var(--text-muted); }
.bok-nav a { position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: var(--r-kontrolka); color: var(--text-muted); text-decoration: none; }
.bok-nav a:hover { color: var(--text); background: var(--surface-raised); }
.bok-nav a.aktywna { color: var(--text); background: var(--surface-raised); font-weight: 600; }
.bok-nav a.aktywna::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.ikona { width: 20px; height: 20px; flex: none; }
.bok-konto { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); padding: 0 12px; }
.bok-konto .kto { font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); overflow: hidden; text-overflow: ellipsis; }
.bok-konto .meta { margin: 0; }
.bok-konto form { margin: 0; }
.glowna { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tresc { flex: 1; width: min(72rem, 100% - var(--s-4) * 2); margin: var(--s-3) auto; }
.stopka { padding: var(--s-2) var(--s-4); color: var(--text-muted); font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); border-top: 1px solid var(--border); }

/* ——— pismo ————————————————————————————————————— */
h1 { font-size: var(--t-tytul); line-height: var(--lh-tytul); font-weight: 700; margin: 0 0 var(--s-1); letter-spacing: -0.01em; }
h2 { font-size: var(--t-sekcja); line-height: var(--lh-sekcja); font-weight: 600; margin: var(--s-4) 0 var(--s-1); }
h3 { font-size: var(--t-tresc); line-height: var(--lh-tresc); font-weight: 600; margin: var(--s-2) 0 var(--s-1); }
h1 code { font-size: var(--t-pomocniczy); vertical-align: middle; font-weight: 400; }
.meta, .pusto, .okruszki { color: var(--text-muted); font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); }
.meta { margin: 0 0 var(--s-2); } .okruszki { margin: 0 0 var(--s-1); }
.pusto { margin: var(--s-1) 0; }
.okruszki a { color: inherit; }
p { margin: 0 0 var(--s-2); }

/* ——— nagłówek obiektu (A4) i stany puste (A5) ————————————— */
.naglowek-obiektu { margin-bottom: var(--s-3); }
.naglowek-obiektu .pasek-tytulu { margin-bottom: 0; align-items: center; }
.naglowek-obiektu .tytul { display: flex; align-items: center; gap: var(--s-1) 12px; flex-wrap: wrap; min-width: 0; }
.naglowek-obiektu h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.akcje-naglowka { display: flex; gap: var(--s-1); align-items: center; flex-wrap: wrap; }
.fakty { margin: 4px 0 0; color: var(--text-muted); font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); }
.fakty .mono { color: var(--text); }
.rozwijane { position: relative; }
.rozwijane > summary { list-style: none; }
.rozwijane > summary::-webkit-details-marker { display: none; }
.rozwijane > .karta { position: absolute; right: 0; top: calc(100% + var(--s-1)); width: min(24rem, calc(100vw - 2 * var(--s-2))); z-index: 5; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
.rozwijane > .karta > label { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-pomocniczy); color: var(--text-muted); }
.rozwijane > .karta .meta { margin: 0; }
.rozwijane > .karta button { align-self: flex-start; }
.pusty-stan { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: var(--s-3) 0; max-width: 40rem; }
.pusty-stan .ikona { width: 24px; height: 24px; color: var(--text-muted); }
.pusty-stan p { margin: 0; }
.pusty-stan .w-linii { gap: 12px; }

/* ——— karty i siatki ————————————————————————————— */
.karta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-karta); padding: var(--s-2); }
.karta + .karta, .formularz .karta { margin-top: var(--s-2); }
.karta.waska { max-width: 34rem; margin: var(--s-4) auto; padding: var(--s-3); }
.karta h2 { margin-top: 0; }
.kafle { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--s-2); }
.kafle a { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-karta); padding: var(--s-2); text-decoration: none; color: inherit; }
.kafle a:hover { border-color: var(--accent); }
.kafle b { display: block; margin-bottom: 2px; }
.kafle .meta { margin: 0; }
.siatka { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--s-2); }
.pasek-tytulu { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-2); }
.w-linii { display: flex; gap: var(--s-1); align-items: center; flex-wrap: wrap; }
.lista { padding-left: 1.2rem; }

/* ——— tabele ———————————————————————————————————— */
.tabela { overflow-x: auto; border-radius: var(--r-karta); }
.tabela table { min-width: 40rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-karta); overflow: hidden; }
.karta > table { border: 0; border-radius: 0; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--surface-raised); font-weight: 600; font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); color: var(--text-muted); }
td.meta { margin: 0; }
tr.aktywny td { background: var(--success-bg); }

/* ——— statusy ———————————————————————————————————— */
i.ok, i.blad, i.uwaga, .uwaga { font-style: normal; font-weight: 600; }
i.ok { color: var(--success); } i.blad { color: var(--error); } i.uwaga, .uwaga { color: var(--warning); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 var(--s-1); border-radius: 999px; font-size: var(--t-pomocniczy); line-height: 1; font-weight: 600; font-style: normal; background: var(--surface-raised); color: var(--text-muted); white-space: nowrap; vertical-align: middle; }
.chip.ok { background: var(--success-bg); color: var(--success); }
.chip.blad { background: var(--error-bg); color: var(--error); }
.chip.uwaga { background: var(--warning-bg); color: var(--warning); }
.flash { list-style: none; padding: 0; margin: 0 0 var(--s-2); }
.flash li { padding: 10px 12px; border-radius: var(--r-kontrolka); margin: 0 0 var(--s-1); background: var(--success-bg); border: 1px solid transparent; color: var(--text); }
.flash li.blad { background: var(--error-bg); } .flash li.uwaga { background: var(--warning-bg); }
.flash li.info { background: var(--surface-raised); font-family: var(--font-mono); font-size: var(--t-pomocniczy); }
.raport { list-style: none; padding: 0; margin: 0; }
.raport li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.raport li:last-child { border-bottom: 0; }
.raport i { display: inline-block; min-width: 3.5rem; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }

/* ——— kontrolki (A3): 40 px w panelu, 32 px tylko w gęstych paskach ——— */
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: var(--h-kontrolka); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-kontrolka);
  font: inherit; background: var(--surface); color: var(--text);
}
textarea { padding: 10px 12px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input.waskie { width: 10rem; }
input[type=file] { font: inherit; color: var(--text-muted); }
button, .przycisk {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--h-kontrolka); padding: 0 var(--s-2);
  border-radius: var(--r-kontrolka); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
button:hover, .przycisk:hover { background: var(--surface-raised); }
button.glowny, .przycisk.glowny { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.glowny:hover, .przycisk.glowny:hover { filter: brightness(1.08); background: var(--accent); }
button.drugi, .przycisk.drugi { background: var(--surface); color: var(--text); border-color: var(--border); }
button.cichy, .przycisk.cichy { background: none; border-color: transparent; color: var(--text-muted); }
button.cichy:hover, .przycisk.cichy:hover { color: var(--text); background: var(--surface-raised); }
button.czerwony { background: var(--error); color: var(--on-error); border-color: var(--error); }
button.czerwony:hover { background: var(--error); filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }
.przycisk.maly, button.maly { min-height: var(--h-gesta); padding: 0 12px; font-size: var(--t-pomocniczy); }
.przyciski button { min-height: var(--h-gesta); min-width: var(--h-gesta); padding: 0 6px; margin-right: 2px; font-weight: 400; }
.akcje { display: flex; flex-direction: column; gap: var(--s-1); align-items: flex-start; }

/* ——— formularze ———————————————————————————————— */
.siatka label, .karta > label, .plansza label { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); color: var(--text-muted); }
.plansza label { margin-bottom: var(--s-1); }
.siatka label input, .siatka label select, .karta > label input { color: var(--text); font-size: var(--t-tresc); }
.pole-check { flex-direction: row !important; align-items: center; gap: var(--s-1) !important; color: var(--text) !important; font-size: var(--t-tresc) !important; min-height: 24px; }
fieldset { border: 1px solid var(--border); border-radius: var(--r-kontrolka); margin: var(--s-2) 0 0; padding: var(--s-1) var(--s-2) var(--s-2); display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); }
legend { color: var(--text-muted); font-size: var(--t-pomocniczy); padding: 0 4px; }
.ceny fieldset { margin: 0; }
.pasek-zapisu { position: sticky; bottom: 0; background: var(--bg); padding: var(--s-2) 0; display: flex; gap: var(--s-2); align-items: center; border-top: 1px solid var(--border); margin-top: var(--s-2); }
.wgrywanie { display: flex; flex-direction: column; gap: var(--s-1); }
.niebezpieczne { margin: var(--s-4) 0; color: var(--text-muted); } .niebezpieczne form { margin-top: var(--s-1); }
.zakladki { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: var(--s-1) 0 var(--s-2); }
.zakladki a { padding: var(--s-1) 12px; text-decoration: none; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.zakladki a.aktywna { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.zakladki a.podglad { margin-left: auto; color: var(--accent-text); }

/* ——— treść: projekty, zdjęcia, rzuty, plansze ———————————— */
.projekty { list-style: none; padding: 0; margin: var(--s-2) 0; display: grid; gap: var(--s-2); }
.projekty a { display: grid; grid-template-columns: 9rem 1fr; gap: var(--s-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-karta); overflow: hidden; text-decoration: none; color: inherit; }
.projekty a:hover { border-color: var(--accent); }
.projekty li.niekompletny a { border-left: 4px solid var(--error); }
.projekty .okladka { background: var(--surface-raised); aspect-ratio: 16/10; } .projekty .okladka img { width: 100%; height: 100%; object-fit: cover; display: block; }
.projekty .opis { padding: 12px var(--s-2) 12px 0; display: flex; flex-direction: column; gap: 2px; }
.projekty .opis b { font-size: var(--t-sekcja); line-height: var(--lh-sekcja); }
.projekty .opis .meta { margin: 0; }
.projekty .cena { font-weight: 600; font-variant-numeric: tabular-nums; } .projekty .stan { font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); }
.zdjecia { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--s-2); }
.zdjecia li { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-kontrolka); padding: var(--s-1); display: flex; flex-direction: column; gap: var(--s-1); }
.zdjecia img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 4px; background: var(--surface-raised); }
.zdjecia .meta, .rzut .meta { font-size: var(--t-pomocniczy); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rzut { border: 1px solid var(--border); border-radius: var(--r-kontrolka); padding: var(--s-2); margin: 0 0 var(--s-2); display: grid; grid-template-columns: minmax(12rem, 20rem) 1fr; gap: var(--s-2); }
.rzut img { width: 100%; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); grid-row: span 3; }
.pomieszczenia { font-size: var(--t-pomocniczy); }
.pomieszczenia th, .pomieszczenia td { padding: 4px 6px; }
.pomieszczenia input:not([type=checkbox]) { min-height: var(--h-gesta); padding: 0 8px; }
.pomieszczenia td:nth-child(2) { width: 7rem; } .pomieszczenia td:nth-child(3), .pomieszczenia td:nth-child(4) { width: 4rem; text-align: center; }
.pomieszczenia tfoot td { font-variant-numeric: tabular-nums; }
.kolejnosc li { padding: 4px 0; display: flex; align-items: center; gap: var(--s-2); font-family: var(--font-mono); font-size: var(--t-pomocniczy); }
.plansza .rzut { grid-template-columns: minmax(12rem, 22rem) 1fr; } .plansza .rzut img { grid-row: auto; aspect-ratio: 16/9; object-fit: cover; }
.brak-obrazu { aspect-ratio: 16/9; background: var(--surface-raised); display: flex; align-items: center; justify-content: center; color: var(--text-muted); border-radius: 4px; }
.token pre, pre.token { background: var(--surface-raised); color: var(--text); border: 1px solid var(--border); padding: var(--s-2); border-radius: var(--r-kontrolka); overflow: auto; user-select: all; font-size: var(--t-pomocniczy); margin: 0 0 var(--s-2); }

/* ——— strona wejścia (/login) ————————————————————————————— */
body.wejscie { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100vh; }
.wejscie-o { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-4); padding: var(--s-4) var(--s-4) var(--s-3); background: var(--wejscie-tlo); color: var(--wejscie-tekst); border-right: 1px solid var(--wejscie-linia); }
.wejscie-o .marka { color: var(--wejscie-tekst); text-decoration: none; letter-spacing: .04em; font-weight: 600; font-size: var(--t-sekcja); }
.wejscie-o .marka span { color: var(--wejscie-akcent); }
.wejscie-tresc { display: flex; flex-direction: column; gap: var(--s-2); max-width: 34rem; }
.wejscie-o .nadtytul { margin: 0; color: var(--wejscie-akcent); font-size: var(--t-pomocniczy); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.wejscie-o h1 { font-size: 32px; line-height: 40px; margin: 0; letter-spacing: -0.02em; }
.wejscie-o .wstep { margin: 0; color: var(--wejscie-muted); }
.wejscie-o .punkty { list-style: none; margin: var(--s-1) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.wejscie-o .punkty li { display: flex; flex-direction: column; gap: 2px; padding-left: 28px; position: relative; }
.wejscie-o .punkty li::before { content: ""; position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); }
.wejscie-o .punkty span { color: var(--wejscie-muted); font-size: var(--t-pomocniczy); line-height: var(--lh-pomocniczy); }
.wejscie-o > .meta { margin: 0; color: var(--wejscie-muted); letter-spacing: .12em; text-transform: uppercase; font-size: 11px; }
.wejscie-logowanie { display: flex; align-items: center; justify-content: center; padding: var(--s-4) var(--s-2); background: var(--bg); }
.wejscie-karta { width: 100%; max-width: 24rem; display: flex; flex-direction: column; gap: 12px; }
.wejscie-karta h2 { margin: 0; font-size: var(--t-tytul); line-height: var(--lh-tytul); font-weight: 700; }
.wejscie-karta > p { margin: 0; }
.wejscie-karta > .meta:first-child::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 6px; vertical-align: middle; }
.wejscie-przycisk { min-height: 44px; margin: 4px 0; }
.wejscie-przycisk[aria-disabled="true"] { opacity: .5; pointer-events: none; }

@media (max-width: 767px) {
  body.wejscie { grid-template-columns: 1fr; }
  .wejscie-o { border-right: 0; border-bottom: 1px solid var(--wejscie-linia); padding: var(--s-3) var(--s-2); gap: var(--s-3); }
  .wejscie-o h1 { font-size: var(--t-tytul); line-height: var(--lh-tytul); }
  .wejscie-o > .meta { display: none; }
  .uklad { flex-direction: column; }
  .bok { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); padding: var(--s-1) var(--s-2); gap: var(--s-1); }
  .menu-guzik { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--r-kontrolka); color: var(--text-muted); cursor: pointer; }
  .menu-guzik:hover { background: var(--surface-raised); color: var(--text); }
  .bok-org, .bok-nav, .bok-konto { display: none; }
  .menu-przelacznik:checked ~ .uklad .bok-org, .menu-przelacznik:checked ~ .uklad .bok-konto { display: flex; }
  .menu-przelacznik:checked ~ .uklad .bok-nav { display: flex; }
  .bok-konto { margin-top: 0; padding: var(--s-1) 12px; }
  .tresc { width: 100%; padding: 0 var(--s-2); margin: var(--s-2) auto; }
  .stopka { padding: var(--s-2); }
  .projekty a { grid-template-columns: 6rem 1fr; }
  .rzut, .plansza .rzut { grid-template-columns: 1fr; } .rzut img { grid-row: auto; }
  .pasek-tytulu form { width: 100%; }
}
