/* Biblia Prepersa
   Układ: niebieski pas obrony cywilnej z pomarańczowym trójkątem, przyklejone zakładki,
   podręcznik w kolumnie do czytania (~70 znaków) z panelem bocznym, narzędzia w siatkach. */
:root {
  --base: 16px;
  --bg: #eef1f4; --surface: #ffffff; --sunk: #e4e9ee; --fg: #14202b; --muted: #566373; --line: #cfd7df;
  --accent: #e8590c; --accent-fg: #ffffff; --link: #1d5c9e;
  --band: #1d3a5f; --band-fg: #f4f7fa; --band-muted: #a9bdd3;
  --ok: #2b7a4b; --warn: #a85f06; --bad: #b42318; --ok-bg: #e3f2e8; --warn-bg: #fbf0dc; --bad-bg: #fbe5e3;
  --mark: #ffe08a;
  --display: "Saira Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d141b; --surface: #15202b; --sunk: #1b2834; --fg: #e5ebf1; --muted: #93a2b2; --line: #2a3846;
    --accent: #ff7a33; --accent-fg: #1a0d04; --link: #7db4ec;
    --band: #14304f; --band-fg: #eef3f8; --band-muted: #8fa9c6;
    --ok: #5cc98a; --warn: #f0a63a; --bad: #ff7266; --ok-bg: #132b1f; --warn-bg: #2e2310; --bad-bg: #331816;
    --mark: #6b5310; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d141b; --surface: #15202b; --sunk: #1b2834; --fg: #e5ebf1; --muted: #93a2b2; --line: #2a3846;
  --accent: #ff7a33; --accent-fg: #1a0d04; --link: #7db4ec;
  --band: #14304f; --band-fg: #eef3f8; --band-muted: #8fa9c6;
  --ok: #5cc98a; --warn: #f0a63a; --bad: #ff7266; --ok-bg: #132b1f; --warn-bg: #2e2310; --bad-bg: #331816;
  --mark: #6b5310; color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: var(--base); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 1rem; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--band); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.native .no-native { display: none !important; }
a { color: var(--link); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--accent); color: var(--accent-fg); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1160px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.label { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow { margin: 0 0 4px; font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

/* ---------- nagłówek ---------- */
header.band { background: var(--band); color: var(--band-fg); padding-top: env(safe-area-inset-top, 0px); }
.band-inner { display: flex; align-items: center; gap: 14px; padding-block: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.mark { width: 40px; height: 40px; flex: none; background: var(--band-fg); border-radius: 50%; display: grid; place-items: center; }
.mark span { width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 24px solid var(--accent); transform: translateY(-2px); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.6rem; letter-spacing: .01em; }
.brand-sub { font-size: .78rem; color: var(--band-muted); margin-top: 3px; }
.search { flex: 1; min-width: 200px; display: flex; justify-content: flex-end; }
.search input { width: 100%; max-width: 380px; height: 40px; border-radius: 8px; border: 1px solid transparent; background: rgba(255,255,255,.12); color: var(--band-fg); padding: 0 12px; font: 1rem var(--body); }
.search input::placeholder { color: var(--band-muted); }
.search input:focus { background: var(--surface); color: var(--fg); outline: 2px solid var(--accent); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; color: var(--band-fg); border: 1px solid rgba(255,255,255,.25); }
.icon-btn:hover { border-color: var(--band-fg); }
@media (max-width: 560px) { .search { order: 3; flex-basis: 100%; } .search input { max-width: none; } .brand { flex: 1; } }

nav.tabs { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs-inner { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
nav.tabs a { font-weight: 600; font-size: .9rem; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; padding: 13px 12px 10px; white-space: nowrap; }
nav.tabs a:hover { color: var(--fg); }
nav.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }

main { flex: 1; outline: none; }
#view { padding-block: 24px 56px; display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
#view > * { min-width: 0; }

h1, h2, h3, h4 { text-wrap: balance; }
.page-h, .hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.05; margin: 0; }
.lead { color: var(--muted); margin: 6px 0 0; max-width: 68ch; font-size: 1.05rem; }
.sec-h { font-family: var(--display); font-size: 1.4rem; margin: 0 0 10px; }

/* ---------- strona główna ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: center; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.hero-tools { display: grid; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
a.tile { text-decoration: none; color: inherit; }
a.tile:hover { border-color: var(--accent); }
.tile-t { font-family: var(--display); font-weight: 600; font-size: 1.3rem; line-height: 1.15; }
.tile .note { font-size: .82rem; color: var(--muted); }
.hero-tile, a.tile.hero-tile { background: var(--band); color: var(--band-fg); border-color: var(--band); }
.hero-tile .label, .hero-tile .note { color: var(--band-muted); }
.emergency { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 860px) { .emergency { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.em { display: grid; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); border-left: 4px solid var(--warn); color: var(--fg); text-decoration: none; font-size: .88rem; }
.em.bad { background: var(--bad-bg); border-left-color: var(--bad); }
.em strong { font-family: var(--display); font-size: 1.15rem; }
.em:hover { filter: brightness(1.03); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-size: .9rem; }
.chip:hover { border-color: var(--accent); }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 400px) { .modules { grid-template-columns: minmax(0, 1fr); } }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 12px; }
.module h2 { font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1.1; margin: 0; }
.module header p.muted { margin: 6px 0 0; font-size: .92rem; }
.chap-list { list-style: none; margin: 0; padding: 0; display: grid; }
.chap-list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.chap-list a:hover .chap-t { color: var(--accent); }

/* ---------- rozdział ---------- */
.crumbs { display: flex; gap: 8px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.chapter-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .chapter-layout { grid-template-columns: minmax(0, 1fr); } .side { order: -1; } }
.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); display: grid; gap: 12px; }
@media (max-width: 900px) { .side { position: static; } .side-box { display: flex; flex-wrap: wrap; align-items: center; } .side-box.toc { display: none; } }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; }
.side-box p { margin: 0; }
.toc a { font-size: .88rem; color: var(--fg); text-decoration: none; padding: 3px 0; }
.toc a:hover { color: var(--accent); }

.prose { max-width: 72ch; min-width: 0; }
.prose h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.8rem, 4vw, 2.3rem); line-height: 1.08; margin: 0 0 14px; }
.prose h3 { font-family: var(--display); font-weight: 600; font-size: 1.4rem; margin: 30px 0 8px; padding-top: 10px; border-top: 1px solid var(--line); scroll-margin-top: 70px; }
.prose h4 { font-size: 1rem; margin: 20px 0 6px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 1.4em; display: grid; gap: 4px; }
.prose li > ul, .prose li > ol { margin: 4px 0 0; }
.prose ul.tasks { list-style: none; padding-left: 0; gap: 0; }
.prose li.task label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.prose li.task label:hover { background: var(--sunk); }
.prose li.task.done span { text-decoration: line-through; color: var(--muted); }
.prose .tbl-wrap { margin: 4px 0 16px; }
.prose strong { font-weight: 600; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.callout { border-left: 4px solid var(--warn); background: var(--warn-bg); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 4px 0 16px; font-size: .95rem; }
.callout.bad { border-left-color: var(--bad); background: var(--bad-bg); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pg { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--fg); text-decoration: none; display: grid; gap: 2px; font-weight: 600; }
.pg.next { text-align: right; }
.pg:hover { border-color: var(--accent); }

/* ---------- wyszukiwarka ---------- */
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.results a { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--fg); text-decoration: none; }
.results a:hover { border-color: var(--accent); }
.res-mod { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.res-t { font-family: var(--display); font-weight: 600; font-size: 1.3rem; }
.res-s { color: var(--muted); font-size: .9rem; }

/* ---------- narzędzia ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: grid; gap: 16px; min-width: 0; }
.panel h2 { font-family: var(--display); font-size: 1.35rem; margin: 0; }
.panel p { margin: 0; }
.calc { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .calc { grid-template-columns: minmax(0, 1fr); } }
.results-col, .stack { display: grid; gap: 14px; min-width: 0; }
.stack:empty { display: none; }
.group { display: grid; gap: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: 0; }
.row .name { min-width: 0; }
.row .name small { display: block; color: var(--muted); font-size: .78rem; }
.stepper { display: flex; align-items: center; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sunk); }
.stepper button { width: 36px; height: 36px; border: 0; background: none; color: var(--fg); font: 600 1.1rem var(--body); cursor: pointer; }
.stepper button:hover { background: var(--line); }
.stepper input { width: 46px; height: 36px; border: 0; border-inline: 1px solid var(--line); background: var(--surface); color: var(--fg); text-align: center; font: 500 .95rem var(--mono); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { font: 500 .85rem var(--body); color: var(--fg); background: var(--sunk); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.inline { display: flex; align-items: center; gap: 8px; }
.field { height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); padding: 0 10px; font: 500 .9rem var(--mono); min-width: 0; width: 100%; }
.field.w80 { width: 84px; }
.btn { display: inline-flex; align-items: center; justify-content: center; font: 600 .9rem var(--body); border-radius: 8px; padding: 9px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--fg); text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: none; color: var(--muted); }
.btn.danger-btn { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile .big { font-family: var(--display); font-weight: 700; font-size: 2.1rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile .big small { font-size: 1.1rem; font-weight: 600; margin-left: 3px; }

.tbl-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: .92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--sunk); }
tr:last-child td { border-bottom: 0; }
td.q { text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
th.q { text-align: right; }
.w-chk { width: 56px; }
tr.done td { opacity: .55; }
tr.done td.item { text-decoration: line-through; }
tr.sum td { font-weight: 600; background: var(--sunk); }
.chk { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex: none; }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); font-family: var(--mono); }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.prog-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; }
.progress { height: 8px; background: var(--sunk); border-radius: 999px; overflow: hidden; flex: 1; max-width: 320px; }
.progress i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .25s; }
.copybox { width: 100%; height: 160px; font: .82rem var(--mono); background: var(--sunk); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }

.dev-table td { padding: 6px 8px; }
.dev-table .num-in { text-align: right; }
.rm { border: 0; background: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; }
.rm:hover { color: var(--bad); }
.params { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.params label { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); }

.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
@media (max-width: 400px) { .ref-grid { grid-template-columns: minmax(0, 1fr); } }
.ref { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 8px; align-content: start; }
.ref h2 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 0; }
.ref .formula { font-family: var(--mono); font-size: .88rem; background: var(--sunk); padding: 8px 10px; border-radius: 6px; }
.ref ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: .9rem; }
.ref .tag { color: var(--accent); font-weight: 600; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.ref .more { font-size: .85rem; font-weight: 600; text-decoration: none; }

.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.check-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; border-radius: 8px; }
.check-list li:hover { background: var(--sunk); }
.check-list li label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; cursor: pointer; flex: 1; }
.check-list li > a { padding: 10px 12px; white-space: nowrap; }
.check-list li.done label > span { text-decoration: line-through; color: var(--muted); }
.check-list .why { display: block; color: var(--muted); font-size: .8rem; }

.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 400px) { .settings { grid-template-columns: minmax(0, 1fr); } }
.panel.danger { border-color: var(--bad); }

/* ---------- stopka i powiadomienia ---------- */
.foot-bar { border-top: 1px solid var(--line); background: var(--surface); font-size: .82rem; color: var(--muted); padding-bottom: env(safe-area-inset-bottom, 0px); }
.foot-bar .wrap { padding-block: 16px; display: grid; gap: 4px; }
.foot-bar p { margin: 0; max-width: 90ch; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 500; z-index: 40; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100% - 32px); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- druk ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --sunk: #f2f2f2; --fg: #000; --muted: #444; --line: #bbb; --warn-bg: #fff; --bad-bg: #fff; color-scheme: light; }
  html { font-size: 11pt; }
  header.band, nav.tabs, .foot-bar, .side, .pager, .crumbs, .toolbar, .toast, .skip, body::before { display: none !important; }
  .chapter-layout { display: block; }
  .prose { max-width: none; }
  .tbl-wrap { overflow: visible; border: 0; }
  table { min-width: 0; }
  tr, .callout, li { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .callout { border: 1px solid #000; border-left-width: 4px; }
}

/* ---------- magazyn ---------- */
.inv-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.inv-form label { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); min-width: 0; }
.inv-form .f-name { grid-column: span 2; }
.inv-form .f-note { grid-column: span 3; }
.inv-form .f-btns { grid-column: 1 / -1; }
@media (max-width: 760px) { .inv-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .inv-form .f-name, .inv-form .f-note { grid-column: 1 / -1; } }
.field.txt { font-family: var(--body); font-size: .95rem; }
select.field { padding-right: 6px; }
.inv-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 640px) { .inv-filters { grid-template-columns: minmax(0, 1fr); } }
.qty-ctl { display: inline-flex; align-items: center; gap: 6px; }
.qb { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--sunk); color: var(--fg); font: 600 1rem var(--body); cursor: pointer; line-height: 1; }
.qb:hover { border-color: var(--accent); }
.qv { min-width: 64px; text-align: center; }
.acts { white-space: nowrap; text-align: right; }
.btn.sm { padding: 5px 10px; font-size: .8rem; }
.acts .btn + .btn { margin-left: 4px; }
td.empty { padding: 22px 16px; color: var(--muted); white-space: normal; }
tr.editing td { background: var(--warn-bg); }
tr.ok-row td { opacity: .7; }
.have-in { width: 90px; text-align: right; }
.big.t-bad { color: var(--bad); } .big.t-warn { color: var(--warn); }
@media (max-width: 640px) {
  #inv-table { min-width: 0; }
  #inv-table thead { display: none; }
  #inv-table tbody { display: block; }
  #inv-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px; border-bottom: 1px solid var(--line); }
  #inv-table tr:last-child { border-bottom: 0; }
  #inv-table td { display: block; padding: 0; border: 0; min-width: 0; }
  #inv-table td.item { grid-column: 1 / -1; font-weight: 600; }
  #inv-table td.q { text-align: left; }
  #inv-table td.acts { grid-column: 1 / -1; text-align: left; }
  #inv-table td.empty { grid-column: 1 / -1; }
  #norm-table, #shop-table { min-width: 0; font-size: .85rem; }
  #norm-table th, #norm-table td, #shop-table th, #shop-table td { padding: 8px 6px; }
  .have-in { width: 68px; }
}
.need-m { display: none; }
@media (max-width: 640px) {
  #shop-table .c-need { display: none; }
  #shop-table .need-m { display: inline; }
}

