/* Zwroty — panel biura (biuro.css). Dokłada się do styles.css i używa jego zmiennych
 * (--bg, --surface, --text, --muted, --primary, --ok, --warn, --error, --border, --radius oraz --fill, --line, --line-strong…).
 *
 * Kierunek jak w makiecie Foodie Point: czarny pasek górny (z index.html), szare tło banera, białe panele.
 * - JEDEN czerwony przycisk na ekran (.bz-btn-go = główna akcja widoku). „Zatwierdź” w wierszach to czarny pełny
 *   (.bz-btn-primary), „Edytuj/Podgląd” — obrysowe, „Kopiuj”, „Cofnij…” — tekstowe (.bz-btn-ghost), „Usuń” — tekstowy
 *   w ciemnej czerwieni (.bz-btn-danger).
 * - Aktywne pozycje (menu, skróty dat) czarne pełne, licznik „do zatwierdzenia” to czerwone kółko.
 * - Statusy: kształt + słowo (.st z styles.css). Komunikaty: ikona + tło + zdanie (reguły w styles.css).
 * - Na telefonie zwarty pasek zakładek i listy-karty zamiast tabel; na komputerze menu boczne i gęste tabele.
 */

/* ---------- układ i menu sekcji ---------- */
.bz { max-width: 1400px; margin: 0 auto; font-size: 15px; }
.bz-main { min-width: 0; }

.bz-nav {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: -14px -14px 12px; padding: 6px 8px;
  background: var(--surface); color: var(--text);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.bz-nav::-webkit-scrollbar { display: none; }
.bz-nav-title { display: none; }
.bz-nav-item {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 1 auto;
  min-height: 44px; padding: 0 8px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .88rem; font-weight: 700; white-space: nowrap;
}
.bz-nav-item:hover { background: var(--surface-2); }
/* Na telefonie krótsze etykiety, żeby 5 sekcji zmieściło się bez przewijania */
.bz-nav-long { display: none; }
@media (max-width: 430px) { .bz-nav-item { padding: 0 5px; font-size: .82rem; } }
@media (min-width: 900px) { .bz-nav-long { display: inline; } .bz-nav-short { display: none; } }
.bz-nav-item.is-active { background: var(--fill); color: var(--on-fill); }
.bz-badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; text-align: center;
  background: var(--primary); color: var(--on-primary); font: 800 .76rem/22px var(--font);
}

@media (min-width: 900px) {
  .bz { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
  .bz-nav {
    flex-direction: column; gap: 2px; overflow: visible; margin: 0; padding: 12px;
    position: sticky; top: 16px; border-radius: 14px; border: 1px solid var(--line);
  }
  .bz-nav-title {
    display: block; padding: 2px 12px 10px; margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
    color: var(--muted); font: 700 .75rem/1 var(--font); letter-spacing: .06em; text-transform: uppercase;
  }
  .bz-nav-item { flex: 0 0 auto; min-height: 44px; padding: 0 12px; justify-content: space-between; font-size: .95rem; font-weight: 650; }
  .bz-nav-item.is-active { font-weight: 750; }
}

/* ---------- nagłówek strony ---------- */
.bz-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 14px; margin-bottom: 14px; }
.bz-title {
  position: relative; margin: 0; padding-bottom: 12px; font-size: 1.6rem; line-height: 1.05; letter-spacing: -.015em;
}
.bz-title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 4px; background: var(--primary); }
.bz-sub { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.bz-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bz-h2 { margin: 0 0 8px; font-size: 1.1rem; letter-spacing: -.005em; }
.bz-h3 { margin: 0 0 6px; font-size: .98rem; }
.bz-back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-bottom: 2px; font-size: .9rem; font-weight: 700; text-decoration: none; }
.bz-back .ico { width: 16px; height: 16px; vertical-align: 0; }

