/* Read at arm's length, by people with gloves and older eyes (DESIGN.md §6, §12):
   black on white, big type, big targets, one decision per screen.

   The look comes from the warehouse, not from software: a galvanised-grey
   page, black for "you act here" (the one primary button, a picked card),
   colour only for a state, and the code plate - the code drawn the way it is
   painted or printed on the ladder (.code, the same letters as the labels),
   so "D07" on the screen and on the rungs look alike. Barlow is a road-sign
   face; Barlow Condensed is only for codes and big numbers (public/fonts,
   OFL, cached offline by sw.js).
   Everything is in rem so the "A+" button (html.big) scales the whole app.

   Building blocks, used the same way on every screen:
   .item   one piece of equipment: NAME first and big, code as a small tag
   .place  one location with what is there (where-is view, board)
   .steps  where you are in a flow (1 Kto → 2 Co → 3 Dokąd)
   .code   the code plate; never shrink it below .85rem
   .panel  a white section on the grey page
   .stats  number tiles; .table for lists of facts

   Rules that keep new screens consistent (docs/UX-AUDIT.md §10):
   1. Colours only from the tokens below. Every status also says a word;
      never put `opacity` on text that carries meaning.
   2. Sizes from .78 / .85 / 1 / 1.1 / 1.5 / 1.8 rem; nothing under .78rem.
   3. Grid columns are minmax(min(<n>rem, 100%), 1fr), so A+ never makes a
      phone scroll sideways.
   4. Actions at least 3rem tall (.mini 2.6rem only in owners' lists); the
      main flow uses --tap.
   5. One .primary per screen; .danger only for undo, "not OK" answers and
      irreversible actions, which live inside the edit form.
   6. Generic words (now, label, what) only nested under their component:
      two collisions have happened already.
   7. A selectable control says so in ARIA (aria-pressed / aria-selected);
      messages the app shows by itself go in #status.
   8. One <h1> per screen naming the thing or the question. */