/* ---------- tryb kryzysowy ---------- */
nav.tabs a.tab-crisis { color: var(--bad); }
nav.tabs a.tab-crisis[aria-current="page"] { border-bottom-color: var(--bad); }
.crisis-bar { display: grid; gap: 2px; padding: 16px 18px; border-radius: 12px; background: var(--bad); color: #fff; text-decoration: none; }
.crisis-bar strong { font-family: var(--display); font-size: 1.6rem; line-height: 1.1; }
.crisis-bar span { font-size: .9rem; opacity: .92; }
.crisis-bar:hover { filter: brightness(1.06); }
.home-tiles { margin-top: -6px; }
.crisis-head .page-h { color: var(--bad); }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
@media (max-width: 400px) { .sc-grid { grid-template-columns: minmax(0, 1fr); } }
.sc { display: grid; gap: 4px; align-content: start; padding: 16px; border-radius: 12px; text-decoration: none; color: var(--fg); background: var(--warn-bg); border-left: 6px solid var(--warn); min-height: 96px; }
.sc.bad { background: var(--bad-bg); border-left-color: var(--bad); }
.sc strong { font-family: var(--display); font-size: 1.45rem; line-height: 1.1; }
.sc span { font-size: .88rem; color: var(--muted); }
.sc .pill { justify-self: start; margin-top: 4px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li label { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 1.12rem; line-height: 1.45; }
.steps li.done label { opacity: .6; }
.steps li.done label > span { text-decoration: line-through; }
.steps .why { display: block; font-size: .8rem; color: var(--ok); text-decoration: none; }
.big-chk { width: 28px; height: 28px; margin-top: 1px; }
.tq { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 10px; border: 2px dashed var(--bad); background: var(--surface); }
.tq > div { display: grid; gap: 2px; min-width: 0; flex: 1 1 240px; }
.tq .note { font-size: .85rem; color: var(--muted); }
.tq.on { border-style: solid; background: var(--bad-bg); }
.tq-time { font-family: var(--display); font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--bad); font-variant-numeric: tabular-nums; }
.tq .field { max-width: 200px; }

/* ---------- formularze ogólne ---------- */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.fgrid label, .mem label { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); min-width: 0; }
.fgrid label.wide { grid-column: 1 / -1; }
.sec-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.sec-row .sec-h, .sec-row h2 { margin: 0; }
.ta { height: 96px; padding: 8px 10px; resize: vertical; }
.mem-list { display: grid; gap: 12px; }
.mem { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); }
.mem label.wide { grid-column: span 3; }
.mem .btn-row { grid-column: 1 / -1; }
@media (max-width: 640px) { .mem { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .mem label.wide { grid-column: 1 / -1; } }
.card-pre { margin: 0; white-space: pre-wrap; font: .85rem/1.55 var(--mono); background: var(--sunk); padding: 12px; border-radius: 8px; overflow-wrap: anywhere; }

/* ---------- narzędzia ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 400px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }
.wide-panel { grid-column: 1 / -1; }
.result { background: var(--sunk); border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 0 8px 8px 0; }
.result p { margin: 6px 0 0; }
table.mini { min-width: 0; }
.metro { display: grid; place-items: center; width: 150px; height: 150px; border-radius: 50%; border: 6px solid var(--line); margin: 4px auto; }
.metro span:first-child { font-family: var(--display); font-weight: 700; font-size: 3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.metro .note { font-size: .75rem; color: var(--muted); margin-top: -28px; }
.metro.on { border-color: var(--bad); }
.metro.pulse { animation: pulse .25s ease-out; }
@keyframes pulse { from { transform: scale(1.08); background: var(--bad-bg); } to { transform: scale(1); background: transparent; } }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 360px; overflow-y: auto; }
.log li { padding: 6px 8px; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.log .num { color: var(--muted); font-size: .8rem; margin-right: 6px; }
.ov { position: fixed; inset: 0; z-index: 60; background: #000; display: grid; }
.sos-screen { position: relative; display: grid; place-items: center; background: #000; color: #555; }
.sos-screen.lit { background: #fff; }
.sos-screen .btn { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px)); }
.sos-txt { font-family: var(--display); font-size: 3rem; font-weight: 700; color: #444; }
.sos-txt.dark { font-size: 1.2rem; color: #888; }
.photo-ov { display: grid; gap: 12px; place-items: center; align-content: center; padding: 16px; background: rgba(0,0,0,.92); color: #fff; }
.photo-ov img { max-width: 100%; max-height: 75vh; border-radius: 8px; }
.photo-ov .btn { justify-self: end; }

/* ---------- zdjęcia w magazynie ---------- */
.f-photo { grid-column: 1 / -1; display: grid; gap: 4px; }
.label-s { font-size: .82rem; color: var(--muted); }
.photo-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.sm-thumb { width: 44px; height: 44px; float: left; margin: 0 10px 4px 0; cursor: zoom-in; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 400px) { .tiles.two { grid-template-columns: minmax(0, 1fr); } }



/* ---------- teczka do druku ---------- */
.native-only { display: none; }
.native .native-only { display: block; }
.dossier { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: grid; gap: 22px; min-width: 0; }
.ds-head h1 { font-family: var(--display); font-size: 2rem; margin: 0; }
.ds-head p { margin: 4px 0 0; color: var(--muted); }
.ds-sec h2 { font-family: var(--display); font-size: 1.45rem; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--fg); }
.ds-sec h3 { font-size: 1rem; margin: 12px 0 6px; }
.ds-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.ds-sc ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; counter-reset: s; }
.ds-sc li { counter-increment: s; display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; }
.ds-sc li::before { content: counter(s) "."; font-weight: 600; min-width: 1.4em; }
.ds-sc .box { order: -1; width: 14px; height: 14px; border: 1.5px solid var(--fg); border-radius: 2px; flex: none; margin-top: 3px; }
.ds-refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.ds-refs > div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ds-refs h3 { margin: 0 0 4px; }
.ds-refs p { margin: 0 0 4px; font-size: .9rem; }
.ds-refs ul { margin: 0; padding-left: 1.1em; font-size: .85rem; }
.ds-tbl { width: 100%; min-width: 0; border-collapse: collapse; font-size: .85rem; }
.ds-tbl th, .ds-tbl td { border: 1px solid var(--line); padding: 5px 7px; }
.ds-foot { color: var(--muted); font-size: .8rem; margin: 0; }
.dossier .tbl-wrap { border: 0; }
.share-sets { display: grid; gap: 2px; }
.share-sets label { display: flex; gap: 10px; align-items: center; padding: 8px 4px; cursor: pointer; }
.callout.ok-call { border-left-color: var(--ok); background: var(--ok-bg); }
@media (max-width: 640px) { .dossier { padding: 14px; } .ds-tbl { font-size: .75rem; } }
@media print {
  .crisis-bar, .home-tiles, .tq, .ov, .no-print, .chip-row { display: none !important; }
  .dossier { border: 0; padding: 0; gap: 14px; }
  .ds-break { break-before: page; }
  .ds-sc { break-inside: avoid; }
  .ds-tbl th, .ds-tbl td { border-color: #888; }
  .card-pre { background: #fff; border: 1px solid #888; }
}
.dossier > * { min-width: 0; }
.ds-sec { overflow-x: auto; }
@media print { .ds-sec { overflow: visible; } }
@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #ffffff; --surface: #ffffff; --sunk: #f2f2f2; --fg: #000000; --muted: #444444; --line: #bbbbbb;
    --link: #000000; --warn-bg: #ffffff; --bad-bg: #ffffff; --ok-bg: #ffffff; color-scheme: light;
  }
  body { background: #fff; color: #000; }
}
@media (max-width: 640px) {
  #g-table, #a-table { min-width: 0; }
  #g-table thead, #a-table thead { display: none; }
  #g-table tbody, #a-table tbody { display: block; }
  #g-table tr, #a-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px; border-bottom: 1px solid var(--line); }
  #g-table td, #a-table td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  #g-table td.item, #a-table td.item, #g-table td.acts, #a-table td.acts, #g-table td.empty, #a-table td.empty { grid-column: 1 / -1; }
  #g-table td.item, #a-table td:first-child { font-weight: 600; }
}

/* ---------- biblioteka ---------- */
.lib-cat h3 { margin: 0; font-family: var(--display); font-size: 1.2rem; }
.lib-list { list-style: none; margin: 0; padding: 0; display: grid; }
.lib-list li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.lib-list li > div { min-width: 0; }
.lib-list p { margin: 4px 0 0; }
.lib-list a, .lib-miss a { white-space: nowrap; }
.steps-plain { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }

/* ---------- przepisy ---------- */
.rcp-eq button { display: grid; gap: 0; text-align: left; border-radius: 10px; padding: 8px 14px; }
.rcp-eq button span { font-size: .75rem; opacity: .8; }
.rcp-card summary, .rcp summary, .rcp-other summary { cursor: pointer; list-style: none; }
.rcp-card summary::-webkit-details-marker, .rcp summary::-webkit-details-marker { display: none; }
.rcp-card summary h2::after { content: ' ▾'; color: var(--muted); font-size: .9rem; }
.rcp-card[open] summary h2::after { content: ' ▴'; }
.rcp-card .callout { margin: 0; }
.rcp-card .callout p, .rcp-card .callout ul { margin: 6px 0 0; }
.rcp-card .callout ul { padding-left: 1.2em; display: grid; gap: 4px; }
.rcp-filters { display: grid; gap: 10px; margin: 18px 0 6px; }
.rcp-filters .chip { cursor: pointer; font: inherit; font-size: .9rem; }
.rcp-filters .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.rcp-list { display: grid; gap: 8px; margin-bottom: 20px; }
.rcp { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.rcp > summary { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; padding: 12px 14px; }
.rcp[open] > summary { border-bottom: 1px solid var(--line); }
.rcp-t { font-weight: 600; }
.rcp-star { color: var(--warn); }
.rcp-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.rcp-body { padding: 14px; display: grid; gap: 12px; min-width: 0; }
.rcp-body p { margin: 0; }
.rcp-body h3 { font-size: 1rem; margin: 0 0 6px; }
.rcp-body ul, .rcp-body ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.rcp-cols { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .rcp-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); } }
.rcp-proc { margin: 0; }
.rcp-proc p { margin-top: 4px; }
.callout.ok { border-left-color: var(--ok); background: var(--ok-bg); }
.rcp .callout { margin: 0; }
.rcp-other summary { color: var(--accent); font-size: .9rem; }
.rcp-other ul { margin-top: 8px; font-size: .9rem; }