/* ---------- przyciski ---------- */
.bz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 14px; border: 1.5px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; font-weight: 700;
  text-decoration: none; text-align: center; white-space: nowrap; cursor: pointer; touch-action: manipulation;
  transition: background-color .12s, border-color .12s;
}
.bz-btn .ico { width: 17px; height: 17px; vertical-align: 0; }
.bz-btn:hover:not(:disabled) { background: var(--surface-2); }
.bz-btn:active:not(:disabled) { transform: translateY(1px); }
.bz-btn:disabled { opacity: .55; cursor: default; }
.bz-btn-sm { min-height: 34px; padding: 0 11px; font-size: .84rem; border-width: 1.5px; }
@media (pointer: coarse) { .bz-btn-sm { min-height: 44px; } .bz-btn { min-height: 48px; } }
.bz-btn-lg { min-height: 48px; padding: 0 22px; font-size: 1rem; }
/* czarny pełny: akcja drugiego rzędu (Zatwierdź w wierszu, Pokaż podgląd) */
.bz-btn-primary { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.bz-btn-primary:hover:not(:disabled) { background: var(--fill); opacity: .86; }
/* czerwony: główna akcja ekranu — tylko jeden na widok */
.bz-btn-go { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.bz-btn-go:hover:not(:disabled) { background: var(--primary-press); border-color: var(--primary-press); }
.bz-btn-ghost, .bz-btn-ghost:hover:not(:disabled) { border-color: transparent; background: none; }
.bz-btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.bz-btn-danger { background: none; border-color: transparent; color: var(--red-ink); }
.bz-btn-danger:hover:not(:disabled) { background: var(--error-bg); }
.bz-btn.is-on { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.bz-push { margin-left: auto; }
.bz-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- panele, filtry, pola ---------- */
.bz-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.bz-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bz-panel-head .bz-h2 { margin: 0; }

.bz-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin-bottom: 10px; }
.bz-label { margin: 0; color: var(--text); font-size: .82rem; font-weight: 700; }
.bz-hint { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.bz .bz-field input[type="text"], .bz .bz-field input[type="date"], .bz .bz-field select, .bz .bz-field textarea,
.bz-pos select, .bz-pos input[type="text"],
.bz-modal-form input[type="text"], .bz-modal-form input[type="date"], .bz-modal-form select, .bz-modal-form textarea {
  min-height: 42px; padding: 5px 10px; font-size: .95rem; border-width: 1.5px; border-color: var(--line-strong); border-radius: 8px;
}
.bz .bz-field textarea, .bz-modal-form textarea { min-height: 60px; }
.bz select.invalid, .bz input.invalid,
.bz-modal-form select.invalid, .bz-modal-form input.invalid { border-color: var(--error); border-width: 2px; background: var(--error-bg); }
.bz-field-warn, .bz-field-err {
  display: flex; align-items: flex-start; gap: 6px; margin: 2px 0 0; padding: 5px 8px; border-radius: 6px; font-size: .82rem; font-weight: 650;
}
.bz-field-warn::before, .bz-field-err::before, .bz-rowwarn::before { width: 16px; height: 16px; margin-top: 0; }
.bz-checkrow { display: flex; align-items: center; gap: 8px; min-height: 40px; margin: 0; font-size: .9rem; font-weight: 600; cursor: pointer; }
.bz-check { width: 18px; height: 18px; margin: 0; accent-color: var(--fill); cursor: pointer; }
.bz-check:disabled { cursor: default; opacity: .4; }
.bz-mono { font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; font-weight: 700; letter-spacing: .06em; }
.bz-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.bz-inline input { flex: 1 1 180px; width: auto; }

.bz-filters { padding: 12px 14px 4px; }
.bz-filters .bz-field { margin-bottom: 8px; }
.bz-period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 12px; }
.bz-period .is-date { flex: 1 1 130px; max-width: 175px; }
.bz-presets { flex: 1 1 280px; }
.bz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bz-chip {
  min-height: 42px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .86rem; font-weight: 650; cursor: pointer; touch-action: manipulation;
}
.bz-chip:hover { border-color: var(--line-strong); }
.bz-chip.is-active { background: var(--fill); border-color: var(--fill); color: var(--on-fill); font-weight: 750; }
.bz-filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 12px; }
.bz-filter-row .is-wide { grid-column: 1 / -1; max-width: 400px; }

/* ---------- alerty (ikona i kolory: styles.css) ---------- */
.bz-alert {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 6px 10px;
  margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; font-weight: 650;
}
.bz-alert > .bz-btn, .bz-alert > a { white-space: normal; }
@media (max-width: 599px) {
  .bz-alert { grid-template-columns: 20px minmax(0, 1fr); }
  .bz-alert > .bz-btn, .bz-alert > a { grid-column: 2; justify-self: start; }
}
.bz-alert-info { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.bz-alert .bz-btn { background: var(--surface); color: var(--text); min-height: 36px; padding: 0 12px; font-size: .84rem; }
.bz-empty { margin-bottom: 12px; padding: 22px 14px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: 14px; }
.bz-empty p { margin: 0 0 10px; }
.bz-empty p:last-child { margin: 0; }
.bz-center { justify-content: center; text-align: center; }

/* ---------- lista dostaw ---------- */
.bz-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 16px 2px 10px; color: var(--muted); font-size: .9rem; }
.bz-summary strong { color: var(--text); }
.bz-wait { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 700; }
.bz-wait::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.bz-bulk {
  position: sticky; top: 0; z-index: 25; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  margin-bottom: 8px; padding: 8px 12px; background: var(--ink); color: var(--on-ink); border-radius: 10px;
}
.bz-bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bz-bulk .bz-btn { background: transparent; color: var(--on-ink); border-color: rgba(255, 255, 255, .5); }
/* na czarnym pasku akcja jest biała: czerwień zostaje jednym przyciskiem w nagłówku strony */
.bz-bulk .bz-btn-go { background: var(--on-ink); color: var(--ink); border-color: var(--on-ink); }
.bz-bulk :focus-visible { outline-color: #fff; }
.bz-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }

.bz-shop { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-weight: 700; }
.bz-you { color: var(--muted); font-weight: 400; }
.bz-flag { display: flex; width: fit-content; margin: 4px 0 0; }
.bz-note { margin-top: 2px; max-width: 38ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .82rem; }
.bz-rejected { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; padding: 5px 8px; border-radius: 6px; font-size: .84rem; font-weight: 650; }
.bz-rejected::before { width: 16px; height: 16px; margin-top: 0; }
.bz-actions { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
.bz-state { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.bz-state.is-on { background: var(--ok-bg); color: var(--ok); }
.bz-state.is-off { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.bz-state.is-warn { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn-line); }
.bz-state.is-future { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong); }

/* ---------- tabele (gęste, księgowe) ---------- */
.bz-tablewrap { margin-bottom: 14px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
/* brak zagnieżdżonej ramki, gdy tabela leży bezpośrednio w panelu */
.bz-panel > .bz-tablewrap {
  margin: 0 -16px -14px; width: calc(100% + 32px);
  border: 0; border-top: 1px solid var(--line); border-radius: 0 0 14px 14px;
}
.bz-table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.bz-table th, .bz-table td { padding: 9px 8px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.bz-table thead th {
  background: var(--surface); color: var(--muted); border-bottom: 2px solid var(--line-strong);
  font: 700 .72rem/1.1 var(--font); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.bz-table tbody tr:last-child > * { border-bottom: 0; }
.bz-table tbody tr:hover { background: var(--surface-2); }
.bz-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bz-table .is-check { width: 36px; padding-right: 0; }
.bz-table .is-date { white-space: nowrap; }
.bz-table-deliveries td:nth-child(3) { white-space: nowrap; }
/* ≥900 px: przyciski akcji w jednej linii; gdy tabela się nie mieści, przewija się .bz-tablewrap (nie strona) */
@media (min-width: 900px) {
  .bz-table-deliveries { min-width: 980px; }
  .bz-table-deliveries .is-actions-h, .bz-table-deliveries td.is-actions { width: 1%; white-space: nowrap; }
  .bz-table.bz-table-deliveries td.is-actions .bz-actions { flex-wrap: nowrap; gap: 4px; }
  .bz-table-deliveries td.is-actions .bz-btn-sm { padding: 0 8px; white-space: nowrap; }
}
/* wiersz dnia w liście dostaw: data w czarnym chipie + liczba dostaw */
.bz-table tbody tr.bz-group:hover { background: none; }
.bz-table tr.bz-group > th {
  padding: 8px 10px; background: var(--surface-2); color: var(--muted); border-bottom: 1px solid var(--line);
  font: 600 .84rem/1 var(--font); letter-spacing: 0; text-transform: none; white-space: normal;
}
.bz-daychip {
  display: inline-block; padding: 6px 9px; border-radius: 5px; background: var(--fill); color: var(--on-fill);
  font: 850 .75rem/1 var(--display); font-stretch: 115%; text-transform: uppercase; letter-spacing: .02em;
}
.bz-group-count { margin-left: 10px; color: var(--muted); font-weight: 600; font-size: .82rem; }
.bz-table tbody tr.bz-group + tr > td { border-top: 0; }
.bz-table tr.has-correction > td { background: var(--warn-bg); }
.bz-th-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; white-space: nowrap; }
.bz-th-btn:hover { color: var(--text); }
th.is-num .bz-th-btn { text-align: right; }
.bz-table .is-actions-h, .bz-table td.is-actions { text-align: right; width: 1%; }
.bz-table td.is-actions .bz-actions { justify-content: flex-end; flex-wrap: wrap; }
.bz-table .bz-btn-sm { min-height: 32px; padding: 0 9px; font-size: .82rem; }
.bz-table tfoot th, .bz-table tfoot td, .bz-table .bz-total th, .bz-table .bz-total td {
  background: var(--surface-2); border-top: 2px solid var(--line-strong); border-bottom: 0; font-weight: 850;
}
.bz-table tbody th { font-weight: 700; text-align: left; }
.bz-table .is-neg { color: var(--error); font-weight: 800; text-decoration: underline dotted; text-underline-offset: 3px; }

/* ---------- raport: arkusz dokumentu ---------- */
.bz-report { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.bz-report-head {
  display: flex; flex-wrap: wrap; gap: 4px 20px;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--line-strong);
  font-size: .88rem;
}
.bz-report-head .bz-h2 { flex: 1 1 100%; margin: 0 0 2px; font-size: 1.2rem; }
.bz-report-head p { margin: 0; }
.bz-report-section { margin-bottom: 16px; }
.bz-report-section:last-child { margin-bottom: 0; }
.bz-report .bz-tablewrap { margin-bottom: 0; border-radius: 10px; }

/* pasek procentowy w statystykach */
.bz-bar-cell { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.bz-bar { flex: 1; height: 6px; min-width: 48px; overflow: hidden; background: var(--surface-2); border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.bz-bar > span { display: block; height: 100%; background: var(--fill); }
.bz-bar-val { min-width: 4em; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- telefon (< 900 px) ---------- */
@media (max-width: 899px) {
  .bz-filters { padding: 10px 12px 4px; }
  .bz-filters .bz-field { margin-bottom: 6px; }
  .bz-period .is-date { flex: 1 1 calc(50% - 6px); max-width: none; }
  .bz-presets { flex: 1 1 100%; }
  .bz-presets > .bz-label { display: none; }
  .bz-chips { gap: 5px; }
  .bz-chip { min-height: 40px; padding: 0 10px; font-size: .8rem; }
  .bz-filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
  .bz-filter-row > .bz-field:nth-child(3) { grid-column: 1 / -1; }
  .bz-filters select, .bz-filters input[type="date"] { min-height: 42px; padding: 4px 8px; font-size: .9rem; }

  .bz-tools { gap: 6px; }
  .bz-tools .bz-btn-go.bz-push { flex: 1 1 100%; margin-left: 0; }
  .bz-tools > .bz-btn:not(.bz-btn-go) { flex: 1 1 auto; min-height: 44px; padding: 0 8px; font-size: .84rem; }

  .bz-tablewrap:has(.is-stack) { overflow: visible; background: none; border: 0; }
  .bz-panel > .bz-tablewrap:has(.is-stack) { margin: 0; width: 100%; border-top: 0; }
  .bz-table.is-stack, .bz-table.is-stack tbody, .bz-table.is-stack tr, .bz-table.is-stack td { display: block; width: 100%; }
  .bz-table.is-stack thead { display: none; }
  .bz-table.is-stack tr {
    position: relative; margin-bottom: 8px; padding: 10px 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  }
  .bz-table.is-stack tbody tr:hover { background: var(--surface); }
  .bz-table.is-stack td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; border: 0; text-align: right; white-space: normal;
  }
  .bz-table.is-stack td::before { content: attr(data-label); flex: 0 0 auto; color: var(--muted); font-size: .82rem; font-weight: 600; text-align: left; }
  .bz-table.is-stack td.is-title { display: block; padding: 0 30px 4px 0; text-align: left; font-size: 1rem; }
  .bz-table.is-stack td.is-title::before, .bz-table.is-stack td.is-actions::before { display: none; }
  .bz-table.is-stack td.is-check { position: absolute; top: 10px; right: 12px; width: auto; padding: 0; }
  .bz-table.is-stack td.is-check::before { display: none; }
  .bz-table.is-stack td.is-actions { display: block; width: 100%; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); text-align: left; }
  .bz-table.is-stack td.is-actions .bz-actions { justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
  .bz-table.is-stack .bz-btn-sm { min-height: 48px; padding: 0 12px; font-size: .86rem; }
  .bz-table.is-stack td.is-bar { display: block; }
  .bz-table.is-stack td.is-bar::before { display: block; margin-bottom: 3px; }
  .bz-table.is-stack td.is-bar .bz-bar-cell { min-width: 0; }
  .bz-table.is-stack td:empty { display: none; }
  .bz-table.is-stack tr.bz-group { margin: 12px 0 6px; padding: 0; border: 0; border-radius: 0; background: none; }
  .bz-table.is-stack tr.bz-group > th { display: block; padding: 0; background: none; border: 0; }
  .bz-table.is-stack tr.has-correction { background: var(--warn-bg); border-color: var(--warn-line); }
  .bz-table.is-stack tr.has-correction > td { background: transparent; }
  .bz-table.is-stack td > div { max-width: 100%; text-align: inherit; }
  .bz-table.is-log td:last-child { display: block; text-align: left; }
  .bz-table.is-log td:last-child::before { display: none; }

  .bz-report { padding: 12px; }
  .bz-table.is-report th, .bz-table.is-report td { padding: 8px 6px; font-size: .85rem; }
  .bz-title { font-size: 1.4rem; }
}

/* ---------- formularz dostawy ---------- */
.bz-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.bz-pos-head, .bz-pos { display: none; }
.bz-pos-list { display: grid; gap: 8px; }
.bz-pos {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 8px; align-items: start;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.bz-pos-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bz-pos-cell.is-product { grid-column: 1 / -1; }
.bz-pos-cell.is-remove { grid-column: 1 / -1; align-items: flex-start; }
.bz-pos-warn { grid-column: 1 / -1; }
.bz-pos.has-correction { background: var(--warn-bg); border-color: var(--warn-line); }
.bz-mlabel { color: var(--muted); font-size: .78rem; font-weight: 700; }
.bz-num-input { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.bz-readonly {
  display: flex; align-items: center; justify-content: flex-end; min-height: 42px; padding: 0 10px;
  font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; color: var(--muted);
}
.bz-corr { color: var(--warn); font-size: .8rem; font-weight: 700; line-height: 1.35; }
.bz-corr .ico { width: 15px; height: 15px; margin-right: 4px; vertical-align: -3px; }
.bz-corr .bz-link { display: block; }
.bz-rowwarn { display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; border-radius: 6px; font-size: .82rem; font-weight: 650; }
.bz-pos.has-correction .bz-pos-cell.is-remove, .bz-pos .bz-pos-cell.is-remove { margin-top: 0; }
.bz-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bz-totals { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; padding-top: 8px; border-top: 2px solid var(--line-strong); color: var(--muted); font-size: .9rem; }
.bz-totals strong { color: var(--text); }
.bz-pos-list > .bz-hint { padding: 6px 0; }
.bz-savebar {
  position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  margin: 0 -14px calc(-24px - var(--safe-bottom)); padding: 10px 14px calc(10px + var(--safe-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.bz-savebar .bz-btn { min-height: 48px; padding: 0 12px; font-size: .92rem; }
.bz-savebar .bz-btn-lg { flex: 1 1 auto; }

@media (min-width: 900px) {
  .bz-pos-head, .bz-pos { display: grid; grid-template-columns: minmax(220px, 2.8fr) minmax(88px, 1fr) minmax(100px, 1.1fr) 72px; gap: 10px; align-items: start; }
  .bz-pos-head.has-returns, .bz-pos.has-returns { grid-template-columns: minmax(220px, 2.8fr) minmax(88px, 1fr) minmax(100px, 1.1fr) minmax(88px, 1fr) 72px; }
  .bz-pos-head { padding: 0 0 6px; border-bottom: 2px solid var(--line-strong); color: var(--muted); font: 700 .72rem/1.1 var(--font); letter-spacing: .06em; text-transform: uppercase; }
  .bz-pos-head span:nth-child(n+2):not(:last-child) { text-align: right; }
  .bz-pos-list { gap: 0; }
  .bz-pos { padding: 8px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .bz-pos:last-child { border-bottom: 0; }
  .bz-pos.has-correction { background: var(--warn-bg); padding-left: 8px; padding-right: 6px; }
  .bz-pos-cell.is-product, .bz-pos-cell.is-remove { grid-column: auto; }
  .bz-pos-cell.is-remove { align-items: flex-end; }
  .bz-mlabel { display: none; }
  .bz-savebar { position: static; margin: 0; padding: 0; background: none; border: 0; }
  .bz-savebar .bz-btn-lg { flex: 0 0 auto; min-height: 46px; padding: 0 24px; font-size: .98rem; }
}

/* ---------- statystyki: pasek podsumowania zamiast osobnych kafelków KPI ---------- */
.bz-kpis {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.bz-kpi {
  display: flex; flex-direction: column; padding: 12px 14px;
  background: transparent; border: 0; border-right: 1px solid var(--line); border-radius: 0;
}
.bz-kpi:last-child { border-right: 0; }
.bz-kpi.is-main { background: var(--surface-2); box-shadow: inset 0 -4px 0 var(--fill); }
.bz-kpi-label { order: -1; margin-bottom: 2px; color: var(--muted); font-size: .76rem; font-weight: 700; }
.bz-kpi-val { font: 850 1.6rem/1.15 var(--display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--text); }

.bz-stat-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1024px) {
  .bz-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .bz-stat-grid > .bz-panel { margin-bottom: 0; }
}

.bz-top { margin: 0; padding: 0; list-style: none; counter-reset: top; }
.bz-top li {
  counter-increment: top; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(80px, 1fr) 4.4em; gap: 2px 12px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem;
}
.bz-top li:last-child { border-bottom: 0; }
.bz-top-name { font-weight: 700; }
.bz-top-name::before { content: counter(top) ". "; color: var(--muted); font-variant-numeric: tabular-nums; }
.bz-top-bar { height: 6px; overflow: hidden; background: var(--surface-2); border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.bz-top-bar > span { display: block; height: 100%; background: var(--fill); }
.bz-top-val { text-align: right; font-weight: 850; font-variant-numeric: tabular-nums; }
.bz-top-sub { grid-column: 1 / -1; color: var(--muted); font-size: .8rem; }
@media (min-width: 900px) {
  .bz-top li { grid-template-columns: minmax(0, 1.3fr) minmax(80px, 1fr) 4.4em 6.5em; }
  .bz-top-sub { grid-column: auto; text-align: right; font-variant-numeric: tabular-nums; }
}

/* ---------- ustawienia ---------- */
.bz-subtabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.bz-subtab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; margin-bottom: -1px;
  background: transparent; border: 0; border-bottom: 3px solid transparent; border-radius: 0;
  color: var(--muted); font: 700 .92rem/1 var(--font); text-decoration: none; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
.bz-subtab:hover { color: var(--text); background: var(--surface-2); }
.bz-subtab.is-active { color: var(--text); border-bottom-color: var(--fill); background: transparent; }
.bz-modal-form .bz-field { margin-bottom: 10px; }
.modal:has(.bz-modal-wide) { max-width: 640px; }
.bz-form-group { min-width: 0; margin: 0 0 12px; padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--line); }
.bz-form-group:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.bz-form-group-title {
  margin: 0 0 8px; padding: 6px 0 0; color: var(--text); font: 800 .78rem/1.1 var(--font);
  text-transform: uppercase; letter-spacing: .06em;
}
.bz-grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 10px; }
.bz-grid-address { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.bz-grid-address > :nth-child(2) { grid-column: 1 / -1; order: 3; }
@media (min-width: 520px) {
  .bz-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bz-grid-address { grid-template-columns: 118px minmax(0, 1fr) 92px; }
  .bz-grid-address > :nth-child(2) { grid-column: auto; order: 0; }
}
.bz-settings-form { max-width: 680px; }
.bz-settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.bz-tools-note { font-size: .88rem; color: var(--muted); font-weight: 600; padding: 4px 0; }
.bz-tools-note a { font-weight: 700; }
.bz-meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: .88rem;
}
.bz-meta-item { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bz-meta-label { color: var(--muted); font-size: .78rem; font-weight: 700; }
.bz-meta-val { font-weight: 650; color: var(--text); word-break: break-word; }
.bz-table tr.is-price-current > td { background: var(--ok-bg); }
.bz-table tr.is-price-future > td { background: var(--surface-2); }
@media (max-width: 899px) {
  .bz-table.is-stack tr.is-price-current { background: var(--ok-bg); border-color: var(--ok); }
  .bz-table.is-stack tr.is-price-current > td { background: transparent; }
  .bz-table.is-stack tr.is-price-future { background: var(--surface-2); border-color: var(--line-strong); }
  .bz-table.is-stack tr.is-price-future > td { background: transparent; }
}
.bz-pwd {
  margin: 8px 0; padding: 10px; text-align: center; user-select: all;
  font: 800 1.5rem/1.2 ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; letter-spacing: .1em;
  background: var(--warn-bg); color: var(--warn); border: 1.5px dashed var(--warn-line); border-radius: 10px;
}
.bz-details summary { cursor: pointer; color: var(--text); font-size: .84rem; font-weight: 700; }
.bz-json {
  max-width: 60ch; margin: 4px 0 0; padding: 6px 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; font-size: .78rem;
}
.bz-table.is-log td:last-child { min-width: 240px; }

/* ---------- trasy i rabaty w ustawieniach ---------- */
.bz-route-list, .bz-route-pool {
  display: grid; gap: 4px; max-height: 220px; overflow-y: auto; margin: 6px 0 10px; padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.bz-route-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.bz-route-num { min-width: 24px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.bz-route-name { flex: 1 1 auto; min-width: 0; font-weight: 650; }
.bz-disc-shops {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px;
  max-height: 240px; padding: 6px 10px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) { .bz-btn:active:not(:disabled) { transform: none; } .bz-btn { transition: none; } }

/* ---------- druk: tylko nagłówek raportu i tabele ---------- */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #eee; --text: #000; --muted: #333; --border: #999; --line: #555; --line-strong: #000;
    --error: #000; --warn: #000;
  }
  body { background: #fff; color: #000; font-size: 11pt; }
  .bz-nav, .bz-head, .bz-noprint, .bz-tools, .bz-filters, .bz-alert, .bz-savebar, .bz-bulk { display: none !important; }
  .bz { display: block; max-width: none; }
  .bz-report { border: 0; padding: 0; background: none; }
  .bz-report-head { margin-bottom: 12pt; padding-bottom: 6pt; border-bottom: 2px solid #000; }
  .bz-report-head .bz-h2 { font-size: 16pt; }
  .bz-tablewrap, .bz-report .bz-tablewrap { overflow: visible; border: 0; background: none; }
  .bz-table, .bz-table.is-report { font-size: 10pt; min-width: 0; }
  .bz-table th, .bz-table td { padding: 4pt 6pt; border: 1px solid #555; }
  .bz-table thead th, .bz-table tfoot th, .bz-table tfoot td { background: #eee !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bz-table tbody tr:hover { background: none; }
  .bz-report-section { break-inside: avoid; margin-bottom: 14pt; }
  .bz-table .is-neg { color: #000; text-decoration: underline; }
}

/* raport: stałe, procentowe szerokości kolumn, żeby tabele sklepów były wyrównane pod sobą */
.bz-table.is-report { table-layout: fixed; min-width: 580px; }
.bz-table.is-report th, .bz-table.is-report td { overflow: hidden; text-overflow: ellipsis; }
.bz-table.is-report th:first-child { width: 30%; min-width: 0; }
.bz-table.is-report th.is-num, .bz-table.is-report td.is-num { width: 17.5%; white-space: nowrap; }
