/* 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 --ink, --line, --accent…).
 *
 * Kierunek: surowe narzędzie robocze / księgowe bez „AI slop”.
 * - Zwarta hierarchia promieni zaokrągleń: panele 6 px, kontrolki/przyciski 4 px, znaczniki 3 px.
 * - Nawigacja boczna na komputerze osadzona na powierzchni roboczej (var(--surface)) zamiast czarnej,
 *   oderwanej wyspy na jasnym tle; na telefonie zwarty pasek zakładek mieszczący wszystkie 4 sekcje na 390 px.
 * - Gęste, czytelne tabele z jednowierszowymi akcjami na komputerze i wyrównaniem cyfr tabelarycznych.
 * - Brak zagnieżdżonych podwójnych ramek (tabela w panelu oraz wiersze pozycji w formularzu bez „karty w karcie”).
 * - Zwarty panel filtrów na telefonie, dzięki któremu pierwsze wiersze listy dostaw zaczynają się w górnej połowie ekranu.
 */

/* ---------- 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: 0; overflow-x: auto; scrollbar-width: none;
  margin: -14px -14px 12px; padding: 2px 6px 0;
  background: var(--ink); color: var(--on-ink);
  border-bottom: 2px 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: 5px; flex: 1 1 auto;
  min-height: 44px; padding: 0 8px; color: #c9d1d7; text-decoration: none; font-size: .88rem; font-weight: 800; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.bz-nav-item:hover { color: #fff; }
/* 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 { color: #fff; border-bottom-color: var(--accent); }
.bz-nav :focus-visible { outline-color: var(--accent); }
.bz-badge {
  min-width: 1.55em; padding: 0 .4em; border-radius: 3px; text-align: center;
  background: var(--accent); color: var(--on-accent); font-size: .76rem; font-weight: 900; line-height: 1.55;
}

@media (min-width: 900px) {
  .bz { display: grid; grid-template-columns: 192px minmax(0, 1fr); gap: 22px; align-items: start; }
  .bz-nav {
    flex-direction: column; gap: 2px; overflow: visible; margin: 0; padding: 8px;
    position: sticky; top: 16px; border-radius: 6px; border: 2px solid var(--line);
    background: var(--surface); color: var(--text);
  }
  .bz-nav-title {
    display: block; padding: 2px 10px 8px; margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    color: var(--muted); font-weight: 800; font-size: .78rem;
  }
  .bz-nav-item {
    flex: 0 0 auto; font-size: .94rem; font-weight: 700; color: var(--text);
    border-bottom: 0; border-radius: 4px; min-height: 40px; padding: 0 10px; justify-content: space-between;
  }
  .bz-nav-item:hover { background: var(--surface-2); color: var(--text); }
  .bz-nav-item.is-active {
    background: var(--ink); color: var(--on-ink); font-weight: 800;
    box-shadow: inset 4px 0 0 var(--accent);
  }
  .bz-nav :focus-visible { outline-color: var(--link); }
}

@media (min-width: 900px) and (prefers-color-scheme: dark) {
  .bz-nav-item.is-active {
    background: var(--surface-2); color: var(--text);
    box-shadow: inset 4px 0 0 var(--accent);
  }
}

/* ---------- nagłówek strony ---------- */
.bz-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 10px; }
.bz-title { margin: 0; font-size: 1.45rem; line-height: 1.15; letter-spacing: -.02em; }
.bz-sub { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.bz-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bz-h2 { margin: 0 0 8px; font-size: 1.05rem; letter-spacing: -.01em; }
.bz-h3 { margin: 0 0 6px; font-size: .96rem; }
.bz-back { display: inline-flex; align-items: center; min-height: 36px; margin-bottom: 2px; font-size: .9rem; font-weight: 800; text-decoration: none; }

/* ---------- przyciski ---------- */
.bz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 13px; border: 2px solid var(--text); border-radius: 4px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; font-weight: 800;
  text-decoration: none; text-align: center; white-space: nowrap; cursor: pointer; touch-action: manipulation;
}
.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: 32px; padding: 0 10px; font-size: .82rem; border-width: 1px; border-color: var(--line); font-weight: 700; }
@media (pointer: coarse) { .bz-btn-sm { min-height: 40px; } }
.bz-btn-lg { min-height: 46px; padding: 0 22px; font-size: .98rem; }
.bz-btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 800; }
.bz-btn-primary:hover:not(:disabled) { background: var(--primary); filter: brightness(1.12); }
.bz-btn-go { background: var(--accent); border-color: var(--on-accent); border-width: 2px; color: var(--on-accent); font-weight: 800; }
.bz-btn-go:hover:not(:disabled) { background: var(--accent); filter: brightness(.94); }
.bz-btn-danger { background: transparent; border-color: var(--error-ink); color: var(--error-ink); }
.bz-btn-danger:hover:not(:disabled) { background: var(--error-bg); }
.bz-btn.is-on { background: var(--info-bg); color: var(--info-fg); border-color: var(--primary); border-width: 2px; font-weight: 800; }
.bz-push { margin-left: auto; }
.bz-link { padding: 0; border: 0; background: none; color: var(--link); font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }

/* ---------- panele, filtry, pola ---------- */
.bz-panel { background: var(--surface); border: 2px solid var(--line); border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; }
.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: 3px; min-width: 0; margin-bottom: 10px; }
.bz-label { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 800; }
.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: 38px; padding: 5px 9px; font-size: .92rem; border-width: 1px; border-color: var(--line); border-radius: 4px;
}
.bz .bz-field textarea, .bz-modal-form textarea { min-height: 56px; }
.bz select.invalid, .bz input.invalid,
.bz-modal-form select.invalid, .bz-modal-form input.invalid { border-color: var(--error-ink); border-width: 2px; background: var(--error-bg); }
.bz-field-warn { margin: 2px 0 0; color: var(--warn-ink); font-size: .82rem; font-weight: 700; }
.bz-field-err { margin: 2px 0 0; color: var(--error-ink); font-size: .82rem; font-weight: 700; }
.bz-checkrow { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 0; font-size: .9rem; font-weight: 600; cursor: pointer; }
.bz-check { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); 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: 10px 12px 4px; }
.bz-filters .bz-field { margin-bottom: 8px; }
.bz-period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 10px; }
.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: 4px; }
.bz-chip {
  min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; touch-action: manipulation;
}
.bz-chip:hover { border-color: var(--text); }
.bz-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 800; }
@media (prefers-color-scheme: dark) { .bz-chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); } }
.bz-filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 10px; }
.bz-filter-row .is-wide { grid-column: 1 / -1; max-width: 400px; }

/* ---------- alerty ---------- */
.bz-alert {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  margin: 0 0 10px; padding: 8px 12px; border: 1px solid transparent; border-left-width: 4px; border-radius: 4px; font-size: .9rem; font-weight: 700;
}
.bz-alert-info { background: var(--info-bg); color: var(--info-fg); border-color: var(--primary); }
.bz-alert-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-ink); }
.bz-alert-error { background: var(--error-bg); color: var(--error-fg); border-color: var(--error-ink); }
.bz-alert .bz-btn { background: var(--surface); color: var(--text); min-height: 32px; padding: 0 10px; font-size: .82rem; border-width: 1px; border-color: var(--line); }
.bz-empty { margin-bottom: 12px; padding: 22px 14px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; }
.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 { margin: 0 0 8px; color: var(--muted); font-size: .88rem; }
.bz-summary strong { color: var(--text); }
.bz-wait { color: var(--warn-ink); font-weight: 800; }
.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: 4px;
}
.bz-bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bz-bulk .bz-btn:not(.bz-btn-go) { background: transparent; color: var(--on-ink); border-color: rgba(255, 255, 255, .5); }
.bz-bulk :focus-visible { outline-color: var(--accent); }
.bz-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }

.bz-shop { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-weight: 800; }
.bz-you { color: var(--muted); font-weight: 400; }
.bz-flag {
  display: inline-block; margin-top: 2px; margin-left: 6px; padding: 1px 6px; border-radius: 3px;
  background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-ink); font-size: .76rem; font-weight: 800; vertical-align: middle;
}
.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; gap: 4px 10px; margin-top: 4px; color: var(--error-ink); font-size: .84rem; font-weight: 700; }
.bz-actions { display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; }
.bz-state { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: .8rem; font-weight: 800; }
.bz-state.is-on { background: var(--ok-bg); color: var(--ok-fg); }
.bz-state.is-off { background: var(--gray-bg); color: var(--gray-fg); }
.bz-state.is-warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-ink); }
.bz-state.is-future { background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--primary); }