/* ---------- mapa offline ---------- */
.mp-reg { display: grid; gap: 10px; }
.mp-reg label { display: grid; gap: 4px; font-size: .9rem; }
.mp-have { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; font-size: .9rem; }
.mp-wrap { position: relative; margin: 18px 0 6px; }
.mp-map { height: 62vh; min-height: 320px; max-height: 720px; border-radius: 12px; border: 1px solid var(--line); background: var(--sunk); overflow: hidden; position: relative; }
.mp-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); font-size: .95rem; z-index: 1; pointer-events: none; }
.mp-empty[hidden] { display: none; }
.mp-tools { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 3; max-width: calc(100% - 60px); }
.mp-tools .btn { box-shadow: 0 1px 4px rgba(0,0,0,.25); background: var(--surface); }
.mp-cross { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; z-index: 3; pointer-events: none; }
.mp-cross::before, .mp-cross::after { content: ''; position: absolute; background: var(--bad); }
.mp-cross::before { left: 16px; top: 0; width: 2px; height: 34px; }
.mp-cross::after { top: 16px; left: 0; height: 2px; width: 34px; }
.mp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mp-list > li { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; transition: background .3s; }
.mp-list > li.flash { background: var(--warn-bg); }
.mp-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; margin-top: 5px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.mp-li-b { display: grid; gap: 3px; min-width: 0; flex: 1; }
.mp-li-b strong { margin-right: 4px; }
.mp-dist { display: block; color: var(--ok); font-size: .88rem; font-weight: 600; }
.mp-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.mp-list .sm-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: none; }
.rt-sel { margin: 4px 0 8px; padding-left: 1.4em; display: grid; gap: 4px; }
.rt-sel .rm { margin-left: 6px; }
#rt-add .chip { cursor: pointer; font: inherit; font-size: .85rem; }
.maplibregl-ctrl-attrib { font-size: 11px; }
.mp-li-b .pill { justify-self: start; }

