:root {
  --tlo: #f4f5f7; --karta: #fff; --tekst: #1f2328; --szary: #6b7280; --linia: #e5e7eb;
  --akcent: #2563eb; --akcent-ciemny: #1d4ed8; --czerw: #dc2626; --ziel: #16a34a; --pom: #ea580c;
  --bok: #1e2330; --bok-tekst: #c9cfdb; --bok-akt: #2d3446;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--tlo); color: var(--tekst); }
a { color: var(--akcent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 10px 0 6px; }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
pre { background: #f6f8fa; padding: 10px; border-radius: 6px; overflow: auto; }
pre.surowe { max-height: 400px; }

.app { display: flex; min-height: 100vh; }
.bok { width: 250px; flex: 0 0 250px; background: var(--bok); color: var(--bok-tekst); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { padding: 16px 16px 10px; font-weight: 700; font-size: 17px; }
.logo a { color: #fff; }
.logo small { font-weight: 400; color: #7d869a; font-size: 11px; margin-left: 6px; }
.statusy-nav { flex: 1; padding: 0 8px 12px; }
.statusy-nav .poz { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; color: var(--bok-tekst); font-size: 13px; }
.statusy-nav .poz:hover { background: var(--bok-akt); text-decoration: none; color: #fff; }
.statusy-nav .poz.akt { background: var(--akcent); color: #fff; }
.statusy-nav .poz > span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statusy-nav .poz > b { font-weight: 600; }
.statusy-nav .poz i { font-style: normal; min-width: 22px; height: 18px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; text-shadow: 0 0 2px rgba(0,0,0,.5); }
.grupa summary { cursor: pointer; padding: 10px 8px 4px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #fff; list-style: none; }
.grupa summary::-webkit-details-marker { display: none; }
.grupa summary::after { content: " ▾"; color: #7d869a; }
.grupa:not([open]) summary::after { content: " ▸"; }
.grupa summary span { color: #7d869a; font-weight: 400; }
.menu-dol { border-top: 1px solid #2d3446; padding: 10px 16px; display: flex; flex-direction: column; gap: 6px; }
.menu-dol a, .menu-dol .link { color: var(--bok-tekst); font-size: 13px; }
.menu-dol a.akt { color: #fff; font-weight: 700; }
button.link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-align: left; }

.tresc { flex: 1; min-width: 0; padding: 18px 22px 40px; }
.naglowek { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.wstecz { font-size: 13px; display: inline-block; margin-bottom: 4px; }
.szary { color: var(--szary); }
.maly { font-size: 12px; }
.nowrap { white-space: nowrap; }
.pr, .tabela .pr { text-align: right; }

.karta { background: var(--karta); border: 1px solid var(--linia); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.waska-karta { max-width: 420px; }
.siatka { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 14px; }
.siatka > .karta { margin-bottom: 0; }
.uwagi { border-left: 4px solid var(--pom); }

input, select, button, textarea { font: inherit; }
input:not([type=checkbox]):not([type=color]), select { border: 1px solid #cfd4dc; border-radius: 6px; padding: 6px 8px; background: #fff; min-width: 0; }
input[type=color] { width: 38px; height: 30px; border: 1px solid #cfd4dc; border-radius: 6px; padding: 2px; }
.przycisk { border: 1px solid #cfd4dc; background: #fff; border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.przycisk:hover { background: #f3f4f6; }
.przycisk.glowny { background: var(--akcent); border-color: var(--akcent); color: #fff; }
.przycisk.glowny:hover { background: var(--akcent-ciemny); }
.przycisk.niebezp { color: var(--czerw); }
.stos { display: flex; flex-direction: column; gap: 10px; }
.stos label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.wiersz-formularza { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.szeroki { width: 100%; max-width: 320px; }
.grupa-nazwa { font-weight: 700; }
.waski { width: 70px; }
form.inline { display: inline; }
.filtry { display: flex; gap: 6px; flex-wrap: wrap; }
.filtry input[type=search] { width: 260px; }

.tabela { width: 100%; border-collapse: collapse; background: #fff; }
.tabela th { text-align: left; font-size: 12px; color: var(--szary); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--linia); }
.tabela td { padding: 8px; border-bottom: 1px solid var(--linia); vertical-align: top; }
.tabela tfoot td { border-bottom: 0; padding: 4px 8px; }
.tabela.lista { border: 1px solid var(--linia); border-radius: 8px; overflow: hidden; }
.tabela.lista tbody tr { cursor: pointer; }
.tabela.lista tbody tr:hover { background: #f8fafc; }
.tabela.lista tbody tr.zazn { background: #eef4ff; }
.tabela.lista tr.anul td { opacity: .6; }
.tabela .ch { width: 30px; }
.tabela .pusto { text-align: center; color: var(--szary); padding: 30px; cursor: default; }
.tabela.pola td { padding: 3px 6px; font-size: 12px; }
.tabela.dziennik td { font-size: 12px; padding: 4px 8px; }
.tabela.dziennik tr.blad td { color: var(--czerw); }
.nr { font-weight: 700; margin-left: 4px; }

.st { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; color: #fff; background: var(--k); text-shadow: 0 0 2px rgba(0,0,0,.4); white-space: nowrap; }
.sk { display: inline-block; padding: 1px 5px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--k); border: 1px solid var(--k); vertical-align: middle; }
.znacz { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; background: #e5e7eb; color: #374151; vertical-align: middle; }
.znacz.ziel { background: #dcfce7; color: #166534; }
.znacz.czerw { background: #fee2e2; color: #991b1b; }
.znacz.pom { background: #ffedd5; color: #9a3412; }
.znacz.pobr { background: #fef9c3; color: #854d0e; }

.pasek-zbiorczy { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; background: #1e2330; color: #fff; padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; }
.pasek-zbiorczy[hidden] { display: none; }
.zmiana-statusu { display: flex; gap: 8px; align-items: center; }
.notatka { display: flex; gap: 8px; margin-bottom: 10px; }
.notatka input { flex: 1; }
.historia { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.historia li { padding: 4px 0; border-bottom: 1px dashed var(--linia); }
.stronicowanie { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 14px; }

.komunikat { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.komunikat.ok { background: #dcfce7; color: #14532d; }
.komunikat.blad { background: #fee2e2; color: #7f1d1d; }
.kroki { margin: 0 0 10px; padding-left: 18px; }
.kroki .ok { color: var(--ziel); }
.kroki .blad { color: var(--czerw); font-weight: 600; }

.strona-logowania { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.logowanie { width: 360px; display: flex; flex-direction: column; gap: 10px; }
.logowanie label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.logowanie h1 { font-size: 22px; }
.logowanie p { margin: 0 0 6px; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .bok { width: auto; flex: none; height: auto; position: static; max-height: 45vh; }
  .tresc { padding: 12px; }
  .tabela.lista th:nth-child(4), .tabela.lista td:nth-child(4) { display: none; }
}
