/* ==========================================================================
   Tokeny. Jeden kolor wiodący (kobalt), kolory statusów tylko semantycznie.
   Zaokrąglenia: karty 12px, przyciski / pola / kafle 8px, statusy i filtry pigułki.
   ========================================================================== */
:root {
  --bg: #F3F5F8;
  --surface: #FDFDFE;
  --surface-2: #F7F8FA;
  --surface-3: #EDF0F4;
  --border: #E2E6EC;
  --border-strong: #CBD2DC;
  --text: #151B24;
  --text-2: #444E5F;
  --muted: #677183;
  --accent: #2A55D0;
  --accent-hover: #2249BB;
  --accent-soft: #EAF0FD;
  --accent-text: #1F45B4;
  --on-accent: #FBFCFF;
  --ok: #1C7C50;
  --ok-soft: #E5F3EB;
  --warn: #93600F;
  --warn-soft: #FBF1DE;
  --danger: #B33A32;
  --danger-soft: #FBE9E6;
  --shadow: 0 1px 2px rgba(23, 35, 62, .05), 0 6px 20px rgba(23, 35, 62, .05);
  --shadow-lg: 0 12px 40px rgba(23, 35, 62, .14);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 256px;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .f-head { font-family: 'Montserrat', sans-serif; letter-spacing: -0.01em; color: var(--text); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
ul { list-style: none; }
.ph { font-size: 18px; line-height: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-family: 'Montserrat', sans-serif; font-variant-numeric: tabular-nums; font-weight: 500; }
.right { text-align: right; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ==========================================================================
   Układ aplikacji
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px 14px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.brand-name { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: .04em; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); }

.nav-group { margin-bottom: 18px; }
.nav-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a .ph { font-size: 19px; }
.nav .count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font-family: 'Montserrat', sans-serif; font-size: 11.5px; font-weight: 600;
  display: inline-grid; place-items: center;
}
.nav a.active .count { background: var(--accent); color: var(--on-accent); }
.nav .count.danger { background: var(--danger-soft); color: var(--danger); }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--surface-3); color: var(--text-2);
  display: grid; place-items: center;
  font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 12.5px;
}
.user-name { font-weight: 500; font-size: 13px; line-height: 1.3; }
.user-role { font-size: 12px; color: var(--muted); }
.user .btn-icon { margin-left: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.testbar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 32px;
  background: var(--warn-soft); color: var(--warn);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
  font-size: 12.5px; font-weight: 500;
}
.testbar .ph { font-size: 16px; }
.testbar a { color: inherit; text-decoration: underline; margin-left: auto; white-space: nowrap; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 0 32px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 480px; }
.search .ph { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 40px; }
.kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px;
  font-family: 'Montserrat', sans-serif;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.dot-badge { position: relative; }
.dot-badge::after {
  content: ""; position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}

