:root {
  --tlo: #f5f3ee; --karta: #fff; --tekst: #1c2422; --szary: #5d6864; --linia: #dfdbd2;
  --ziel: #1f3d36; --ziel2: #e3eee9; --czer: #a4291d; --czer2: #fbe9e6; --zolt: #7a5300; --zolt2: #fdf2d6;
  --pasek: #1f3d36; --na-ziel: #fff; --pole: #fff; --pole-linia: #aeb5b1; --szary2: #ebe8e1;
  --uw-tlo: #fff4d6; --uw-tekst: #5c4400; --zla-linia: #eec5bf; --dobra-linia: #c5dad1;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--tekst); background: var(--tlo);
}
:root[data-motyw="ciemny"] {
  --tlo: #111614; --karta: #1b2320; --tekst: #eaf0ed; --szary: #a7b3ad; --linia: #2f3a36;
  --ziel: #7fd1b5; --ziel2: #1a332b; --czer: #ff9d90; --czer2: #3b201c; --zolt: #f2c96b; --zolt2: #352a12;
  --pasek: #16302a; --na-ziel: #0d1a16; --pole: #232d29; --pole-linia: #4a5751; --szary2: #2a332f;
  --uw-tlo: #352a12; --uw-tekst: #f2c96b; --zla-linia: #5c322b; --dobra-linia: #2c4f43;
  color-scheme: dark;
}
html { background: var(--tlo); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
h1 { font-size: 20px; margin: 0; } h2 { font-size: 19px; margin: 0; }
.top { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--pasek); color: #fff; }
.okres { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.okres input { font: inherit; min-height: 36px; padding: 4px 6px; border: 0; border-radius: 6px; max-width: 165px; background: var(--pole); color: var(--tekst); }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
.karty { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.karta { background: var(--karta); border: 1px solid var(--linia); border-radius: 10px; padding: 12px; min-width: 0; }
.karta small { display: block; color: var(--szary); font-size: 12.5px; line-height: 1.3; min-height: 2.6em; }
.karta b { display: block; font-size: 20px; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.karta.zla { background: var(--czer2); border-color: var(--zla-linia); } .karta.zla b { color: var(--czer); }
.karta.dobra { background: var(--ziel2); border-color: var(--dobra-linia); }
.akcje { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--ziel); border-radius: 8px; background: var(--karta); color: var(--ziel); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; text-align: center; }
.btn.glowny { background: var(--ziel); color: var(--na-ziel); }
.btn.maly { min-height: 36px; font-size: 13px; padding: 4px 10px; }
.btn.niebezpieczny { color: var(--czer); border-color: var(--czer); }
.btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #e0a526; outline-offset: 1px; }
label.btn:focus-within { outline: 3px solid #e0a526; outline-offset: 1px; }
.baner { background: var(--zolt2); color: var(--zolt); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; line-height: 1.4; }
.postep { font-size: 14px; color: var(--szary); margin: 8px 0; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wiersz { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px; text-align: left; background: var(--karta); border: 1px solid var(--linia); border-radius: 10px; font: inherit; color: inherit; cursor: pointer; }
.wiersz .nazwa { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiersz .kwota { font-weight: 700; font-variant-numeric: tabular-nums; }
.wiersz .meta { color: var(--szary); font-size: 13px; }
.znacznik { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 99px; justify-self: end; align-self: start; background: var(--ziel2); color: var(--ziel); }
.znacznik.sprawdz { background: var(--zolt2); color: var(--zolt); }
.znacznik.alert-z { background: var(--czer2); color: var(--czer); }
.znacznik.szary { background: var(--szary2); color: var(--szary); }
.pusto { text-align: center; color: var(--szary); padding: 28px 8px; }
.zastrzezenie { font-size: 12.5px; color: var(--szary); line-height: 1.45; margin-top: 18px; }
.dol { position: fixed; inset: auto 0 0; z-index: 2; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--karta); border-top: 1px solid var(--linia); padding-bottom: env(safe-area-inset-bottom); }
.dol button { min-height: 56px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--szary); cursor: pointer; }
.dol button.aktywny { color: var(--ziel); box-shadow: inset 0 3px 0 var(--ziel); }
.formularz { display: grid; gap: 12px; margin-top: 12px; }
.formularz label { display: grid; gap: 4px; font-size: 13.5px; font-weight: 600; min-width: 0; }
.formularz input:not([type=checkbox]), .formularz select { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; font: inherit; font-size: 16px; font-weight: 400; border: 1px solid var(--pole-linia); border-radius: 7px; background: var(--pole); color: var(--tekst); }
.formularz label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 22px; height: 22px; flex: none; }
.dwa { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset { border: 1px solid var(--linia); border-radius: 8px; padding: 10px; margin: 0; min-width: 0; }
legend { font-size: 13.5px; font-weight: 600; padding: 0 4px; }
.poz { display: grid; grid-template-columns: 70px 1fr 1fr 36px; gap: 6px; margin-bottom: 8px; align-items: end; }
.poz .usun-poz { min-height: 44px; border: 1px solid var(--linia); border-radius: 7px; background: var(--pole); color: var(--czer); cursor: pointer; font-size: 18px; }
.poz input, .poz select { padding: 8px 5px !important; }
dialog { width: min(560px, 100vw); max-width: 100vw; max-height: 100dvh; padding: 16px; border: 0; border-radius: 12px; color: var(--tekst); background: var(--karta); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
.dlg-gora, .dlg-dol { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dlg-dol { position: sticky; bottom: -16px; background: var(--karta); padding: 10px 0; }
.dlg-dol .glowny { flex: 1; }
#podglad { width: 100%; max-height: 260px; object-fit: contain; background: #222; border-radius: 8px; }
.problemy, .powody { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.35; }
.problemy li { background: var(--zolt2); color: var(--zolt); padding: 7px 9px; border-radius: 6px; }
.powody li { color: var(--szary); }
.alert { background: var(--czer2); color: var(--czer); padding: 8px 10px; border-radius: 6px; font-size: 14px; margin: 0; }
@media (min-width: 720px) {
  .karty { grid-template-columns: repeat(4, 1fr); }
  .akcje { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

body.prywatny .tylko-firma, body:not(.prywatny) .tylko-prywatny { display: none !important; }
.pola-firmy { display: contents; }
.wg-kategorii { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.wg-kategorii li { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 14px; }
.wg-kategorii i { grid-column: 1 / -1; display: block; height: 6px; border-radius: 3px; background: var(--ziel); }
.wybor { border: 0; border-radius: 14px; padding: 20px; width: min(92vw, 420px); }
.wybor h2 { margin: 0 0 14px; font-size: 20px; }
.wybor .btn { display: block; width: 100%; margin-bottom: 10px; padding: 14px; text-align: left; font-weight: 700; }
.wybor small { display: block; margin-top: 4px; font-weight: 400; }

.naglowek-pomocnicze { margin: 22px 0 4px; font-size: 17px; }
.uwaga-pomocnicze { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--uw-tlo); color: var(--uw-tekst); font-size: 14px; }

.ustawienie { display: grid; gap: 6px; margin-top: 12px; font-size: 13.5px; font-weight: 600; }
.przelacznik { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--szary2); border-radius: 10px; }
.przelacznik button { min-height: 42px; border: 0; border-radius: 7px; background: none; color: var(--szary); font: inherit; font-weight: 600; cursor: pointer; }
.przelacznik button[aria-pressed="true"] { background: var(--karta); color: var(--ziel); box-shadow: 0 1px 3px rgb(0 0 0 / .25); }
.instalacja { margin-top: 18px; padding: 12px; background: var(--karta); border: 1px solid var(--linia); border-radius: 10px; font-size: 14px; line-height: 1.4; }
.instalacja h3 { margin: 0 0 4px; font-size: 15px; }
.instalacja p { margin: 0 0 8px; color: var(--szary); }
.instalacja p:last-child { margin-bottom: 0; }

.logowanie { max-width: 420px; margin: 0 auto; padding: 48px 20px; }
.logowanie h2 { margin-top: 12px; }
.logo-duze { width: 64px; height: 64px; border-radius: 18px; background: var(--ziel); color: var(--na-ziel); font: 700 36px/64px Georgia, serif; text-align: center; }
.logowanie a { color: var(--ziel); }

.szeroki { width: 100%; margin: 8px 0 18px; }
.klucze { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.klucze li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }

.przyciski-konta { display: grid; gap: 8px; margin: 8px 0; }
.info-ai { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--ziel2); color: var(--tekst); font-size: 13.5px; }
.instalacja a { color: var(--ziel); }

.w-linii { display: flex; gap: 8px; margin-top: 12px; }
.w-linii input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 10px; font: inherit; font-size: 16px; border: 1px solid var(--pole-linia); border-radius: 7px; background: var(--pole); color: var(--tekst); }
.zakupy { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.zakupy li { display: flex; align-items: center; gap: 8px; background: var(--karta); border: 1px solid var(--linia); border-radius: 10px; padding: 0 6px 0 0; }
.zakupy label { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; cursor: pointer; font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.zakupy input[type=checkbox] { width: 24px; height: 24px; flex: none; accent-color: var(--ziel); }
.zakupy .kto { font-size: 12px; color: var(--szary); }
.zakupy.kupione label span:first-of-type { text-decoration: line-through; color: var(--szary); }
.zakupy .usun-poz { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--czer); font-size: 20px; cursor: pointer; }
