/* Zwroty — style wspólne (rdzeń, logowanie, panel kierowcy). Panel biura dokłada własne w biuro.css i saldeo.css.
 *
 * Kierunek: barwy marki Foodie Point (wzór: docs/projekt/makieta.html, opis: docs/KONTRAKT.md → „Wygląd”).
 * Czerń, biel, szarość banera i czerwona kropka z logo. Czerwień #d62626 TYLKO na głównej akcji ekranu i na
 * kropce „do zrobienia”; błąd to zawsze ikona + tło + zdanie, nigdy sam czerwony tekst. Statusy = kształt + słowo.
 * Nagłówki: Archivo (pliki lokalne w fonts/), treść: font systemowy. Bez gradientów, bez cieni, bez pasków z lewej.
 */

@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 400 900; font-stretch: 62% 125%; font-display: swap;
  src: url("fonts/archivo-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 400 900; font-stretch: 62% 125%; font-display: swap;
  src: url("fonts/archivo-latin.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;
}

:root {
  /* --- zmienne z kontraktu (nazwy stałe, wartości można zmieniać) --- */
  --bg: #efefed;           /* szarość z banera Foodie Point */
  --surface: #ffffff;
  --text: #111111;         /* czerń / ink */
  --muted: #55554f;
  --primary: #d62626;      /* czerwień z logo: główna akcja i kropka „do zrobienia”; biały tekst 5,1:1 */
  --ok: #1c6e3a;
  --warn: #8a4f00;
  --error: #9f1419;
  --border: #d9d9d4;       /* podziały */
  --radius: 10px;

  /* --- dodatkowe --- */
  --on-primary: #ffffff;
  --primary-press: #b51d1d;
  --red-ink: #c01f1f;      /* czerwony TEKST na bieli (nie dla przycisków) */
  --surface-2: #f6f6f4;
  --line: #d9d9d4;
  --line-strong: #111111;  /* pola, przyciski obrysowe */
  --link: #111111;
  --focus: #1f5fd1;

  /* pasek górny i inne zawsze ciemne pasy */
  --ink: #111111;
  --on-ink: #ffffff;
  --on-ink-muted: #b9b9b3;
  --ink-line: #4a4a46;
  /* odwracane w trybie ciemnym: czarne wypełnienie ↔ białe (aktywne pozycje, „+”, etykieta) */
  --fill: #111111;
  --on-fill: #ffffff;

  --ok-bg: #e2f2e7;
  --warn-bg: #fff0d1;
  --warn-line: #e3a72f;
  --error-bg: #fde5e4;
  --danger: #9f1419;       /* pełna ciemna czerwień: potwierdzenie usunięcia w oknie */

  /* aliasy dla starszych reguł */
  --ok-ink: var(--ok);
  --warn-ink: var(--warn);
  --error-ink: var(--error);
  --ok-fg: var(--ok);
  --warn-fg: var(--warn);
  --error-fg: var(--error);
  --info-bg: var(--surface-2);
  --info-fg: var(--text);
  --gray-bg: var(--surface-2);
  --gray-fg: var(--text);

  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* ikony komunikatów (maska: kolor bierze się z tekstu komunikatu) */
  --i-err: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M10 5.8v5' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='13.8' r='1.1'/%3E%3C/svg%3E");
  --i-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.5 18.5 17h-17z' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M10 8v4' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='14.6' r='1.1'/%3E%3C/svg%3E");
  --i-ok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M6.2 10.4 8.8 13l5-5.6' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M10 9v5' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='6.2' r='1.1'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0c;
    --surface: #181818;
    --text: #f1f1ee;
    --muted: #a8a8a1;
    --primary: #d62626;
    --ok: #6fd294;
    --warn: #ffc56b;
    --error: #ff8a83;
    --border: #2e2e2c;

    --primary-press: #ec4040;
    --red-ink: #ff6d64;
    --surface-2: #202020;
    --line: #2e2e2c;
    --line-strong: #e8e8e4;
    --link: #f1f1ee;
    --focus: #7aa7ff;

    --ink: #000000;
    --on-ink-muted: #9d9d97;
    --ink-line: #3a3a38;
    --fill: #f1f1ee;
    --on-fill: #0c0c0c;

    --ok-bg: #12301d;
    --warn-bg: #352306;
    --warn-line: #a8731a;
    --error-bg: #3a1213;
    --danger: #c0272d;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.modal-open { overflow: hidden; }

::selection { background: var(--primary); color: var(--on-primary); }

h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0 0 .45em; font-weight: 800; text-wrap: balance; }
h1 { font-size: 1.65rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
a { color: var(--link); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: .88rem; }
.tnum { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ikony inline (App.ui.icon) */
.ico { display: inline-block; width: 1.1em; height: 1.1em; flex: none; vertical-align: -.2em; }

/* ---------- układ ---------- */
#view { display: block; outline: none; padding: 14px 14px calc(24px + var(--safe-bottom)); }
.container { max-width: 680px; margin: 0 auto; }

/* ---------- przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px;
  border: 2px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 750; text-decoration: none; text-align: center;
  cursor: pointer; background: var(--surface-2); color: var(--text);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: background-color .12s, border-color .12s, transform .08s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-press); }
.btn-secondary, .btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 48px; padding: 0 14px; font-size: .92rem; }
.btn-block { display: flex; width: 100%; }
.btn .ico { width: 18px; height: 18px; vertical-align: 0; }

/* przyciski w pasku górnym */
.tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 14px; border: 1.5px solid var(--ink-line); border-radius: 8px;
  background: none; color: var(--on-ink); font: inherit; font-size: .9rem; font-weight: 650; cursor: pointer; touch-action: manipulation;
}
.tb-btn:hover { border-color: var(--on-ink); }
.tb-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .12); border-color: var(--on-ink); }
.tb-btn .ico { width: 20px; height: 20px; }