.content { width: 100%; max-width: 1480px; padding: 28px 32px 48px; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; font-weight: 600; line-height: 1.25; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs .ph { font-size: 13px; }

/* ==========================================================================
   Komponenty
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-h h2 { font-size: 15px; font-weight: 600; }
.card-h .hint { font-size: 12.5px; color: var(--muted); }
.card-b { padding: 18px 20px; }
.card-b.tight { padding: 0; }
.card-f { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: 'Poppins', sans-serif; font-weight: 500; font-size: 13.5px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn .ph { font-size: 17px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge .ph { font-size: 14px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; color: var(--text-2); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.chip:hover { border-color: var(--border-strong); }
.chip .n { font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 600; color: var(--muted); }
.chip.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); }
.chip.active .n { color: var(--accent-text); }

.field { display: grid; gap: 6px; }
.field label, .label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.help { font-size: 12px; color: var(--muted); }
.input, select.input {
  height: 38px; width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
select.input { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar .input { width: auto; min-width: 160px; }
.toolbar .search { max-width: 300px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 10px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); }
.route { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.route .ph { font-size: 14px; color: var(--muted); }
.plate {
  display: inline-block; font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 12px; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}

.pager { display: flex; align-items: center; gap: 4px; }
.pager button { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; cursor: pointer; font-family: 'Montserrat', sans-serif; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.pager button:hover { background: var(--surface-3); }
.pager button.active { background: var(--accent-soft); color: var(--accent-text); }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--warn-soft); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent);
  font-size: 13px;
}
.alert > .ph { color: var(--warn); font-size: 20px; flex: none; margin-top: 1px; }
.alert strong { font-weight: 600; }
.alert.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.alert.info > .ph { color: var(--accent-text); }
.alert .alert-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

/* KPI */
.kpis { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1.25fr; gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi .k-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .k-label .ph { font-size: 18px; color: var(--muted); }
.kpi .k-value { font-family: 'Montserrat', sans-serif; font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 600; line-height: 1.15; }
.kpi .k-meta { font-size: 12.5px; color: var(--muted); }
.kpi .k-meta .num { white-space: nowrap; }
.kpi.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.kpi.primary .k-label, .kpi.primary .k-label .ph, .kpi.primary .k-meta { color: color-mix(in srgb, var(--on-accent) 82%, transparent); }
.kpi.primary .k-value { color: var(--on-accent); }
.kpi.primary a { color: var(--on-accent); text-decoration: underline; }
.kpi .k-value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }

/* Lista zadań na pulpicie */
.task { display: flex; gap: 14px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task-ic { width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.task-ic.warn { background: var(--warn-soft); color: var(--warn); }
.task-ic.danger { background: var(--danger-soft); color: var(--danger); }
.task-ic.accent { background: var(--accent-soft); color: var(--accent-text); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 500; }
.task-desc { font-size: 12.5px; color: var(--muted); }
.task-side { display: flex; align-items: center; gap: 12px; flex: none; }
.task-time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Lejek dnia */
.flow { display: grid; gap: 12px; }
.flow-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.flow-row .bar-track { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.flow-row .bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.flow-row .f-name { font-size: 13px; color: var(--text-2); }
.flow-row .f-val { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 14px; }

.status-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.status-list li:last-child { border-bottom: 0; }
.status-list .s-name { flex: 1; color: var(--text); }
.status-list .s-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.sdot.warn { background: var(--warn); }
.sdot.off { background: var(--border-strong); }

/* Karta zlecenia */
.stepper { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); padding: 20px; overflow-x: auto; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 0 6px; }
.step::before { content: ""; position: absolute; top: 13px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 2px; background: var(--border); }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--ok); }
.step-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--muted); font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 600; position: relative; z-index: 1; }
.step.done .step-dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.step.current .step-dot { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); line-height: 1.3; }
.step.current .step-label { color: var(--accent-text); }
.step-time { font-size: 11.5px; color: var(--muted); }

.dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; }
.dl.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dl dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.dl dd { font-weight: 500; line-height: 1.45; }
.dl dd .cell-sub { font-weight: 400; }
.dl .full { grid-column: 1 / -1; }
.src { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; height: 18px; }
.low { background: var(--warn-soft); border-radius: 6px; padding: 6px 8px; margin: -6px -8px; }
.low dt { color: var(--warn); }
.sect { font-family: 'Montserrat', sans-serif; font-size: 13px; font-weight: 600; margin: 24px 0 14px; display: flex; align-items: center; gap: 10px; }
.sect::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sect:first-child { margin-top: 0; }

.files { display: grid; gap: 10px; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); transition: border-color .15s, background .15s; cursor: pointer; }
.file:hover { border-color: var(--border-strong); background: var(--surface-2); }
.file-ic { width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; background: var(--danger-soft); color: var(--danger); }
.file-ic.img { background: var(--accent-soft); color: var(--accent-text); }
.file-ic.mail { background: var(--surface-3); color: var(--text-2); }
.file-name { font-weight: 500; font-size: 13px; }
.file-meta { font-size: 12px; color: var(--muted); }
.file .ph-download-simple { margin-left: auto; color: var(--muted); }

.req li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.req li:last-child { border-bottom: 0; }
.req .ph { color: var(--muted); font-size: 18px; flex: none; margin-top: 1px; }
.req .r-k { color: var(--muted); font-size: 12px; }
.req .r-v { font-weight: 500; }

