.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.kz [hidden] { display: none !important; }
.kz { display: grid; gap: 28px; align-items: start; }
.kz-form { display: grid; gap: 22px; }
.kz-form fieldset { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 8px; min-width: 0; background: var(--bg-card); }
.kz-form legend { font-family: var(--font-head); font-weight: 700; font-size: 1rem; padding: 0 8px; color: var(--navy); }
.kz-field { margin-bottom: 16px; }
.kz-field > label, .kz-label { display: block; font-family: var(--font-head); font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; color: var(--navy); }
.kz-hint { font-size: 0.82rem; line-height: 1.45; margin: 6px 0 0; color: var(--text-muted); }
.kz-err { display: block; font-size: 0.85rem; font-weight: 600; line-height: 1.4; margin-top: 6px; color: #B42318; }
.kz-err::before { content: "\26A0\00a0"; }
.kz-row { display: flex; gap: 10px; align-items: center; }

.kz-form input[type=number] {
  width: 100%; max-width: 200px; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-card); color: var(--text); font: inherit; font-weight: 600; font-size: 1.05rem;
}
.kz-form input[type=number][readonly] { max-width: 90px; text-align: center; background: var(--bg); }
.kz-form input:focus-visible, .kz-form button:focus-visible, .kz-seg input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }
.kz-form input[aria-invalid=true] { border: 2px dashed #B42318; }

.kz-form input[type=range] { width: 100%; height: 34px; margin: 6px 0 0; background: transparent; accent-color: var(--navy); cursor: pointer; }
.kz-form input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 8px; background: var(--line); }
.kz-form input[type=range]::-moz-range-track { height: 8px; border-radius: 8px; background: var(--line); }
.kz-form input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--navy); }
.kz-form input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--navy); }

.kz-step { flex: none; width: 44px; height: 44px; border: 1px solid var(--navy); border-radius: 10px; background: var(--bg-card); color: var(--navy);
  font: inherit; font-weight: 700; font-size: 1.3rem; line-height: 1; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.kz-step:hover { border-color: var(--amber); color: var(--amber-hover); }
.kz-step:active { transform: translateY(1px); }

.kz-tryb { display: grid; gap: 8px; margin-bottom: 16px; }
.kz-seg { position: relative; display: block; }
.kz-seg input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; }
.kz-seg span { display: block; padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-family: var(--font-head); font-weight: 600; font-size: 0.9rem; text-align: center; transition: border-color 0.15s, background-color 0.15s, color 0.15s; }
.kz-seg:hover span { border-color: var(--amber); }
.kz-seg input:checked + span { background: var(--navy); border-color: var(--navy); color: #FAF8F4; }
.kz-seg:hover input:checked + span { border-color: var(--navy); }

.kz-form .btn { justify-self: start; }

.kz-wynik { background: var(--sage-tint); color: var(--text); border: 1px solid var(--line); border-left: 6px solid transparent; border-radius: var(--radius); padding: 22px 20px; min-height: 340px; }
.kz-wynik.is-zapas { border-left-color: var(--sage); }
.kz-wynik.is-granica { border-left-color: var(--amber); }
.kz-wynik.is-przekracza, .kz-wynik.is-napiety { border-left-color: var(--text-muted); background: var(--bg-card); }
.kz-pusty { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.02rem; line-height: 1.5; }
.kz-blad { font-weight: 600; }
.kz-stan { display: flex; gap: 12px; align-items: center; margin: 0; font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; line-height: 1.25; color: var(--navy); }
.kz-stan svg { flex: none; width: 46px; height: 46px; color: var(--sage-dark); }
.kz-wynik.is-granica .kz-stan svg { color: var(--amber-hover); }
.kz-wynik.is-przekracza .kz-stan svg, .kz-wynik.is-napiety .kz-stan svg { color: var(--text-muted); }
.kz-rata { margin: 16px 0 0; line-height: 1.3; }
.kz-kwota-do { margin: 14px 0 0; line-height: 1.3; }
.kz-etykieta { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }
.kz-liczba { display: block; font-family: var(--font-head); font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); }
.kz-prog { margin: 14px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 0.82rem; line-height: 1.55; background: var(--bg-card); }
.kz-tips { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; font-size: 0.9rem; line-height: 1.5; }
.kz-tips li { padding-left: 16px; position: relative; }
.kz-tips li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--sage); }
.kz-ustaw { display: inline-block; margin-top: 4px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--navy); border-radius: 999px; background: var(--bg-card);
  color: var(--navy); font: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.kz-ustaw:hover { background: var(--navy); color: #FAF8F4; }
.kz-ustaw:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.kz-skladniki { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.kz-skladniki summary { cursor: pointer; font-family: var(--font-head); font-weight: 600; font-size: 0.9rem; list-style: none; }
.kz-skladniki summary::-webkit-details-marker { display: none; }
.kz-skladniki summary::after { content: "+"; float: right; font-weight: 600; }
.kz-skladniki[open] summary::after { content: "\2013"; }
.kz-skladniki dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; margin: 10px 0 0; font-size: 0.85rem; }
.kz-skladniki dt, .kz-skladniki dd { margin: 0; }
.kz-skladniki dd { text-align: right; font-weight: 600; }
.kz-skladniki .kz-sum { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 700; }
.kz-przypis { margin: 16px 0 0; font-size: 0.8rem; line-height: 1.55; color: var(--text-muted); }
.kz-cta { margin: 16px 0 0; }
.kz-cta .btn { width: 100%; justify-content: center; }
.kz-pomoc { margin: 14px 0 0; font-weight: 500; line-height: 1.55; font-size: 0.92rem; }
.kz-pomoc a { font-weight: 600; }
.kz-wsk { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; font-weight: 600; margin: 6px 0 0; color: var(--text); }
.kz-wsk-kropka { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text-muted); }
.kz-wsk[data-stan=zapas] .kz-wsk-kropka { background: var(--sage); }
.kz-wsk[data-stan=granica] .kz-wsk-kropka { background: var(--amber); }
.kz-wsk[data-stan=przekracza] .kz-wsk-kropka, .kz-wsk[data-stan=napiety] .kz-wsk-kropka { background: var(--text-muted); }
.kz-noscript { margin: 14px 0 0; font-size: 0.9rem; line-height: 1.55; }