/* ---------- pola ---------- */
label { display: block; font-weight: 700; margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 52px; padding: 8px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 1.05rem; /* >=16px — iOS nie przybliża strony */
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
textarea { min-height: 88px; resize: vertical; }
input.invalid { border-color: var(--error); border-width: 2px; background: var(--error-bg); }
.form-row { margin-bottom: 14px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 48px; font-weight: 400; }
.check-row input, input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--fill); }

/* ---------- komunikaty: ikona + tło + zdanie (nigdy sam czerwony tekst) ---------- */
.form-error, .note-box, .login-msg, .notice, .warn-box {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 4px 8px; align-items: start;
  margin: 8px 0; padding: 10px 12px; border-radius: 10px; font-size: .95rem; font-weight: 600; line-height: 1.35;
}
.form-error::before, .note-box::before, .login-msg::before, .notice::before, .warn-box::before,
.statusbar::before, .toast::before, .bz-alert::before, .bz-field-err::before, .bz-field-warn::before, .bz-rowwarn::before, .bz-rejected::before {
  content: ""; width: 20px; height: 20px; flex: none; margin-top: 1px; background: currentColor;
  -webkit-mask: var(--i-info) center / contain no-repeat; mask: var(--i-info) center / contain no-repeat;
}
.form-error > :not(:first-child), .note-box > div, .notice > div { grid-column: 2; }
.form-error, .note-error, .bz-alert-error, .toast.toast-error, .statusbar.error, .bz-field-err, .bz-rejected { background: var(--error-bg); color: var(--error); }
.form-error::before, .note-error::before, .bz-alert-error::before, .toast.toast-error::before, .statusbar.error::before, .bz-field-err::before, .bz-rejected::before {
  -webkit-mask-image: var(--i-err); mask-image: var(--i-err);
}
.note-warn, .login-msg, .notice, .warn-box, .toast.toast-warn, .statusbar.warn, .bz-alert-warn, .bz-field-warn, .bz-rowwarn { background: var(--warn-bg); color: var(--warn); }
.note-warn::before, .login-msg::before, .notice::before, .warn-box::before, .toast.toast-warn::before, .statusbar.warn::before, .bz-alert-warn::before, .bz-field-warn::before, .bz-rowwarn::before {
  -webkit-mask-image: var(--i-warn); mask-image: var(--i-warn);
}
.note-ok, .toast.toast-ok, .statusbar.ok { background: var(--ok-bg); color: var(--ok); }
.note-ok::before, .toast.toast-ok::before, .statusbar.ok::before { -webkit-mask-image: var(--i-ok); mask-image: var(--i-ok); }
.note-info { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.form-error { font-weight: 650; }

/* ---------- pasek statusu synchronizacji ---------- */
.statusbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0; padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px; min-height: 46px; border-radius: 0;
  font-weight: 700; font-size: .95rem;
  background: var(--ink); color: var(--on-ink);
}
.statusbar::before { margin-top: 0; }
.statusbar > span { flex: 1 1 auto; min-width: 0; }
.statusbar.gray::before { -webkit-mask-image: var(--i-info); mask-image: var(--i-info); }
.statusbar.ok, .statusbar.warn, .statusbar.error { box-shadow: inset 0 -1.5px 0 currentColor; }
.statusbar .btn { min-height: 40px; padding: 0 12px; background: transparent; color: inherit; border: 1.5px solid currentColor; }