@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(/fonts/barlow-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(/fonts/barlow-latin-ext-500.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-latin-ext-700.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Barlow"; font-weight: 800; font-display: swap; src: url(/fonts/barlow-latin-800.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 800; font-display: swap; src: url(/fonts/barlow-latin-ext-800.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-ext-700.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --ink: #000000;
  --muted: #4a5361;
  /* Text on a black (picked or active) surface. */
  --muted-inv: #c3cad0;
  /* Dividers only; the edge of something you press is --edge (3:1 on the page). */
  --line: #c3cad0;
  --edge: #737c85;
  --page: #dfe3e6;
  --paper: #ffffff;
  --soft: #edf0f2;
  --act: #000000;
  --act-ink: #ffffff;
  --go: #0a6b2d;
  --go-soft: #e1f2e7;
  --warn: #7a4a00;
  --warn-soft: #fff0d1;
  --bad: #a30000;
  --bad-soft: #ffe3e3;
  /* Two corners by hierarchy: soft for what you press, almost square for
     the plates and sheets that stand for physical things. */
  --radius: .5rem;
  --plate: .12rem;
  --tap: 4.25rem;
  color-scheme: light;
  font-size: 19px;
}
@media (min-width: 700px) {
  :root { font-size: 21px; }
}
html.big { font-size: 26px; }
@media (min-width: 700px) {
  html.big { font-size: 29px; }
}

* { box-sizing: border-box; }
/* `hidden` must win over a component's own display (a row is flex, a panel grid). */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body {
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
/* Focus moved to a new screen's title for screen readers; not a control. */
h1[tabindex="-1"]:focus { outline: none; }
.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;
}
@media (max-width: 699px) {
  .wide-only { display: none; }
}
details > summary { padding: .6rem 0; cursor: pointer; }

.loading { padding: 1rem; }

/* ---- frame --------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .75rem; background: var(--paper); color: var(--ink);
  border-bottom: 4px solid var(--ink);
}
.top a.home { display: inline-block; padding: .5rem 0; color: var(--ink); font-weight: 800; text-decoration: none; font-size: 1.1rem; }
.top .who { margin-left: auto; font-size: .85rem; text-align: right; }
.top button {
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink);
  border-radius: .5rem; padding: .2rem .55rem; min-height: 2.4rem; font-weight: 700;
}
.status { padding: .5rem .75rem; font-size: .9rem; font-weight: 600; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
/* Empty but present: it is the screen reader's live region (app.js). */
.status:empty { padding: 0; }
.status.pending { background: var(--warn-soft); color: var(--warn); }
.status.offline { background: var(--soft); color: var(--muted); }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.status.ok { background: var(--go-soft); color: var(--go); }

main { padding: .9rem .75rem 7.5rem; max-width: 62rem; margin: 0 auto; display: grid; gap: .9rem; align-content: start; }
main.wide { max-width: 90rem; }
h1 { font-size: 1.5rem; font-weight: 800; line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-size: 1.1rem; font-weight: 800; margin: 0; }
h3 { font-size: 1rem; font-weight: 800; margin: 0; }
p { margin: 0; }
.lead { color: var(--muted); margin-top: -.4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem; display: grid; gap: .7rem; min-width: 0; }
/* Without this one unbreakable line in a card widens the whole column past
   the panel (seen with A+ on a phone). */
.panel > *, .items > * { min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ---- buttons -------------------------------------------------------------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); width: 100%; padding: .55rem 1rem;
  border: 3px solid var(--ink); border-radius: var(--radius); background: var(--paper);
  font-size: 1.1rem; font-weight: 700; text-align: center; text-decoration: none; color: var(--ink);
  cursor: pointer;
}
.btn.primary { background: var(--act); border-color: var(--act); color: var(--act-ink); }
.btn.go { background: var(--go); border-color: var(--go); color: #fff; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.slim { min-height: 3rem; font-size: 1rem; }
/* Disabled reads as an outline, not faded: its text is often the instruction
   ("Zaznacz, co bierzesz"). */
.btn:disabled, .btn.primary:disabled { background: var(--paper); border-color: var(--line); color: var(--muted); cursor: default; }
.btn .sub { display: block; font-size: .8rem; font-weight: 500; }
.btn.stack { flex-direction: column; gap: .1rem; }
.btns { display: grid; gap: .6rem; }
.btn.back { width: auto; min-height: 2.8rem; border-width: 2px; font-size: .95rem; padding: .2rem .8rem; justify-self: start; }

.mini {
  min-height: 2.6rem; padding: .2rem .75rem; border: 2px solid var(--ink); border-radius: .5rem;
  background: var(--paper); font-size: .85rem; font-weight: 700; text-decoration: none; color: var(--ink);
  display: inline-flex; align-items: center; cursor: pointer; white-space: nowrap;
}
.mini.primary { background: var(--act); border-color: var(--act); color: var(--act-ink); }
.mini.go { border-color: var(--go); color: var(--go); }
.mini.danger { border-color: var(--bad); color: var(--bad); }

.home-grid { display: grid; gap: .8rem; }
.home-grid .btn { min-height: 6.5rem; font-size: 1.45rem; }
/* The owners' links are secondary: normal button size, not the big tiles. */
.home-grid .btn.slim { min-height: var(--tap); font-size: 1.1rem; }
.home-grid > * { min-width: 0; }
@media (min-width: 700px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
}
/* The wall tablet's home is nothing but its tiles, read from across the
   room and hit with a gloved hand: they share the whole screen. */
#app:has(> main.kiosk-home) { min-height: 100dvh; display: flex; flex-direction: column; }
main.kiosk-home { flex: 1; width: 100%; padding-bottom: .9rem; grid-template-rows: 1fr; }
.kiosk-home .home-grid { grid-auto-rows: 1fr; }
.kiosk-home .home-grid .btn { font-size: clamp(1.45rem, 5vmin, 2.8rem); }
.kiosk-home .home-grid .btn .sub { font-size: clamp(.8rem, 2.2vmin, 1.25rem); }

/* ---- tags and chips --------------------------------------------------------- */
.code {
  display: inline-block; font-family: "Barlow Condensed", "Barlow", system-ui, sans-serif; font-weight: 700;
  font-size: 1rem; letter-spacing: .03em; padding: .02rem .4rem; border: 2.5px solid var(--ink); border-radius: var(--plate);
  background: var(--paper); color: var(--ink); vertical-align: middle; line-height: 1.15; white-space: nowrap;
}
/* A tag, like the red card on the shelf: square enough to wrap cleanly. */
/* nowrap would push a long label ("Przegląd: 05.11.2026 – po terminie" with A+ on a phone) out of its card; short ones still sit on one line. */
.chip { display: inline-block; padding: .05rem .5rem; border-radius: .25rem; font-size: .78rem; font-weight: 800; max-width: 100%; }
.chip.bad { background: var(--bad); color: #fff; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border: 2px solid var(--warn); }
.chip.ok { background: var(--go); color: #fff; }
.chip.info { background: var(--soft); color: var(--muted); }

/* ---- flow header ------------------------------------------------------------ */
.flowhead { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.steps { display: flex; gap: .3rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font-size: .85rem; font-weight: 700; }
.steps li { padding: .2rem .65rem; border-radius: 1rem; background: var(--soft); color: var(--muted); }
.steps li.now { background: var(--act); color: var(--act-ink); }
.steps li.done { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* ---- items ------------------------------------------------------------------ */
.items { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(13rem, 100%), 1fr)); }
.item {
  position: relative; display: grid; gap: .25rem; align-content: start; text-align: left;
  min-height: 5.6rem; padding: .65rem .75rem; border: 2px solid var(--edge); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); cursor: pointer; text-decoration: none;
  grid-template-columns: minmax(0, 1fr) auto; column-gap: .6rem;
}
/* The plate sits top right, beside the name; everything else is one column. */
.item > * { grid-column: 1; }
.item > .code { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
/* A+ on a phone: the plate beside the name left "Rusztowanie" no room and it broke mid-word; the plate goes under the name. */
@media (max-width: 480px) { html.big .item > .code { grid-column: 1; grid-row: auto; justify-self: start; } }
.item .name { font-size: 1.1rem; font-weight: 800; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
.item .meta { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
/* Picked = the card turns black, plus a tick in the words: no colour needed. */
.item.picked { border-color: var(--act); background: var(--act); color: var(--act-ink); }
.item.picked .meta { color: var(--muted-inv); }
.item.picked .name::before { content: "✓ "; }
/* A damaged card can't be ticked, but its red reason stays fully readable. */
.item:disabled { cursor: default; }
.item:disabled .name, .item:disabled .meta { color: var(--muted); }
.item.damaged { border-color: var(--bad); }
.item .chip { white-space: normal; }
@media (max-width: 699px) {
  .item { min-height: 4.2rem; }
}

.count {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem;
  border: 2px solid var(--edge); border-radius: var(--radius); background: var(--paper);
}
.count.picked { border-color: var(--act); background: var(--act); color: var(--act-ink); }
.count.picked .muted { color: var(--muted-inv); }
.count .what { flex: 1; min-width: 0; }
.count .what strong { font-size: 1.05rem; }
.count button {
  width: 3.4rem; height: 3.4rem; border: 2px solid var(--ink); border-radius: .6rem;
  background: var(--paper); color: var(--ink); font-size: 1.6rem; font-weight: 800; cursor: pointer;
}
.count .n { min-width: 2rem; text-align: center; font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 1.7rem; font-weight: 700; }
/* On a phone the − 0 + would squeeze the name into a narrow column: the
   name gets its own line and − 0 + share the next one, the buttons taking
   what is left – with A+ fixed-size buttons did not fit and + fell a line. */
@media (max-width: 480px) {
  .count { display: grid; grid-template-columns: minmax(2.75rem, 1fr) auto minmax(2.75rem, 1fr); }
  .count .what { grid-column: 1 / -1; }
  .count button { width: auto; }
}

.filters { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .1rem; }
.filters button {
  flex: 0 0 auto; min-height: 2.8rem; padding: .2rem .9rem; border: 2px solid var(--ink);
  border-radius: 2rem; background: var(--paper); font-weight: 700; cursor: pointer;
}
.filters button.on { background: var(--ink); color: var(--paper); }
/* Choices that must all stay visible (the parts of a broken kit), not scroll sideways. */
.filters.wrap { flex-wrap: wrap; overflow: visible; }

.more { justify-self: start; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 2px solid var(--line);
}
.bar .inner { max-width: 62rem; margin: 0 auto; display: grid; gap: .4rem; }
.bar .chosen { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .btn { margin: 0; }

.chosen-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.chosen-list span { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); border-radius: 1rem; padding: .1rem .6rem; font-weight: 700; font-size: .85rem; }

/* ---- one asset ---------------------------------------------------------------- */
.asset-head { display: grid; gap: .25rem; }
.asset-head .name { font-size: 1.8rem; font-weight: 900; line-height: 1.1; }
.asset-head .meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; color: var(--muted); }
/* On its own page the plate is the size of the painted number. */
.asset-head .code { font-size: 1.8rem; border-width: 3.5px; padding: .05rem .55rem; }
h2.ask { font-size: 1.5rem; line-height: 1.15; }
.nowbox {font-size: 1.05rem; padding: .65rem .8rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.banner { padding: .65rem .8rem; border-radius: var(--radius); font-weight: 700; display: grid; gap: .5rem; }
.banner.bad { background: var(--bad-soft); color: var(--bad); border: 2px solid var(--bad); }
.banner.warn { background: var(--warn-soft); color: var(--warn); border: 2px solid var(--warn); }
.banner .btn { color: var(--ink); }
.banner .btn.go { color: #fff; }
.banner .plainlist { margin: 0; padding-left: 1.2rem; font-weight: 600; }
/* The banner sits above Biorę: its buttons share a row so it stays short on a phone. */
.banner .links .btn { flex: 1 1 6rem; }
.links { display: flex; gap: .6rem; flex-wrap: wrap; }
.links .btn { width: auto; flex: 1 1 12rem; }
.history { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.history li { padding: .4rem 0; border-bottom: 1px solid var(--line); }

.done { text-align: center; padding-top: 1.2rem; }
.done .tick { font-size: 4.5rem; line-height: 1; color: var(--go); }
.done .what { list-style: none; padding: 0; margin: 0; display: grid; gap: .2rem; font-size: 1.15rem; font-weight: 700; }
.done .to { font-size: 1.3rem; font-weight: 800; }

/* ---- PIN (tablet after "Kim jesteś?", phone login) ------------------------------ */
/* Its own number pad: big keys for gloves, and no phone keyboard covering
   half the screen. Kept to a column a thumb can cover on the wall tablet. */
.pindots { display: flex; gap: .9rem; justify-content: center; padding: .4rem 0; }
.pindots span { width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 3px solid var(--ink); background: var(--paper); }
.pindots span.on { background: var(--ink); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; width: 100%; max-width: 24rem; justify-self: center; }
.pinpad .btn { font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 1.8rem; }
/* Shown to an owner once, to read out. */
.pinshow { font-family: "Barlow Condensed", "Barlow", sans-serif; font-weight: 700; font-size: 3rem; letter-spacing: .3em; line-height: 1.1; }
/* The lists under the search box on "Co bierzesz?", spaced like main. */
.pick-lists { display: grid; gap: .9rem; min-width: 0; }

/* ---- places (where-is / board) ------------------------------------------------- */
.search { width: 100%; min-height: var(--tap); padding: .5rem .8rem; font-size: 1.2rem; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper); }
.places { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); align-items: start; }
.place { background: var(--paper); border: 1px solid var(--line); border-radius: var(--plate); overflow: hidden; }
.place header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .55rem .75rem; background: var(--soft); }
.place header h3 { font-size: 1.05rem; }
.place header .kind { font-size: .8rem; color: var(--muted); font-weight: 700; }
.place.warehouse header { background: var(--ink); color: var(--paper); }
.place.warehouse header .kind { color: var(--muted-inv); }
.place ul { list-style: none; margin: 0; padding: 0; }
.place li a { display: grid; gap: .1rem; padding: .5rem .75rem; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.place li:first-child a { border-top: 0; }
.place li .n1 { font-weight: 800; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.place li .n2 { font-size: .82rem; color: var(--muted); }

/* ---- rows, tables, stats ------------------------------------------------------- */
.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows li .grow { flex: 1 1 11rem; min-width: 0; }
/* What "Więcej" opens: the row's other actions, on a line of their own. */
.rows li > .row-more { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .5rem; padding-bottom: .2rem; }
.rows li > .row-more[hidden] { display: none; }

.stats { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr)); }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; display: grid; gap: .1rem; }
.stat .v { font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 2rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .k { font-size: .82rem; color: var(--muted); font-weight: 600; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
/* On a wide screen keep the name and its place within one glance. */
.table-wrap .table { max-width: 60rem; }
.table th, .table td { text-align: left; padding: .45rem .5rem; border-top: 1px solid var(--line); vertical-align: top; }
.table thead th { border-top: 0; font-size: .82rem; font-weight: 700; color: var(--muted); }
.table tr.group th { background: var(--soft); font-size: .95rem; }
.table td.num { white-space: nowrap; color: var(--muted); }

.allclear { display: flex; gap: .5rem; align-items: center; color: var(--go); font-weight: 700; }

/* ---- forms --------------------------------------------------------------------- */
form.panel { margin: 0; }
.field { display: grid; gap: .2rem; font-size: .9rem; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 3rem; padding: .35rem .5rem;
  border: 2px solid var(--ink); border-radius: .5rem; background: var(--paper);
}
.choice { display: grid; gap: .4rem; }
.choice label {
  display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .65rem; border: 2px solid var(--edge);
  border-radius: .6rem; cursor: pointer; font-weight: 600; background: var(--paper);
}
.choice label:has(input:checked) { border: 3px solid var(--ink); background: var(--soft); }
.choice input { width: 1.4rem; height: 1.4rem; margin: .1rem 0 0; flex: 0 0 auto; }
.choice .hint { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); }
.field.check { display: flex; gap: .5rem; align-items: center; }
.field.check input { width: 1.5rem; height: 1.5rem; min-height: 0; }
.row2 { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); }

/* Wrapped, not scrolled: on a phone the last tabs were off-screen unseen. */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.tabs button {
  flex: 0 0 auto; min-height: 2.8rem; padding: .2rem .9rem; border: 2px solid var(--ink);
  border-radius: 2rem; background: var(--paper); font-weight: 700; cursor: pointer;
}
.tabs button.on { background: var(--ink); color: var(--paper); }

.linkbox { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.linkbox .qr { width: 11rem; height: 11rem; }
.linkbox .qr svg { width: 100%; height: 100%; }
.linkbox code { word-break: break-all; font-size: .8rem; }

.scan video { width: 100%; max-height: 60vh; background: #000; border-radius: var(--radius); }

/* ---- label sheets: A4 at true size ----------------------------------------------- */
.sheets { overflow-x: auto; }
.sheet {
  width: 210mm; height: 297mm; background: #fff; margin: 0 auto 1rem; position: relative;
  box-shadow: 0 0 0 1px var(--line); display: grid; align-content: start;
}
.sheet.l7160 { padding: 15.15mm 0 0 7.25mm; grid-template-columns: repeat(3, 63.5mm); grid-auto-rows: 38.1mm; column-gap: 2.54mm; }
.sheet.l7165 { padding: 13.1mm 0 0 4.65mm; grid-template-columns: repeat(2, 99.1mm); grid-auto-rows: 67.7mm; column-gap: 2.5mm; }
.label { display: flex; gap: 2mm; align-items: center; padding: 2.5mm; overflow: hidden; outline: 1px dashed #bbb; color: #000; }
.label .qr { flex: 0 0 auto; }
.label .qr svg { width: 100%; height: 100%; display: block; }
.label .txt { min-width: 0; line-height: 1.1; }
.label .lcode { font-family: "Barlow Condensed", "Barlow", sans-serif; font-weight: 700; }
.label .lname { font-weight: 700; }
.label .lhint, .label .lown { color: #000; }
.l7160 .label .qr { width: 31mm; height: 31mm; }
.l7160 .label .lcode { font-size: 11mm; }
.l7160 .label .lname { font-size: 3.2mm; margin-top: 1mm; }
.l7160 .label .lhint { font-size: 2.4mm; margin-top: 1mm; }
.l7160 .label .lown { font-size: 2.2mm; margin-top: .8mm; }
.l7165 .label { padding: 4mm; gap: 4mm; }
.l7165 .label .qr { width: 56mm; height: 56mm; }
.l7165 .label .lcode { font-size: 17mm; }
.l7165 .label .lname { font-size: 4.5mm; margin-top: 2mm; }
.l7165 .label .lhint { font-size: 3.4mm; margin-top: 2mm; }
.l7165 .label .lown { font-size: 3mm; margin-top: 1.5mm; }


/* ---- Godziny (hours) ------------------------------------------------------------ */
.weeknav { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.weeknav strong { font-size: 1.1rem; flex: 1 1 auto; text-align: center; }
.weeknav .btn { width: auto; min-width: 3rem; }
.week { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
/* One day of the paper card: the day, the boss's column, the worker's. */
.wday { width: 100%; display: grid; gap: .3rem .8rem; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); align-items: start;
  text-align: left; background: var(--paper); color: var(--ink); border: 2px solid var(--edge); border-radius: var(--radius); padding: .7rem .8rem; min-height: var(--tap); cursor: pointer; }
.wday .dname { font-weight: 800; font-size: 1.1rem; grid-column: 1 / -1; }
.wday .col { display: grid; gap: .1rem; }
.wday .who { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wday .chip { justify-self: start; grid-column: 1 / -1; }
.wday.open { border-color: var(--warn); background: var(--warn-soft); }
.wday.future { border-style: dashed; color: var(--muted); cursor: default; }
.lines { display: grid; gap: .15rem; margin: 0; }
.lines .tot, .wday .tot { font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 1.1rem; }
.two-cols { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); }
.warn-text { color: var(--warn); font-weight: 700; }
fieldset.seg-edit { border: 1px solid var(--line); display: grid; gap: .7rem; }
fieldset.seg-edit legend { font-weight: 800; padding: 0 .3rem; }
.day-edit { display: grid; gap: .9rem; }
.timefield { display: grid; gap: .2rem; font-weight: 600; font-size: .9rem; }
/* The time box keeps room for "16:30" even with A+ on a phone; the −/+ give way first, never below 44 px. */
.stepper { display: grid; grid-template-columns: minmax(2.75rem, var(--tap)) minmax(4.2rem, 1fr) minmax(2.75rem, var(--tap)); gap: .3rem; }
.stepper .btn { width: auto; min-height: var(--tap); font-size: 1.5rem; padding: 0; }
.stepper input { min-height: var(--tap); font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 1.5rem; font-weight: 700; text-align: center;
  border: 2px solid var(--edge); border-radius: var(--radius); background: var(--paper); color: var(--ink); min-width: 0; padding: 0 .2rem; }
/* The boss's week: people x days. */
/* Seven equal day columns whatever is in them ("7:30 / 9:00" used to push
   Thursday wider than the rest); today's is underlined. */
.hgrid { max-width: none; table-layout: fixed; }
.table-wrap .hgrid { max-width: none; }
.hgrid thead th:first-child { width: 9rem; }
.hgrid thead th.num { width: 5rem; text-align: right; }
.hgrid thead th.today { color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }
.hgrid th.off, .hcard tr.off td { background: var(--soft); }
.hgrid td { padding: .2rem; }
.hgrid tbody th, .hgrid td.num { vertical-align: middle; }
.hgrid td.num { text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
/* Two actions above the grid, as wide as their words - not half a screen each. */
.links.hours-actions .btn { flex: 0 1 auto; }
.hcell { width: 100%; min-height: 3rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink);
  font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 1.05rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.hcell.empty { color: var(--muted); font-weight: 500; }
.hcell.open, .hrow.open { border-color: var(--warn); background: var(--warn-soft); }
.hcell.selfonly, .hrow.selfonly { border-style: dashed; border-color: var(--warn); }
.hcell.agreed, .hcell.resolved { border-color: var(--go); }
/* The month sheet: the owners' paper sheet. Days down, people across, one
   number a day. The table is as wide as the page and its columns share it
   (no sideways scrolling up to a dozen people), so the row of names can stay
   under the app's top bar while the days scroll. */
.hsheet { table-layout: fixed; max-width: none; font-size: .92rem; }
.hsheet thead th { position: sticky; top: var(--top-h, 0px); z-index: 2; background: var(--page); color: var(--ink); font-size: .9rem; text-align: center;
  overflow-wrap: anywhere; box-shadow: inset 0 -2px 0 var(--ink); }
.hsheet thead th:first-child, .hsheet tbody th, .hsheet tfoot th { width: 5.2rem; text-align: left; }
.hsheet tbody th { font-weight: 600; color: var(--muted); white-space: nowrap; vertical-align: middle; padding: .1rem .4rem; }
.hsheet tbody th .dnum { display: inline-block; min-width: 1.3rem; font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.hsheet tbody td { padding: .12rem; border-top: 0; }
.hsheet tbody tr.off th, .hsheet tbody tr.off td { background: var(--soft); }
.hsheet tbody tr.today th { box-shadow: inset 4px 0 0 var(--ink); color: var(--ink); }
.hsheet .hcell { min-height: 2.5rem; display: grid; align-content: center; justify-items: center; gap: 0; padding: 0 .1rem; line-height: 1.1; }
.hsheet .hcell.empty { border-color: transparent; background: transparent; }
.hsheet tbody tr:not(.off) .hcell.empty { border-color: var(--line); background: var(--paper); }
.hsheet .hcell.sel { outline: 3px solid var(--ink); outline-offset: 1px; }
.hsheet .hcell .site { font-family: "Barlow", sans-serif; font-size: .78rem; font-weight: 600; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hsheet tfoot th { font-size: .85rem; color: var(--muted); vertical-align: middle; }
.hsheet tfoot td { text-align: center; vertical-align: middle; overflow-wrap: anywhere; }
.hsheet tfoot tr.sum td, .hsheet tfoot tr.sum th { border-top: 2px solid var(--ink); }
.hsheet tfoot tr.sum td { font-family: "Barlow Condensed", "Barlow", sans-serif; font-size: 1.15rem; }
/* The money rows: set apart, like the handwriting under the paper's table. */
.hsheet tfoot tr.money td, .hsheet tfoot tr.money th { background: var(--soft); }
.hsheet tfoot .mini { min-height: 2.2rem; }
/* A rate or "dodaj" is a link to the card: the whole cell is the target. */
.hsheet tfoot tr.money td { padding: 0; }
.hsheet tfoot tr.money a { display: flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0 .2rem; }
.hsheet tfoot tr.money td:not(:has(a)) { padding: .45rem .2rem; }
/* The bar for the chosen day: a title line, then one row of answers. */
.sheetbar .inner { max-width: 90rem; gap: .5rem; }
.sheetbar-head { display: flex; align-items: center; gap: .6rem; }
.sheetbar-head .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheetbar-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.sheetbar-row .mini.hours { min-width: 4.5rem; justify-content: center; font-size: 1.05rem; }
.sheetbar-row select { min-height: 2.6rem; max-width: 9rem; padding: 0 .4rem; border: 2px solid var(--ink); border-radius: .5rem; background: var(--paper); font-size: .85rem; font-weight: 700; }
.sheetbar .mini:disabled { border-color: var(--line); color: var(--muted); background: var(--paper); }
main.has-sheetbar { padding-bottom: 13rem; }
/* The owners' sum on a person's card. */
/* A folded category of materials: the heading is the button. */
details.panel > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: .6rem; min-height: 2.75rem; padding: 0; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "▸"; font-size: 1.2rem; }
details.panel[open] > summary::after { content: "▾"; }
.paypanel .rows li.total { border-top: 2px solid var(--ink); font-size: 1.1rem; }
.paypanel .rows li strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hcard { max-width: none; font-size: .85rem; }
.hcard td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cardhead { font-size: 1.1rem; }
.signs { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 1.5rem; }

@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff; }
  .noprint, .top, .status, .bar { display: none !important; }
  main { padding: 0; max-width: none; display: block; }
  /* As a scroll container it adds a scrollbar's height and a blank page. */
  .sheets { overflow: visible; }
  .sheet { margin: 0; box-shadow: none; overflow: hidden; zoom: 1 !important; }
  /* Break before each later sheet, never after the last: no blank last page. */
  .sheet + .sheet { break-before: page; }
  .label { outline: none; }
  /* The month card on one A4 page. */
  .card-page { font-size: 9pt; line-height: 1.25; padding: 10mm 10mm 8mm; }
  .card-page h1 { font-size: 14pt; margin: 0 0 1mm; }
  .card-page .cardhead { font-size: 11pt; margin: 0 0 2mm; }
  .card-page p { margin: 1.5mm 0; }
  .card-page .hcard { font-size: 9pt; }
  .card-page .hcard th, .card-page .hcard td { padding: .5mm 1.5mm; border-top: .2mm solid #999; }
  .card-page .noprint-cell { display: none; }
  .card-page .stats { grid-template-columns: repeat(4, 1fr); gap: 2mm; margin-top: 3mm; }
  .card-page .stat { padding: 1.5mm 2mm; }
  .card-page .stat .v { font-size: 12pt; }
  .card-page .stat .k { font-size: 8pt; }
  .card-page .signs { margin-top: 6mm; }
}