.timeline li { position: relative; padding: 0 0 16px 24px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline li.ok::before { border-color: var(--ok); background: var(--ok); }
.timeline li.accent::before { border-color: var(--accent); }
.timeline .t-time { font-size: 12px; color: var(--muted); }

/* Akceptacja i kartoteka: lista + szczegół */
.split { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.list-item { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--border); padding: 14px 20px; cursor: pointer; transition: background .12s; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.li-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.li-title { font-weight: 500; font-size: 13.5px; }
.li-amount { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.li-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.li-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Podgląd dokumentu (faktura, karta wysyłki): zawsze jasny, bo to papier */
.paper-wrap { background: var(--surface-3); border-radius: var(--radius); padding: 28px; }
.paper {
  max-width: 760px; margin: 0 auto;
  background: #FFFFFE; color: #1A1F27;
  border-radius: 6px; padding: 40px 44px;
  box-shadow: 0 1px 3px rgba(20, 28, 45, .12), 0 12px 32px rgba(20, 28, 45, .10);
  font-size: 12px; line-height: 1.55;
}
.paper h3 { color: #1A1F27; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.paper .p-muted { color: #6A7383; }
.paper .p-label { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: #6A7383; margin-bottom: 4px; }
.paper .p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.paper .p-sep { height: 1px; background: #E4E7EC; margin: 20px 0; }
.paper .p-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.paper .p-meta dd { text-align: right; font-weight: 500; }
.paper table { font-size: 11.5px; margin-top: 4px; }
.paper th { background: #F1F3F6; color: #4A5363; font-size: 10.5px; padding: 8px 10px; border: 0; }
.paper td { padding: 9px 10px; border-bottom: 1px solid #E4E7EC; }
.paper th:first-child, .paper td:first-child { padding-left: 10px; }
.paper th:last-child, .paper td:last-child { padding-right: 10px; }
.paper tbody tr:hover { background: transparent; }
.paper .p-total { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 4px 28px; margin-top: 14px; }
.paper .p-total .big { font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 600; }
.paper .p-notes { background: #F6F7F9; border-radius: 6px; padding: 14px 16px; margin-top: 18px; }
.paper .p-notes p + p { margin-top: 4px; }
.paper .draft { display: inline-block; margin-left: 10px; font-family: 'Poppins', sans-serif; font-size: 11px; font-weight: 500; letter-spacing: .04em; padding: 2px 9px; border-radius: 999px; background: #FBF1DE; color: #8A5A0D; vertical-align: middle; }
.paper .mark { background: #FFF3C4; border-radius: 3px; padding: 0 2px; }

.actionbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; margin-top: 20px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.actionbar .ab-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.actionbar .ab-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* Karta wysyłki */
.shipping { max-width: 620px; }
.ship-address { border: 2px solid #1A1F27; border-radius: 6px; padding: 18px 22px; font-size: 16px; line-height: 1.5; font-weight: 500; }
.ship-address .p-label { margin-bottom: 8px; }
.ship-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.ship-fact { background: #F4F6F9; border-radius: 6px; padding: 12px 14px; }
.ship-fact .v { font-family: 'Montserrat', sans-serif; font-size: 20px; font-weight: 600; }
.ship-check li { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 12.5px; }
.ship-check .box { width: 15px; height: 15px; border: 1.5px solid #1A1F27; border-radius: 3px; flex: none; }
.ship-envelope { border: 1.5px dashed #8A5A0D; color: #8A5A0D; border-radius: 6px; padding: 10px 14px; margin-top: 16px; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 10px; }

/* Płatności */
.tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { height: 46px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; font-weight: 500; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab .count { font-family: 'Montserrat', sans-serif; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 1px 7px; }
.tab.active .count { background: var(--accent-soft); color: var(--accent-text); }

.match { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.match:last-child { border-bottom: 0; }
.match .m-arrow { color: var(--muted); font-size: 20px; }
.match .m-k { font-size: 12px; color: var(--muted); }
.match .m-v { font-weight: 500; }
.match .m-actions { display: flex; gap: 8px; }
.conf { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.summary > div { padding: 16px 20px; border-right: 1px solid var(--border); }
.summary > div:last-child { border-right: 0; }
.summary .s-k { font-size: 12.5px; color: var(--muted); }
.summary .s-v { font-family: 'Montserrat', sans-serif; font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 600; margin-top: 2px; }
.summary .s-v small { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.group-row td { background: var(--surface-2); font-weight: 600; }
.group-row:hover td { background: var(--surface-2) !important; }

/* Zestawienia */
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 120px; gap: 14px; align-items: center; font-size: 13px; }
.bar-row .b-name { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .b-bar { height: 12px; border-radius: 999px; background: var(--accent); min-width: 6px; }
.bar-row .b-bar.alt { background: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.bar-row .b-val { text-align: right; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* Ustawienia */
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .18s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.setting { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting-body { flex: 1; min-width: 0; }
.setting-title { font-weight: 500; }
.setting-desc { font-size: 12.5px; color: var(--muted); }

/* Logowanie */
.login { display: none; min-height: 100dvh; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login.active { display: grid; }
.login-side {
  position: relative; overflow: hidden;
  background: #16307E; color: #EEF2FD;
  padding: 48px 56px; display: flex; flex-direction: column;
}
.login-side::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(115, 149, 243, .35), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(42, 85, 208, .55), transparent 60%);
  pointer-events: none;
}
.login-side > * { position: relative; }
.login-side .brand-mark { background: #EEF2FD; color: #16307E; }
.login-side h2 { color: #FBFCFF; font-size: 34px; font-weight: 600; line-height: 1.2; max-width: 15ch; margin-top: auto; }
.login-side p { color: rgba(238, 242, 253, .78); max-width: 44ch; margin-top: 14px; font-size: 15px; }
.login-points { margin-top: 32px; display: grid; gap: 12px; }
.login-points li { display: flex; gap: 12px; align-items: center; color: rgba(238, 242, 253, .9); }
.login-points .ph { font-size: 20px; color: #A2B8F8; }
.login-side .foot { margin-top: 48px; font-size: 12px; color: rgba(238, 242, 253, .6); }
.login-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 24px; font-weight: 600; }
.login-card .sub { color: var(--muted); margin: 6px 0 28px; }
.login-card form { display: grid; gap: 18px; }
.login-card .btn { width: 100%; height: 44px; }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.otp input { height: 52px; text-align: center; font-family: 'Montserrat', sans-serif; font-size: 20px; font-weight: 600; padding: 0; }
.login-help { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 18px; }

.scrim { display: none; }
.mock-note { margin-top: 28px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

/* ==========================================================================
   Responsywność
   ========================================================================== */
@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .two-col { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; width: 280px; transform: translateX(-100%); transition: transform .24s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(10, 15, 25, .45); }
  .menu-btn { display: inline-flex; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary > div:nth-child(2) { border-right: 0; }
  .summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .match { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .match .m-arrow { transform: rotate(90deg); }
}
@media (max-width: 720px) {
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .testbar { padding: 7px 16px; }
  .testbar a { display: none; }
  .topbar .search { display: none; }
  .kbd { display: none; }
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .kpi { padding: 14px 16px; }
  .kpi .k-value { font-size: 24px; }
  .dl, .dl.two { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 21px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .task { flex-wrap: wrap; padding: 14px 16px; }
  .task-side { width: 100%; justify-content: space-between; padding-left: 50px; }
  .paper-wrap { padding: 12px; }
  .paper { padding: 22px 18px; }
  .paper .p-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ship-facts { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: minmax(0, 1fr) 96px; }
  .bar-row .b-bar { grid-column: 1 / -1; grid-row: 2; }
  .login.active { grid-template-columns: minmax(0, 1fr); }
  .login-side { display: none; }
  .toolbar .input, .toolbar .search { width: 100%; max-width: none; }
  .alert { flex-wrap: wrap; }
  .alert .alert-actions { margin-left: 32px; flex-wrap: wrap; }
  .actionbar .ab-btns { width: 100%; }
  .actionbar .ab-btns .btn { flex: 1; }
  .card-h, .card-b, .toolbar, .tabs { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Motyw WordPress: uzupełnienia do makiety (T-20)
   ========================================================================== */
.content { animation: fade .22s ease-out; }
.brand, .brand:hover { color: inherit; text-decoration: none; }
a.list-item, a.chip, a.tab, a.file, a.row-link { color: inherit; text-decoration: none; }
a.list-item:hover, a.chip:hover, a.tab:hover, a.file:hover, a.row-link:hover { text-decoration: none; }
a.row-link:hover { color: var(--accent-text); }
ol.stepper { list-style: none; }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.badge-lg { height: 38px; padding: 0 14px; }
.file-ic.sm { width: 32px; height: 32px; }
.paper-bg { background: var(--surface-3); border-radius: 0 0 var(--radius) var(--radius); }
.paper.shipping { padding: 28px; }
.paper .p-title { font-size: 17px; font-weight: 600; color: #1A1F27; }
.danger-text { color: var(--danger) !important; }
.warn-text { color: var(--warn); }
.ok-icon { color: var(--ok); vertical-align: -3px; }
.inline-ic { font-size: 13px; vertical-align: -2px; }
.h-lg { font-size: 17px !important; }
.w500 { font-weight: 500; }
.input-auto { width: auto; }
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bar-row.bar-row-sm { grid-template-columns: 90px minmax(0, 1fr) 60px; }
.search.search-full { max-width: none; width: 100%; }
.num.text { color: var(--text); }
.conf { margin-top: 4px; }
.conf.ok { color: var(--ok); }
.conf.warn { color: var(--warn); }
td.empty-row { text-align: center; padding: 40px; color: var(--muted); }
.empty-state { max-width: 460px; margin: 64px auto; text-align: center; display: grid; justify-items: center; gap: 12px; }
.empty-state h1 { font-size: 22px; font-weight: 600; }
.empty-state p { color: var(--muted); margin-bottom: 8px; }
.empty-ic { width: 56px; height: 56px; border-radius: var(--radius); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty-ic .ph { font-size: 28px; }

/* Logowanie */
.alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.alert.danger > .ph { color: var(--danger); }
.login-card > .alert { margin-bottom: 20px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.otp-input { height: 54px; text-align: center; font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: 600; letter-spacing: .4em; padding-left: calc(12px + .4em); }
.otp-input::placeholder { color: var(--border-strong); }
.setup-steps { list-style: decimal; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); font-size: 13.5px; margin: -12px 0 20px; }
.qr-box { display: grid; grid-template-columns: 156px minmax(0, 1fr); gap: 18px; align-items: center; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 22px; }
.qr { width: 156px; height: 156px; padding: 8px; background: #FFFFFE; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-manual { display: grid; gap: 8px; min-width: 0; }
.qr-manual code { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 14px; letter-spacing: .06em; word-break: break-all; background: var(--surface-3); border-radius: 6px; padding: 8px 10px; }
@media (max-width: 720px) {
  .kpis.kpis-3 { grid-template-columns: minmax(0, 1fr); }
  .qr-box { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
}

/* Akceptacja z linku w mailu */
.approve-page { max-width: 860px; margin: 0 auto; padding: 28px 16px 48px; display: grid; gap: 18px; }
.approve-brand { padding: 0; }
.approve-card { padding: 8px 20px; }
.empty-ic.ok-bg { background: var(--ok-soft); color: var(--ok); }
.actionbar form, form.actionbar { margin-top: 0; }
.flash { margin-bottom: 20px; }
.nav .count.warn { background: var(--warn-soft); color: var(--warn); }
.pager a { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); font-family: 'Montserrat', sans-serif; font-size: 12.5px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.pager a:hover { background: var(--surface-3); text-decoration: none; }
.pager a.active { background: var(--accent-soft); color: var(--accent-text); }
.alert.success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.alert.success > .ph { color: var(--ok); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.card-f form { display: inline; }
a.kpi-link { color: inherit; text-decoration: none; transition: border-color .15s, transform .1s; }
a.kpi-link:hover { text-decoration: none; border-color: var(--border-strong); }
a.kpi.primary.kpi-link:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.empty-state.small { margin: 28px auto; gap: 8px; }
.empty-state.small p { margin: 0; }
.alert.danger strong { color: var(--danger); }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.list-item.with-check { display: flex; gap: 12px; align-items: flex-start; }
.list-item.with-check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.list-item.with-check > a { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.annotations-edit { margin-top: 16px; }
.annotations-edit summary { cursor: pointer; padding: 14px 20px; font-weight: 500; display: flex; gap: 8px; align-items: center; list-style: none; }
.annotations-edit summary::-webkit-details-marker { display: none; }
.textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
tbody tr.selected { background: var(--accent-soft); }
.sect.pad { margin: 18px 20px 6px; }
.match .m-actions form { display: inline; }
.match .field .input { min-width: 260px; }
.upload-form label.btn { cursor: pointer; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