.update-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; background: var(--ink); color: var(--on-ink); font-weight: 700;
}
.update-banner .btn-primary { background: var(--on-ink); color: var(--ink); }

/* ---------- górny pasek: czarny w obu trybach ---------- */
.topbar {
  position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 10px;
  min-height: 60px; padding: 6px 14px; background: var(--ink); color: var(--on-ink);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar-brand img { display: block; height: 30px; width: auto; }
.topbar-app {
  padding-left: 10px; border-left: 1px solid var(--ink-line);
  font: 800 15px/1 var(--display); font-stretch: 112%; letter-spacing: .02em; text-transform: uppercase;
}
.topbar-user { flex: 1 1 60px; min-width: 0; margin-left: auto; text-align: right; font-size: .8rem; line-height: 1.2; color: var(--on-ink-muted); overflow: hidden; }
.topbar-user b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--on-ink); font-size: .9rem; font-weight: 650; }
.topbar-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.tb-account { display: none; padding: 0; width: 48px; }
.topbar :focus-visible { outline-color: #fff; }
@media (max-width: 599px) {
  .tb-account { display: inline-flex; }
  .topbar-actions {
    display: none; position: absolute; top: 100%; right: 10px; z-index: 70; flex-direction: column; gap: 4px; min-width: 200px;
    padding: 8px; background: var(--ink); border: 1.5px solid var(--on-ink-muted); border-radius: 12px;
  }
  .topbar.menu-open .topbar-actions { display: flex; }
  .topbar-actions .tb-btn { justify-content: flex-start; width: 100%; border-color: transparent; }
  .topbar-actions .tb-btn:hover { background: rgba(255, 255, 255, .1); }
}

/* ---------- karty, statusy (kształt + słowo) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px;
}
.st {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; height: 28px; padding: 0 10px 0 8px; border-radius: 999px;
  font: 700 13px/1 var(--font); white-space: nowrap; background: var(--surface-2); color: var(--text);
}
.st .ico { width: 12px; height: 12px; vertical-align: 0; }
.st-open { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.st-open .ico { color: var(--primary); }
.st-filled { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.st-ok { background: var(--ok-bg); color: var(--ok); }
.st-inv { background: var(--fill); color: var(--on-fill); }
.st-warn { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn-line); }
.st-warn .ico { width: 14px; height: 14px; }

/* stan zapisu (czeka / wysłano / odrzucono) */
.sync { display: inline-flex; align-items: center; }
.sync .ico { width: 18px; height: 18px; vertical-align: 0; }
.sync-pending { color: var(--warn); }
.sync-synced { color: var(--ok); }
.sync-rejected { color: var(--error); }

/* ---------- logowanie: telefon = biały ekran, komputer = biała karta na szarym tle ---------- */
.login-layer {
  position: fixed; inset: 0; z-index: 200; overflow-y: auto;
  display: flex; flex-direction: column; background: var(--surface);
}
.login-card {
  display: flex; flex-direction: column; flex: 1 0 auto; width: 100%; max-width: 440px; margin: 0 auto;
  padding: calc(40px + env(safe-area-inset-top, 0px)) 24px calc(28px + var(--safe-bottom));
}
.login-logo { display: block; width: 200px; max-width: 70%; height: auto; }
.login-card h1 { margin: 34px 0 4px; font-size: 1.75rem; line-height: 1.05; }
.login-lead { margin: 0 0 22px; color: var(--muted); }
.login-card .form-row { margin-bottom: 16px; }
.login-card .btn-primary { min-height: 56px; font-size: 1.05rem; margin-top: 6px; }
.login-card .login-msg, .login-card .form-error { margin: 0 0 16px; }
@media (min-width: 900px) {
  .login-layer { background: var(--bg); padding: 48px 16px; }
  .login-card {
    flex: 0 0 auto; margin: auto; padding: 44px 48px 40px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  }
  .login-logo { width: 190px; }
}

/* ---------- lista dostaw kierowcy ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 0; }
.page-head-titles { min-width: 0; }
.page-head h1 { margin: 0; font-size: 1.7rem; }
.page-stamp { margin: 2px 0 0; }
.group-title {
  display: flex; align-items: baseline; gap: 10px; margin: 22px 0 10px;
  font-size: 1.15rem; line-height: 1; text-transform: uppercase; letter-spacing: .01em; font-stretch: 108%;
}
.group-title .group-name { position: relative; padding-bottom: 7px; }
.group-title .group-name::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: var(--primary); }
.group-count { font: 800 15px/1 var(--display); color: var(--muted); }
.delivery-list { display: block; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.delivery-list > div + div { border-top: 1px solid var(--line); }
.drow {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start;
  min-height: 76px; padding: 16px 14px 16px 12px; text-decoration: none; color: inherit;
}
.drow:active { background: var(--surface-2); }
.drow .dot { width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; }
.drow.todo .dot { background: var(--primary); }
.drow .name { font: 750 1.12rem/1.2 var(--display); }
.drow .meta { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; color: var(--muted); font-size: .9rem; }
.drow .meta b { color: var(--text); font-weight: 650; }
.drow .meta .sync { margin-left: auto; }
.rejected-note { margin: 0; border-radius: 0; }
.rejected-note .btn { min-height: 48px; margin-top: 6px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }

/* ---------- szczegóły dostawy: „etykieta” z opakowania ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; margin-bottom: 2px; font-weight: 700; text-decoration: none; }
.back-link .ico { width: 18px; height: 18px; vertical-align: 0; }
.label { margin: 2px 0 14px; }
.label .bar-ink {
  margin: 0; padding: 12px 14px 11px; border-radius: 10px 10px 0 0; background: var(--fill); color: var(--on-fill);
  font: 900 1.6rem/1 var(--display); font-stretch: 118%; text-transform: uppercase; letter-spacing: .005em; text-wrap: balance; overflow-wrap: anywhere;
}
.label .bar-red {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 18px); padding: 10px 14px;
  background: var(--primary); color: var(--on-primary);
  font: 850 1.05rem/1 var(--display); font-stretch: 112%; text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
}
.label .bar-red i { width: 2px; height: 18px; background: currentColor; opacity: .8; }
.label .sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 10px 2px 0; color: var(--muted); font-size: .95rem; }
.label .sub-end { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }

.items { display: grid; gap: 10px; margin-bottom: 14px; }
.item { display: grid; gap: 12px; padding: 14px; }
.item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.item-name { margin: 0; font: 750 1.08rem/1.2 var(--display); }
.item-unit { color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; }

.field-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px;
  padding-bottom: 12px; border-bottom: 1px dashed var(--line);
}
.field-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.field-meta label { margin: 0; font-size: .9rem; line-height: 1.2; }
.item-meta { color: var(--muted); font-size: .85rem; margin: 0; }
.item-meta b { color: var(--text); font-weight: 700; }
.field-ctrl { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.mini-stepper { display: inline-grid; grid-template-columns: 44px 68px 44px; gap: 6px; align-items: stretch; }
.mini-step-btn {
  display: grid; place-items: center; min-height: 44px; min-width: 44px; padding: 0;
  border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.mini-step-btn .ico { width: 18px; height: 18px; vertical-align: 0; }
.mini-step-btn:active { background: var(--surface-2); }
.num-small { width: 100% !important; min-height: 44px !important; padding: 4px 6px !important; text-align: center; font-weight: 700; font-size: 1.1rem !important; font-variant-numeric: tabular-nums; }
.changed-note { color: var(--warn); font-weight: 700; font-size: .82rem; white-space: nowrap; }

.zwr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.zwr-label { margin: 0; font-size: .9rem; font-weight: 700; }
.zwr-over { font-size: .82rem; font-weight: 700; color: var(--red-ink); }
.stepper { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; gap: 8px; }
.step-btn {
  display: grid; place-items: center; min-height: 64px; min-width: 56px; padding: 0;
  border-radius: 12px; border: 2px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.step-btn .ico { width: 26px; height: 26px; vertical-align: 0; }
.step-btn:active { background: var(--surface-2); }
/* „+” pełny (najczęstszy ruch), „−” obrys: da się je odróżnić bez patrzenia na znak */
.step-btn.plus { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.step-btn.plus:active { opacity: .85; background: var(--fill); }
.stepper input {
  min-height: 64px; padding: 0 4px; text-align: center; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface-2);
  font: 850 2rem/1 var(--display); font-variant-numeric: tabular-nums;
}
.stepper input.has { border: 2px solid var(--line-strong); background: var(--surface); }
.stepper input.invalid { border-color: var(--error); background: var(--error-bg); }
.notice, .warn-box { margin: 0; }

/* tryb tylko do odczytu */
.items.is-readonly { display: block; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.items.is-readonly > .item-ro { border: 0; border-radius: 0; padding: 12px 14px; background: transparent; }
.items.is-readonly > .item-ro + .item-ro { border-top: 1px solid var(--line); }
.read-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.read-row { display: flex; flex-direction: column; gap: 1px; }
.read-row > span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.read-row > b { font: 800 1.1rem/1.2 var(--display); }
.read-row > b.has-val { color: var(--text); }
.read-row:nth-child(2) { text-align: center; }
.read-row:last-child { text-align: right; }

.actionbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; gap: 10px; margin: 14px -14px calc(-24px - var(--safe-bottom));
  padding: 12px 14px calc(12px + var(--safe-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.actionbar .btn { flex: 1 1 0; min-height: 56px; font-size: 1.05rem; }
.actionbar .btn-primary { flex: 1.5 1 0; }

/* ---------- toasty ---------- */
.toasts {
  position: fixed; left: 0; right: 0; bottom: calc(92px + var(--safe-bottom)); z-index: 300;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 14px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  pointer-events: auto; max-width: 560px; width: 100%;
  padding: 12px 14px; border-radius: 10px; font-weight: 650; font-size: .95rem; line-height: 1.35;
  background: var(--ink); color: var(--on-ink); box-shadow: inset 0 0 0 1.5px currentColor;
}
.toast.toast-info::before { -webkit-mask-image: var(--i-info); mask-image: var(--i-info); }

/* ---------- okno dialogowe ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 250; overflow-y: auto;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .6);
}
.modal {
  width: 100%; max-width: 520px; background: var(--surface); color: var(--text);
  border-top: 4px solid var(--fill);
  border-radius: 14px 14px 0 0; padding: 18px 16px calc(16px + var(--safe-bottom));
  max-height: 100vh; overflow-y: auto;
}
.modal h2 { margin-bottom: 10px; }
.modal-text { white-space: pre-line; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.modal-actions .btn { width: 100%; }
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 14px; padding-bottom: 18px; border: 1px solid var(--line); border-top: 4px solid var(--fill); }
  .modal-actions { flex-direction: row; justify-content: flex-end; }
  .modal-actions .btn { width: auto; min-width: 120px; }
}

/* ---------- potwierdzenie zapisu ---------- */
@keyframes flash-ok { 0% { opacity: .35; } 100% { opacity: 0; } }
.flash-ok-layer { position: fixed; inset: 0; z-index: 400; background: var(--ok); pointer-events: none; animation: flash-ok .45s ease-out forwards; }
@keyframes flash-ok-el { 0% { box-shadow: inset 0 0 0 999px rgba(28, 110, 58, .3); } 100% { box-shadow: inset 0 0 0 999px transparent; } }
.flash-ok-el { animation: flash-ok-el .6s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .flash-ok-layer, .flash-ok-el { animation-duration: .01s; }
  .btn, .btn:active:not(:disabled) { transition: none; transform: none; }
}

/* ---------- druk ---------- */
@media print {
  .statusbar, .update-banner, .topbar, .toasts, #modal-root, .actionbar, .login-layer { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  #view { padding: 0; }
  .card { border-color: #999; break-inside: avoid; }
}