/* ---------- tabele (gęste, księgowe) ---------- */
.bz-tablewrap { margin-bottom: 12px; overflow-x: auto; background: var(--surface); border: 2px solid var(--line); border-radius: 6px; }
/* brak zagnieżdżonej ramki, gdy tabela leży bezpośrednio w panelu */
.bz-panel > .bz-tablewrap {
  margin: 0 -14px -12px; width: calc(100% + 28px);
  border: 0; border-top: 1px solid var(--border); border-radius: 0 0 4px 4px;
}
.bz-table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.3; }
.bz-table th, .bz-table td { padding: 7px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.bz-table thead th {
  background: var(--surface-2); color: var(--muted); border-bottom: 2px solid var(--text);
  font-size: .8rem; font-weight: 800; 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; }
/* nagłówek dnia w liście dostaw */
.bz-table tbody tr.bz-group:hover { background: none; }
.bz-table tr.bz-group > th {
  padding: 5px 10px; background: var(--ink); color: var(--on-ink); border-bottom: 0; font-size: .84rem; font-weight: 800;
}
.bz-group-count { margin-left: 10px; color: #c9d1d7; font-weight: 400; font-size: .8rem; }
.bz-table tbody tr.bz-group + tr > td { border-top: 0; }
.bz-table tr.has-correction > td { background: var(--warn-bg); }
.bz-table tr.has-correction > td:first-child { box-shadow: inset 5px 0 0 var(--warn-ink); }
.bz-th-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 800; cursor: pointer; white-space: nowrap; }
.bz-th-btn:hover { color: var(--link); }
th.is-num .bz-th-btn { text-align: right; }
.bz-table .is-actions-h, .bz-table td.is-actions { text-align: right; white-space: nowrap; width: 1%; }
.bz-table td.is-actions .bz-actions { justify-content: flex-end; }
.bz-table .bz-btn-sm { min-height: 28px; padding: 0 8px; font-size: .8rem; }
.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(--text); border-bottom: 0; font-weight: 900;
}
.bz-table tbody th { font-weight: 700; text-align: left; }
.bz-table .is-neg { color: var(--error-ink); font-weight: 800; }

/* ---------- raport: arkusz dokumentu ---------- */
.bz-report {
  background: var(--surface); border: 2px solid var(--line); border-radius: 6px; padding: 14px;
}
.bz-report-head {
  display: flex; flex-wrap: wrap; gap: 4px 20px;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--text);
  font-size: .88rem;
}
.bz-report-head .bz-h2 { flex: 1 1 100%; margin: 0 0 2px; font-size: 1.15rem; }
.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-width: 1px; border-radius: 4px; }