/* ---------- konto i pełna wersja ---------- */
.upsell { display: grid; gap: 8px; justify-items: start; padding: 16px; border-radius: 12px; border: 2px solid var(--accent); background: var(--surface); }
.upsell p { margin: 0; color: var(--muted); font-size: .92rem; }
.up-badge { font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.acc-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .acc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.acc-form { display: grid; gap: 10px; }
.acc-form label { display: grid; gap: 4px; font-size: .9rem; }
.acc-form .acc-chk { display: flex; gap: 8px; align-items: flex-start; }
.acc-row { grid-template-columns: minmax(0, 1fr) auto; }
.acc-msg:empty { display: none; }
.acc-status.is-full { border-color: var(--ok); }
.t-ok { color: var(--ok); font-weight: 600; } .t-bad { color: var(--bad); }
table.cmp { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.cmp th, table.cmp td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.cmp td:nth-child(n+2), table.cmp th:nth-child(n+2) { text-align: center; white-space: nowrap; }
table.pay-t { border-collapse: collapse; margin-top: 8px; font-size: .92rem; }
table.pay-t td { padding: 4px 10px 4px 0; vertical-align: middle; word-break: break-all; }
.rcp-locked summary .rcp-t { color: var(--muted); }
.cta-bt { display: grid; gap: 2px; padding: 12px 16px; margin: 8px 0 12px; border-radius: 10px; background: var(--band, #1d3a5f); color: #fff; text-decoration: none; border-left: 6px solid var(--accent); }
.cta-bt span { font-size: .88rem; opacity: .9; }
.tbl-wrap table.cmp { min-width: 0; width: 100%; }
table.cmp th, table.cmp td { white-space: normal; }
table.cmp td:nth-child(n+2), table.cmp th:nth-child(n+2) { white-space: normal; width: 22%; font-size: .85rem; }
.lockq { font-size: 1.2rem; opacity: .7; }
.tier-band { display: grid; gap: 2px; padding: 12px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--accent); }
.tier-band.t1 { border-left-color: var(--ok); } .tier-band.t2 { border-left-color: #1c7ed6; } .tier-band.t3 { border-left-color: var(--warn); } .tier-band.t4 { border-left-color: var(--bad); }
.wycena { border-color: var(--accent); }
.kit-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kc h3 { margin: 10px 0 0; font-size: 1.05rem; }
.kc-t { width: 100%; border-collapse: collapse; }
.kc-t th, .kc-t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.kc-t th { width: 34%; font-weight: 600; font-size: .9rem; }
.kc-t td { display: grid; gap: 6px; }
.kc-person { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) auto; gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); margin-bottom: 4px; align-items: center; }
.kc-send { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.kc-send label { display: grid; gap: 4px; font-size: .9rem; }
@media (max-width: 640px) {
  .kc-t th, .kc-t td { display: block; width: auto; }
  .kc-t th { border-bottom: 0; padding-bottom: 2px; }
  .kc-send { grid-template-columns: minmax(0, 1fr); }
}
.kc-t th { white-space: normal; text-transform: none; letter-spacing: 0; font-size: .92rem; overflow-wrap: anywhere; }