.kz-pasek[hidden], .kz-pasek [hidden] { display: none !important; }
.kz-pasek { position: sticky; top: 0; z-index: 19; display: flex; gap: 10px; align-items: center; margin: 0 -20px 14px; padding: 10px 20px;
  background: var(--sage-tint); color: var(--text); box-shadow: var(--shadow); font-family: var(--font-head); font-weight: 600; font-size: 0.88rem; border-left: 6px solid transparent; border-bottom: 1px solid var(--line); }
.kz-pasek svg { flex: none; width: 22px; height: 22px; color: var(--sage-dark); }
.kz-pasek-rata { margin-left: auto; white-space: nowrap; }
.kz-pasek-stan { min-width: 0; }
.kz-pasek svg[data-stan=granica] { color: var(--amber-hover); }
.kz-pasek svg[data-stan=przekracza], .kz-pasek svg[data-stan=napiety] { color: var(--text-muted); }
.kz-pasek:has(> svg:not([hidden])[data-stan=zapas]) { border-left-color: var(--sage); }
.kz-pasek:has(> svg:not([hidden])[data-stan=granica]) { border-left-color: var(--amber); }
.kz-pasek:has(> svg:not([hidden])[data-stan=przekracza]), .kz-pasek:has(> svg:not([hidden])[data-stan=napiety]) { border-left-color: var(--text-muted); background: var(--bg-card); }

@keyframes kz-blysk { from { box-shadow: 0 0 0 4px rgba(232, 150, 46, 0.45); } to { box-shadow: 0 0 0 4px transparent; } }
.kz-wynik.is-zmiana, .kz-pasek.is-zmiana { animation: kz-blysk .8s ease-out; }

#kz-tabela th, #kz-tabela td { text-align: right; white-space: nowrap; }
#kz-tabela th:first-child, #kz-tabela td:first-child { text-align: left; }
#kz-tabela thead th { vertical-align: bottom; white-space: normal; }
.kz-tabela-podpis { margin-top: 12px; }

@media (min-width: 992px) {
  .kz-pasek { display: none !important; }
  .kz { grid-template-columns: minmax(0, 1fr) 440px; gap: 40px; }
  .kz-wynik { position: sticky; top: 24px; }
  .kz-tryb { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .kz *, .kz-step, .kz-ustaw { transition: none !important; animation: none !important; }
  .kz-wynik.is-zmiana, .kz-pasek.is-zmiana { animation: none !important; }
}