/* 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: 2px; }
.bz-bar > span { display: block; height: 100%; background: var(--warn); }
.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: 8px 10px 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: 4px; }
  .bz-chip { min-height: 30px; padding: 0 8px; font-size: .78rem; }
  .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: 36px; padding: 4px 6px; font-size: .86rem; }

  .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: 36px; padding: 0 8px; font-size: .82rem; }

  .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: 8px 12px;
    background: var(--surface); border: 2px solid var(--line); border-radius: 6px;
  }
  .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: 700; 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: 8px; right: 10px; 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(--border); 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: 36px; padding: 0 10px; font-size: .84rem; }
  .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: 10px 0 6px; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: var(--ink); }
  .bz-table.is-stack tr.bz-group > th { display: block; }
  .bz-table.is-stack tr.has-correction { background: var(--warn-bg); border-color: var(--warn-ink); }
  .bz-table.is-stack tr.has-correction > td { background: transparent; box-shadow: none; }
  .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: 10px; }
  .bz-table.is-report th, .bz-table.is-report td { padding: 7px 6px; font-size: .85rem; }
  .bz-title { font-size: 1.3rem; }
}

/* ---------- 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: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
}
.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-ink); }
.bz-mlabel { color: var(--muted); font-size: .78rem; font-weight: 800; }
.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: 38px; padding: 0 10px;
  font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; color: var(--muted);
}
.bz-corr { color: var(--warn-ink); font-size: .8rem; font-weight: 800; }
.bz-pos.has-correction .bz-corr { color: var(--warn-fg); }
.bz-rowwarn { padding: 5px 8px; border-radius: 4px; background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-ink); font-size: .82rem; font-weight: 700; }
.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(--border); 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: 8px 14px calc(8px + var(--safe-bottom));
  background: var(--surface); border-top: 2px solid var(--line);
}
.bz-savebar .bz-btn { min-height: 42px; padding: 0 12px; font-size: .9rem; }
.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(--text); color: var(--muted); font-size: .8rem; font-weight: 800; }
  .bz-pos-head span:nth-child(n+2):not(:last-child) { text-align: right; }
  .bz-pos-list { gap: 0; }
  .bz-pos { padding: 6px 0; background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
  .bz-pos:last-child { border-bottom: 0; }
  .bz-pos.has-correction { background: var(--warn-bg); padding-left: 8px; padding-right: 6px; box-shadow: inset 4px 0 0 var(--warn-ink); }
  .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: 44px; padding: 0 22px; font-size: .96rem; }
}

/* ---------- statystyki: pasek podsumowania zamiast osobnych kafelków KPI ---------- */
.bz-kpis {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 12px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 6px; overflow: hidden;
}
.bz-kpi {
  display: flex; flex-direction: column; padding: 10px 12px;
  background: transparent; border: 0; border-right: 1px solid var(--border); 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(--accent); }
.bz-kpi-label { order: -1; margin-bottom: 2px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.bz-kpi-val { font-size: 1.55rem; font-weight: 900; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.bz-kpi.is-main .bz-kpi-val { color: var(--text); }
.bz-kpi.is-main .bz-kpi-label { color: var(--muted); }

.bz-stat-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@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: 6px 0; border-bottom: 1px solid var(--border); font-size: .9rem;
}
.bz-top li:last-child { border-bottom: 0; }
.bz-top-name { font-weight: 800; }
.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: 2px; }
.bz-top-bar > span { display: block; height: 100%; background: var(--warn); }
.bz-top-val { text-align: right; font-weight: 900; 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: 12px; border-bottom: 2px solid var(--line); }
.bz-subtab {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; margin-bottom: -2px;
  border-bottom: 3px solid transparent; color: var(--muted); font-size: .9rem; font-weight: 800; text-decoration: none;
}
.bz-subtab:hover { color: var(--text); }
.bz-subtab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.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(--border); }
.bz-form-group:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.bz-form-group-title {
  margin: 0 0 8px; padding: 0; color: var(--text); font-size: .82rem; font-weight: 900;
  text-transform: uppercase; letter-spacing: .04em;
}
.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(--border); }
.bz-tools-note { font-size: .88rem; color: var(--muted); font-weight: 700; padding: 4px 0; }
.bz-tools-note a { font-weight: 800; }
.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(--border); 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: 800; }
.bz-meta-val { font-weight: 700; color: var(--text); word-break: break-word; }
.bz-table tr.is-price-current > td { background: var(--ok-bg); }
.bz-table tr.is-price-current > td:first-child { box-shadow: inset 4px 0 0 var(--ok-ink); }
.bz-table tr.is-price-future > td { background: var(--info-bg); }
.bz-table tr.is-price-future > td:first-child { box-shadow: inset 4px 0 0 var(--primary); }
@media (max-width: 899px) {
  .bz-table.is-stack tr.is-price-current { background: var(--ok-bg); border-color: var(--ok-ink); }
  .bz-table.is-stack tr.is-price-current > td { background: transparent; box-shadow: none; }
  .bz-table.is-stack tr.is-price-future { background: var(--info-bg); border-color: var(--primary); }
  .bz-table.is-stack tr.is-price-future > td { background: transparent; box-shadow: none; }
}
.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-fg); border: 2px dashed var(--warn-ink); border-radius: 4px;
}
.bz-details summary { cursor: pointer; color: var(--link); font-size: .84rem; font-weight: 800; }
.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: 4px; font-size: .78rem;
}
.bz-table.is-log td:last-child { min-width: 240px; }

@media (prefers-reduced-motion: reduce) { .bz-btn:active:not(:disabled) { transform: 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;
    --error-ink: #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; }
