:root {
  --ink: #102a43;
  --muted: #64778a;
  --line: #d9e3ec;
  --soft: #f0f5f9;
  --canvas: #eaf1f7;
  --paper: #ffffff;
  --accent: #2f80c9;
  --accent-dark: #1d5f96;
  --success: #167d52;
  --success-soft: #e9f7ef;
  --warning: #a56312;
  --warning-soft: #fff4db;
  --error: #b33b32;
  --error-soft: #fdecea;
  --shadow: 0 14px 40px rgba(16, 42, 67, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.auth-pending .app-shell,
body.auth-locked .app-shell {
  display: none;
}

body.auth-ready .auth-gate {
  display: none;
}

button, input { font: inherit; }
button { color: inherit; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.auth-gate {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(47, 128, 201, .24), transparent 34%),
    linear-gradient(135deg, #0d2438, #163f63);
}

.auth-gate.hidden { display: none; }

.auth-card {
  width: min(430px, 100%);
  padding: 34px;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .24);
}

.auth-card h1 {
  margin: 6px 0 8px;
  font-size: 30px;
  letter-spacing: -.04em;
}

.auth-card p {
  color: var(--muted);
  line-height: 1.45;
}

.auth-mark {
  margin-bottom: 18px;
}

.auth-card .button {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

.auth-user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 18px 18px;
  color: #f7faf6;
  background: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 7px 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--accent);
  border-radius: 13px;
}

.brand-mark svg { width: 27px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; letter-spacing: -0.02em; }
.brand span { margin-top: 2px; color: #9fa8a3; font-size: 12px; }

.invoice-priority-button {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 20px;
  padding: 28px 12px 13px;
  color: #fff;
  text-align: left;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(47, 128, 201, .22);
}
.invoice-priority-button:hover,
.invoice-priority-button.active { background: #4193dc; }
.invoice-priority-badge {
  position: absolute;
  top: 7px;
  left: 12px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .14em;
}
.invoice-priority-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, .16);
  border-radius: 10px;
}
.invoice-priority-icon svg { width: 21px; }
.invoice-priority-button strong,
.invoice-priority-button small { display: block; }
.invoice-priority-button strong { font-size: 14px; }
.invoice-priority-button small { margin-top: 3px; color: #d8eaf9; font-size: 10px; }

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px 10px;
  color: #929c97;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.icon-button, .menu-button, .mobile-menu, .modal-close {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 30px;
  height: 30px;
  color: #fff;
  background: var(--accent);
  border-radius: 9px;
}

.icon-button svg { width: 17px; }

.delivery-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
}

.delivery-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 5px 12px;
}
.delivery-search svg {
  position: absolute;
  left: 10px;
  width: 16px;
  color: #7f8a84;
}
.delivery-search input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 34px;
  color: #f6f8f5;
  font-size: 12px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  outline: 0;
}
.delivery-search input::placeholder { color: #7f8a84; }
.delivery-search input:focus { border-color: rgba(83, 165, 235, .62); }

.batch-mode-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 11px;
  padding: 11px 12px;
  color: #f7faf6;
  text-align: left;
  background: rgba(47, 128, 201, .12);
  border: 1px solid rgba(83, 165, 235, .25);
  border-radius: 12px;
  cursor: pointer;
}
.batch-mode-button:hover,
.batch-mode-button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.batch-mode-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  color: #fff;
  background: var(--accent);
  border-radius: 9px;
}
.batch-mode-button.active .batch-mode-icon,
.batch-mode-button:hover .batch-mode-icon { background: rgba(255, 255, 255, .16); }
.batch-mode-icon svg { width: 19px; }
.batch-mode-button strong,
.batch-mode-button small { display: block; }
.batch-mode-button strong { font-size: 13px; }
.batch-mode-button small { margin-top: 2px; color: #9ba49f; font-size: 10px; }
.batch-mode-button.active small,
.batch-mode-button:hover small { color: #d8eaf9; }

.delivery-item {
  width: 100%;
  padding: 13px 12px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  transition: .16s ease;
}

.delivery-item:hover { background: rgba(255, 255, 255, .055); }
.delivery-item.active {
  background: rgba(47, 128, 201, .18);
  border-color: rgba(83, 165, 235, .32);
}

.delivery-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.delivery-item strong {
  overflow: hidden;
  color: #f7faf6;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-item small {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: #929c97;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-status {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: #7e8782;
  border-radius: 50%;
}

.list-status.in_progress { background: #f4be44; }
.list-status.complete { background: var(--success); box-shadow: 0 0 0 4px rgba(22, 125, 82, .11); }
.list-status.discrepancy { background: #ff6e62; }

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .09);
}

.gmail-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 10px;
  color: #fff;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.gmail-card:hover { background: rgba(255, 255, 255, .055); }
.gmail-card > span:nth-child(2) { flex: 1; }
.gmail-card strong, .gmail-card small { display: block; }
.gmail-card strong { font-size: 13px; }
.gmail-card small { margin-top: 3px; color: #929c97; font-size: 10px; }
.gmail-card svg { width: 17px; color: #84908a; }

.gmail-dot {
  width: 9px;
  height: 9px;
  background: #707a75;
  border-radius: 50%;
}

.gmail-dot.connected { background: var(--accent); }
.gmail-dot.waiting { background: #f4be44; }
.gmail-dot.error { background: #ff6e62; }

.main { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  min-height: 105px;
  padding: 22px clamp(26px, 4vw, 58px);
  background: rgba(255, 255, 255, .87);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-copy { flex: 1; min-width: 0; }
.eyebrow {
  margin: 0 0 6px;
  color: #7f8883;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}

h1, h2, p { margin-top: 0; }
h1 {
  overflow: hidden;
  margin-bottom: 0;
  font-size: clamp(23px, 2.5vw, 33px);
  letter-spacing: -.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -.03em;
}

.topbar-actions { display: flex; align-items: center; gap: 9px; margin-left: 20px; }
.camera-scan-button svg { fill: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: .15s ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .42; cursor: default; transform: none; }
.button svg { width: 17px; }
.button.primary { color: #fff; background: var(--accent); }
.button.primary:hover { background: #4193dc; }
.button.secondary { background: var(--paper); border-color: var(--line); }
.button.secondary:hover { border-color: #cbd0cc; }

.menu-button {
  width: 42px;
  height: 42px;
  color: #727a76;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.menu-button svg { width: 17px; }
.menu-button:disabled { opacity: .4; cursor: default; }

.mobile-menu { display: none; }

.workspace {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px clamp(26px, 4vw, 58px) 50px;
}

.batch-workspace {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px clamp(26px, 4vw, 58px) 50px;
}
.section-workspace {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px clamp(26px, 4vw, 58px) 50px;
}
.section-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 25px 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.section-hero h2 { margin-bottom: 7px; font-size: 24px; }
.section-hero p:last-child {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.section-hero-actions { display: flex; gap: 9px; flex-shrink: 0; }
.invoice-hero {
  color: #f8fbfa;
  background: linear-gradient(135deg, #102a43 0%, #174d78 100%);
  border-color: #102a43;
}
.invoice-hero .eyebrow { color: #78bdf2; }
.invoice-hero p:last-child { color: #d2e3f0; }
.invoice-hero-badge {
  display: grid;
  min-width: 160px;
  padding: 15px 18px;
  text-align: right;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
}
.invoice-hero-badge span { color: #78bdf2; font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.invoice-hero-badge strong { margin: 3px 0; font-size: 30px; }
.invoice-hero-badge small { color: #c8dce9; font-size: 10px; }
.wake-lock-button { white-space: nowrap; }
.wake-lock-dot {
  width: 8px;
  height: 8px;
  background: #a0a8a3;
  border-radius: 50%;
}
.wake-lock-button.active {
  color: var(--success);
  background: var(--success-soft);
  border-color: #cce9d8;
}
.wake-lock-button.active .wake-lock-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 125, 82, .1);
}
.inventory-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}
.inventory-sessions { overflow: hidden; }
.inventory-session-list { display: grid; max-height: 620px; overflow-y: auto; }
.inventory-session-button {
  width: 100%;
  padding: 14px 18px;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.inventory-session-button:hover,
.inventory-session-button.active { background: #f5f8e9; }
.inventory-session-button strong,
.inventory-session-button small { display: block; }
.inventory-session-button strong { margin-bottom: 5px; font-size: 12px; }
.inventory-session-button small { color: var(--muted); font-size: 10px; }
.inventory-main { min-width: 0; }
.inventory-metrics { grid-template-columns: repeat(3, 1fr); }
.action-button {
  padding: 6px 9px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 750;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.action-button:hover { border-color: #b8bfba; }
.action-button:disabled { opacity: .48; cursor: default; }
.action-button.danger,
.button.danger { color: var(--error); background: var(--error-soft); border-color: #f1cbc6; }
.action-button.success { color: var(--success); background: var(--success-soft); border-color: #cce9d8; }
.source-label { color: var(--muted); font-size: 9px; }
.source-detail { display: block; max-width: 220px; margin-top: 4px; color: #89908c; font-size: 9px; line-height: 1.35; }
.source-link { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

.batch-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(390px, .9fr);
  align-items: center;
  gap: 30px;
  margin-bottom: 22px;
  padding: 24px 28px;
  color: #f7faf6;
  background: var(--ink);
  border-radius: var(--radius);
}
.batch-intro h2 { margin-bottom: 8px; font-size: 24px; }
.batch-intro > div > p:last-child {
  max-width: 680px;
  margin-bottom: 0;
  color: #b5bdb8;
  font-size: 13px;
  line-height: 1.55;
}
.batch-intro .eyebrow { color: var(--accent); }
.batch-steps { display: grid; gap: 8px; }
.batch-steps span {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #d9dfdb;
  font-size: 12px;
}
.batch-steps b {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: var(--ink);
  font-size: 10px;
  background: var(--accent);
  border-radius: 50%;
}

.batch-scan-card {
  margin-bottom: 16px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.batch-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.batch-scanner input { font-size: 18px; }
.batch-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 11px;
  color: #67706b;
  font-size: 11px;
}
.batch-context strong {
  flex: 0 0 auto;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.listener-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  background: #9da5a0;
  border-radius: 50%;
}
.listener-dot.active {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 125, 82, .11);
}
.listener-dot.warning { background: var(--warning); }

.batch-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.batch-metrics div {
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.batch-metrics small,
.batch-metrics strong { display: block; }
.batch-metrics small { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.batch-metrics strong { font-size: 25px; font-variant-numeric: tabular-nums; }
.batch-metrics .problem strong { color: var(--error); }
.carton-content-metrics { grid-template-columns: repeat(8, 1fr); }
.carton-content-metrics .confirmed strong { color: var(--success); }
.invoice-metrics {
  grid-column: 1;
  grid-row: 2;
  grid-template-columns: repeat(3, 1fr);
  align-self: start;
}
.invoice-metrics .confirmed strong { color: var(--success); }
#invoiceWorkspace:not(.hidden) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: 0 22px;
}
.invoice-hero { grid-column: 1 / -1; grid-row: 1; }
.supplier-control-card {
  position: sticky;
  top: 108px;
  grid-column: 2;
  grid-row: 2 / span 2;
  max-height: calc(100vh - 130px);
  margin-bottom: 18px;
  padding: 0;
  overflow-y: auto;
}
.invoice-list-card { grid-column: 1; grid-row: 3; }
.supplier-panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 17px 18px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 0;
  border-radius: inherit;
  cursor: pointer;
}
.supplier-panel-toggle:hover { background: #f7fafc; }
.supplier-panel-toggle small,
.supplier-panel-toggle strong,
.supplier-panel-toggle em { display: block; }
.supplier-panel-toggle small {
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .09em;
}
.supplier-panel-toggle strong { margin-top: 3px; font-size: 14px; }
.supplier-panel-toggle em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}
.supplier-panel-chevron {
  color: var(--muted);
  font-size: 22px;
  transition: transform .16s ease;
}
.supplier-panel-body { padding: 2px 20px 20px; }
.supplier-control-card.collapsed {
  max-height: none;
  overflow: hidden;
}
.supplier-control-card.collapsed .supplier-panel-body { display: none; }
.supplier-control-card:not(.collapsed) .supplier-panel-chevron {
  transform: rotate(180deg);
}
.supplier-control-card .batch-section-heading p:last-child {
  max-width: 820px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.supplier-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
}
.tracked-suppliers,
.supplier-candidates {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.supplier-chip,
.supplier-candidate {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 11px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.supplier-chip { background: var(--success-soft); border-color: #cce9d8; }
.supplier-chip > span,
.supplier-candidate > span { min-width: 0; }
.supplier-chip strong,
.supplier-chip small,
.supplier-candidate strong,
.supplier-candidate small { display: block; }
.supplier-chip strong,
.supplier-candidate strong {
  overflow: hidden;
  max-width: 250px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.supplier-chip small,
.supplier-candidate small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.supplier-candidates-wrap {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.supplier-candidates-wrap > .eyebrow { color: var(--muted); }
.supplier-empty { color: var(--muted); font-size: 11px; line-height: 1.5; }
.invoice-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.invoice-filters select,
.invoice-filters input {
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.invoice-filters input { min-width: 310px; flex: 1; }
.invoice-filters .action-button { min-height: 36px; background: var(--soft); }
.invoice-result-count {
  margin-top: 13px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}
.invoice-card-list {
  display: grid;
  gap: 11px;
  margin-top: 18px;
}
.invoice-summary-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 7px solid var(--error);
  border-radius: 14px;
  box-shadow: 0 7px 22px rgba(16, 42, 67, .05);
}
.invoice-summary-card.partial { border-left-color: var(--warning); }
.invoice-summary-card.complete { border-left-color: var(--success); }
.invoice-summary-card.ignored { opacity: .72; border-left-color: #8a99a6; }
.invoice-summary-card.expanded { box-shadow: 0 12px 30px rgba(16, 42, 67, .11); }
.invoice-summary-card.pending .invoice-summary-toggle { background: #fff7f6; }
.invoice-summary-card.partial .invoice-summary-toggle { background: #fff9eb; }
.invoice-summary-card.complete .invoice-summary-toggle { background: #eff9f3; }
.invoice-summary-card.ignored .invoice-summary-toggle { background: var(--soft); }
.invoice-summary-card.pending .invoice-card-tools { background: #fff7f6; }
.invoice-summary-card.partial .invoice-card-tools { background: #fff9eb; }
.invoice-summary-card.complete .invoice-card-tools { background: #eff9f3; }
.invoice-summary-card.ignored .invoice-card-tools { background: var(--soft); }
.invoice-summary-toggle {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) 110px minmax(180px, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 17px 18px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.invoice-summary-toggle:hover { background: #f7fafc; }
.invoice-card-main,
.invoice-card-main strong,
.invoice-card-main small,
.invoice-card-progress strong,
.invoice-card-progress small { display: block; }
.invoice-card-supplier {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.invoice-card-main strong { font-size: 15px; }
.invoice-card-main small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.invoice-card-progress { text-align: center; font-variant-numeric: tabular-nums; }
.invoice-card-progress strong { font-size: 24px; letter-spacing: -.04em; }
.invoice-card-progress small { color: var(--muted); font-size: 9px; }
.invoice-card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  color: var(--muted);
  font-size: 10px;
}
.invoice-card-facts b { color: var(--ink); }
.invoice-card-status { display: flex; align-items: center; gap: 9px; }
.invoice-chevron { color: var(--muted); font-size: 20px; transition: transform .16s ease; }
.invoice-summary-card.expanded .invoice-chevron { transform: rotate(180deg); }
.invoice-card-tools {
  display: flex;
  justify-content: flex-end;
  padding: 0 18px 12px;
}
.invoice-ksef-copy {
  min-height: 30px;
  background: rgba(255, 255, 255, .72);
}
.status-badge.pending { color: var(--error); background: var(--error-soft); }
.status-badge.partial { color: var(--warning); background: var(--warning-soft); }
.status-badge.ignored { color: #68716c; background: var(--soft); }
.invoice-expanded-content {
  padding: 18px;
  background: #f7fafc;
  border-top: 1px solid var(--line);
}
.invoice-detail-loading { padding: 22px; color: var(--muted); text-align: center; }
.invoice-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.invoice-detail-header p { margin: 0; color: var(--muted); font-size: 11px; }
.invoice-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.invoice-line-list { display: grid; gap: 7px; }
.invoice-line {
  display: grid;
  grid-template-columns: minmax(200px, 1.7fr) minmax(110px, .8fr) repeat(3, minmax(70px, .45fr)) minmax(170px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.invoice-line > div > small,
.invoice-line > div > strong { display: block; }
.invoice-line > div > small { margin-bottom: 3px; color: var(--muted); font-size: 8px; }
.invoice-line > div > strong { font-size: 11px; }
.invoice-item-name strong,
.invoice-item-name small { display: block; }
.invoice-item-name small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.invoice-line-code strong { font-variant-numeric: tabular-nums; }
.invoice-line-state { display: grid; justify-items: end; gap: 7px; }
.invoice-manual-note { color: var(--warning); font-size: 9px; font-weight: 750; }
.panel-copy { max-width: 720px; margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.product-scan-actions { display: flex; align-items: center; gap: 8px; }
.carton-product-scan-card { border-color: #b9d5eb; }
.product-bulk-entry {
  margin-top: 13px;
  background: #f6f9fc;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.product-bulk-entry summary {
  padding: 12px 14px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.product-bulk-entry[open] summary { border-bottom: 1px solid var(--line); }
.product-bulk-entry form {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.product-bulk-entry p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.product-bulk-entry .button { justify-self: start; }
.queue-label {
  padding: 7px 10px;
  color: #59625d;
  font-size: 11px;
  background: var(--soft);
  border-radius: 8px;
}
.carton-content-results { margin-bottom: 22px; }
.carton-content-table { min-width: 1320px; }
.carton-content-table.combined { min-width: 1120px; }
.content-confirm-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 22px 25px;
  background: #edf6fc;
  border: 1px solid #c7deef;
  border-radius: 14px;
}
.content-confirm-card h2 { margin: 2px 0 6px; font-size: 19px; }
.content-confirm-card p:last-child {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.content-confirm-card.confirmed {
  background: var(--success-soft);
  border-color: #cce9d8;
}
.carton-status-card { margin-bottom: 22px; }
.carton-status-toolbar {
  display: grid;
  justify-items: end;
  gap: 9px;
}
.carton-status-filters {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}
.carton-status-filters .action-button {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 9px;
  background: #fff;
}
.carton-status-filters .action-button.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}
.carton-selection-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.carton-selection-actions > span {
  color: var(--muted);
  font-size: 10px;
}
.carton-selection-actions > span strong { color: var(--ink); }
.carton-selection-actions .button { min-height: 34px; padding: 8px 12px; }
.carton-status-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 22px 22px;
}
.carton-status-groups.filtered { grid-template-columns: minmax(0, 1fr); }
.carton-status-group {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.carton-status-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 850;
}
.carton-status-heading span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.carton-status-heading i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.carton-status-heading strong {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 25px;
  padding: 0 7px;
  font-size: 12px;
  background: rgba(255, 255, 255, .72);
  border-radius: 7px;
}
.carton-status-group.pending .carton-status-heading {
  color: #76430a;
  background: var(--warning-soft);
}
.carton-status-group.pending .carton-status-heading i { background: var(--warning); }
.carton-status-group.confirmed .carton-status-heading {
  color: #0e6240;
  background: var(--success-soft);
}
.carton-status-group.confirmed .carton-status-heading i { background: var(--success); }
.carton-status-group.waiting .carton-status-heading {
  color: #8e2f29;
  background: var(--error-soft);
}
.carton-status-group.waiting .carton-status-heading i { background: var(--error); }
.carton-status-list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 270px;
  padding: 10px;
  overflow-y: auto;
  background: #fff;
}
.carton-status-list > p {
  margin: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
.carton-status-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-left: 4px solid;
  border-radius: 7px;
}
.carton-status-item.selectable {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.carton-allegro-checkbox,
.carton-row-checkbox { flex: 0 0 auto; }
.carton-status-item .code {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.carton-status-item small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.carton-status-item.pending { background: #fffaf0; border-color: var(--warning); }
.carton-status-item.confirmed { background: #f1faf5; border-color: var(--success); }
.carton-status-item.waiting { background: #fff5f4; border-color: var(--error); }
.confirmation-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
}
.queue-total {
  display: grid;
  min-width: 90px;
  padding: 14px 18px;
  text-align: center;
  background: var(--soft);
  border-radius: 12px;
}
.queue-total strong { font-size: 25px; }
.queue-total small { color: var(--muted); font-size: 10px; }
.view-switch {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  padding: 4px;
  background: var(--soft);
  border-radius: 9px;
}
.view-switch .action-button { border-color: transparent; }
.view-switch .action-button.active {
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 2px 7px rgba(23, 32, 29, .07);
}
.carton-group-row td {
  padding-block: 10px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  background: #f5f7f4;
  border-top: 1px solid var(--line);
}
.carton-group-row.confirmed td { background: #edf8f2; }
.carton-group-row.pending td { background: #fff7e8; }
.carton-group-row td {
  align-items: center;
  justify-content: space-between;
}
.carton-group-copy { display: inline-flex; align-items: center; gap: 7px; }
.carton-inline-status {
  float: right;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .02em;
  border-radius: 999px;
}
.carton-inline-status.confirmed { color: #0e6240; background: #cdebd9; }
.carton-inline-status.pending { color: #76430a; background: #ffe2a6; }
.carton-group-row small { margin-left: 9px; color: var(--muted); font-weight: 600; }
.code-chip-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 22px; }
.code-chip {
  padding: 7px 9px;
  color: var(--error);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  background: var(--error-soft);
  border-radius: 7px;
}
.pending-carton-chip {
  display: inline-flex;
  align-items: stretch;
}
.pending-carton-chip .code-chip { border-radius: 7px 0 0 7px; }
.pending-carton-remove {
  padding: 0 10px;
  color: #8e2f29;
  font-size: 10px;
  font-weight: 800;
  background: #fff;
  border: 1px solid #efcac6;
  border-left: 0;
  border-radius: 0 7px 7px 0;
  cursor: pointer;
}
.pending-carton-remove:disabled { opacity: .55; cursor: wait; }

.batch-results { margin-bottom: 22px; }
.batch-products-total { margin-bottom: 22px; }
.summary-note { color: var(--muted); font-size: 11px; }
.batch-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.allegro-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.allegro-bulk-actions > span {
  margin-right: 2px;
  color: var(--muted);
  font-size: 11px;
}
.allegro-bulk-actions > span strong { color: var(--ink); }
.select-cell {
  width: 42px;
  min-width: 42px;
  text-align: center;
}
.row-checkbox {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}
.batch-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.batch-problems,
.batch-history { min-height: 290px; }
.batch-list {
  display: grid;
  max-height: 340px;
  overflow-y: auto;
}
.batch-list-row {
  display: grid;
  grid-template-columns: minmax(110px, .45fr) minmax(0, 1.6fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid #edf0ec;
}
.batch-list-row.history-row {
  grid-template-columns: minmax(110px, .45fr) minmax(0, 1.5fr) auto auto;
}
.batch-list-row:last-child { border-bottom: 0; }
.batch-list-row .code { overflow: hidden; text-overflow: ellipsis; }
.batch-list-row p { margin: 0; color: #626b66; font-size: 11px; line-height: 1.4; }
.batch-list-row time { color: #8a928e; font-size: 10px; white-space: nowrap; }
.batch-empty {
  display: grid;
  place-items: center;
  min-height: 205px;
  padding: 30px;
  color: #7c8580;
  font-size: 12px;
  text-align: center;
}
.allegro-source-section-row th {
  padding: 15px 18px;
  text-transform: none;
  letter-spacing: 0;
  border-top: 14px solid #fff;
}
.allegro-source-section-row th span,
.allegro-source-section-row th strong { display: block; }
.allegro-source-section-row th span {
  margin-bottom: 3px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .11em;
}
.allegro-source-section-row th strong { font-size: 16px; }
.allegro-source-section-row.delivery-source th {
  color: #33451d;
  background: #e4efbd;
  border-bottom: 1px solid #cedd98;
}
.allegro-source-section-row.inventory-source th {
  color: #173f68;
  background: #bddcff;
  border-bottom: 1px solid #9ec6eb;
}
.allegro-segment-row th {
  padding: 12px 18px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  background: #edf6fc;
  border-top: 7px solid #fff;
  border-bottom: 1px solid #c7deef;
}
.allegro-segment-row.inventory-source th {
  background: #e8f3ff;
  border-bottom-color: #bfd9f4;
}
.allegro-segment-row.inventory-source .allegro-segment-group {
  color: #173f68;
  background: #bddcff;
}
.carton-combined-segment th {
  background: #edf6fc;
  border-bottom-color: #c7deef;
}
.pending-products-table { min-width: 1240px; }
.pending-products-segment th {
  background: #fff6df;
  border-bottom-color: #efdca8;
}
.pending-products-segment .allegro-segment-group {
  color: #5b4110;
  background: #ffe29a;
}
.pending-quantity {
  color: #8a5b00;
  font-size: 13px;
}
.allegro-segment-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.allegro-segment-group {
  padding: 5px 8px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  background: var(--accent);
  border-radius: 6px;
}
.allegro-segment-heading strong { font-size: 13px; }
.allegro-segment-colour {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}
.allegro-segment-colour b {
  color: var(--ink);
  font-size: 10px;
}
.inventory-source-badge {
  margin-left: auto;
  padding: 5px 8px;
  color: #174b7d;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .06em;
  background: #fff;
  border: 1px solid #b7d5f2;
  border-radius: 6px;
}
.allegro-inventory-row td { background: #f6faff; }
.inventory-allegro-button {
  color: #fff;
  background: #2f70ad;
  border-color: #2f70ad;
}
.inventory-allegro-button:hover:not(:disabled) { background: #265f94; }

.hidden { display: none !important; }

.progress-card {
  display: grid;
  grid-template-columns: auto minmax(40px, 1fr) auto minmax(40px, 1fr) auto;
  align-items: center;
  margin-bottom: 22px;
  padding: 18px 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 3px 13px rgba(23, 32, 29, .025);
}

.stage { display: flex; align-items: center; gap: 11px; min-width: 135px; }
.stage-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #7d8581;
  font-size: 12px;
  font-weight: 800;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 50%;
}
.stage-number svg { width: 17px; }
.stage small, .stage strong { display: block; }
.stage small { margin-bottom: 3px; color: #999f9c; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.stage strong { font-size: 14px; }
.stage.complete .stage-number { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.stage.active .stage-number { color: #fff; background: var(--ink); border-color: var(--ink); }

.stage-line {
  height: 3px;
  margin: 0 16px;
  overflow: hidden;
  background: #eaede9;
  border-radius: 2px;
}
.stage-line span { display: block; width: 0; height: 100%; background: var(--accent-dark); transition: width .3s ease; }

.receiving-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, .8fr);
  gap: 22px;
  margin-bottom: 22px;
}

.scan-panel, .summary-panel, .detail-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.scan-panel, .summary-panel { padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.panel-heading.compact { margin-bottom: 24px; }

.mode-switch {
  display: flex;
  padding: 4px;
  background: var(--soft);
  border-radius: 11px;
}
.mode-switch button {
  padding: 7px 12px;
  color: #707874;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.mode-switch button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(23, 32, 29, .08); }

.scanner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  background: #fafbf9;
  border: 2px solid #dfe3de;
  border-radius: 15px;
  transition: .15s ease;
}
.scanner:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(23, 32, 29, .07); }
.scanner-icon { display: grid; place-items: center; width: 42px; height: 42px; color: #747d78; }
.scanner-icon svg { width: 23px; }
.scanner input { flex: 1; min-width: 0; height: 42px; font-size: 17px; font-weight: 650; background: transparent; border: 0; outline: 0; }
.scanner input::placeholder { color: #a3aaa6; font-weight: 450; }

.scan-feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin-top: 13px;
  padding: 11px 13px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.feedback-icon { display: grid; place-items: center; flex: 0 0 auto; }
.feedback-icon svg { width: 19px; }
.scan-feedback.neutral { color: #727b76; background: var(--soft); }
.scan-feedback.success { color: var(--success); background: var(--success-soft); border-color: #cce9d8; }
.scan-feedback.warning { color: var(--warning); background: var(--warning-soft); border-color: #f0dfb7; }
.scan-feedback.error { color: var(--error); background: var(--error-soft); border-color: #f1cbc6; }

.keyboard-hint {
  margin-top: 12px;
  color: #939a96;
  font-size: 10px;
  text-align: center;
}
.keyboard-hint kbd {
  padding: 2px 5px;
  color: #6f7773;
  background: #f2f4f1;
  border: 1px solid #dfe3de;
  border-radius: 4px;
  box-shadow: 0 1px 0 #ccd1cd;
}
.keyboard-hint span { padding: 0 5px; }

.status-badge {
  padding: 6px 9px;
  color: #68716c;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--soft);
  border-radius: 7px;
}
.status-badge.in_progress { color: var(--warning); background: var(--warning-soft); }
.status-badge.complete { color: var(--success); background: var(--success-soft); }
.status-badge.discrepancy { color: var(--error); background: var(--error-soft); }

.metric + .metric { margin-top: 19px; }
.metric-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.metric-label span { color: var(--muted); }
.bar { height: 7px; overflow: hidden; background: #ecefeb; border-radius: 5px; }
.bar span { display: block; width: 0; height: 100%; background: var(--accent-dark); border-radius: 5px; transition: width .35s ease; }

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.summary-stats div { min-width: 0; }
.summary-stats span, .summary-stats small { display: block; }
.summary-stats span { margin-bottom: 4px; font-size: 19px; font-weight: 750; }
.summary-stats small { color: #69716d; font-size: 10px; line-height: 1.3; }

.detail-card { overflow: hidden; box-shadow: 0 6px 20px rgba(23, 32, 29, .045); }
.detail-tabs { display: flex; gap: 5px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.detail-tabs button {
  position: relative;
  padding: 18px 11px 15px;
  color: #777f7b;
  font-size: 12px;
  font-weight: 750;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.detail-tabs button::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  content: "";
  background: transparent;
}
.detail-tabs button.active { color: var(--ink); }
.detail-tabs button.active::after { background: var(--ink); }
.detail-tabs span { padding: 2px 6px; margin-left: 4px; font-size: 9px; background: var(--soft); border-radius: 9px; }

.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px;
  background: #fafbf9;
  border-bottom: 1px solid var(--line);
}
.search { position: relative; display: flex; align-items: center; width: min(360px, 55%); }
.search svg { position: absolute; left: 11px; width: 17px; color: #8b938f; }
.search input { width: 100%; height: 36px; padding: 0 12px 0 37px; background: #fff; border: 1px solid var(--line); border-radius: 9px; outline: 0; }
.search input:focus { border-color: #aeb5b1; }

.problem-filter { display: flex; align-items: center; gap: 8px; color: #707874; font-size: 11px; cursor: pointer; }
.problem-filter input { position: absolute; opacity: 0; pointer-events: none; }
.problem-filter span { position: relative; width: 29px; height: 17px; background: #d7dbd7; border-radius: 20px; transition: .15s; }
.problem-filter span::after { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; content: ""; background: #fff; border-radius: 50%; transition: .15s; }
.problem-filter input:checked + span { background: var(--ink); }
.problem-filter input:checked + span::after { transform: translateX(12px); }

.table-wrap { min-height: 220px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 18px; text-align: left; border-bottom: 1px solid #edf0ec; }
th { color: #69716d; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; background: #fff; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfa; }
.cell-title { display: block; font-weight: 750; }
.cell-subtitle { display: block; margin-top: 3px; color: #89908c; font-size: 10px; }
.code { color: #626b66; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.quantity { font-variant-numeric: tabular-nums; font-weight: 750; }
.table-link {
  padding: 0;
  color: var(--ink);
  font-weight: 800;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.table-link:hover { text-decoration: underline; }
.difference.negative { color: var(--warning); }
.difference.positive { color: var(--error); }
.row-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 7px;
}
.row-status::before { width: 6px; height: 6px; content: ""; background: currentColor; border-radius: 50%; }
.row-status.matched, .row-status.received { color: var(--success); background: var(--success-soft); }
.row-status.missing { color: var(--warning); background: var(--warning-soft); }
.row-status.over, .row-status.unknown { color: var(--error); background: var(--error-soft); }
.row-status.ambiguous { color: var(--error); background: var(--error-soft); }
.row-status.duplicate { color: #6c7470; background: var(--soft); }
.empty-table { display: grid; place-items: center; min-height: 210px; color: #858d89; font-size: 12px; }

.empty-state {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 105px);
  padding: 40px 20px 90px;
  text-align: center;
}
.empty-illustration { width: 130px; height: 110px; margin-bottom: 22px; color: #a7ada9; }
.empty-illustration svg { width: 100%; stroke-width: 1.3; }
.empty-illustration .accent-stroke { color: var(--accent-dark); }
.empty-state h2 { margin-bottom: 10px; font-size: 26px; }
.empty-state p { max-width: 480px; margin-bottom: 24px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.empty-actions { display: flex; gap: 10px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 15, 13, .64);
  backdrop-filter: blur(5px);
}
.modal {
  position: relative;
  width: min(540px, 100%);
  padding: 32px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .25);
}
.modal-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; color: #747c78; font-size: 23px; background: var(--soft); border-radius: 9px; }
.modal-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 18px; background: var(--accent); border-radius: 14px; }
.modal-icon svg { width: 25px; }
.modal h2 { margin-bottom: 9px; font-size: 23px; }
.modal > p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.gmail-steps { display: grid; gap: 12px; margin: 22px 0; }
.gmail-steps div { display: flex; align-items: flex-start; gap: 11px; }
.gmail-steps span { display: grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; font-size: 10px; font-weight: 800; background: var(--soft); border-radius: 50%; }
.gmail-steps p { margin: 3px 0 0; color: #535c57; font-size: 12px; line-height: 1.4; }
.gmail-source {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding: 13px 14px;
  color: var(--ink);
  background: #f3f8df;
  border: 1px solid #e0ebb6;
  border-radius: 11px;
}
.gmail-source strong { font-size: 12px; }
.gmail-source span { color: #5f685f; font-size: 11px; line-height: 1.4; }
.modal-note { padding: 11px 12px; color: #68716c; font-size: 10px; background: var(--soft); border-radius: 9px; }
.modal-note code { display: block; overflow: hidden; margin-top: 4px; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 23px; }
.integrations-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
.integration-stack {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.integration-stack .source-card { margin-top: 0; }
.integration-stack form { display: grid; gap: 10px; }
.integration-form-actions { justify-content: flex-end; }
.user-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr 150px auto;
  gap: 10px;
  align-items: end;
}
.user-list {
  display: grid;
  gap: 8px;
}
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.user-row.inactive {
  opacity: .68;
  background: #f6f7f8;
}
.user-main strong,
.user-main small { display: block; }
.user-main strong { font-size: 13px; }
.user-main small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.user-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}
.user-controls select {
  min-height: 34px;
  padding: 0 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.user-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 11px;
}
.gmail-integration-source {
  border-color: #dce7ba;
  background: #fbfdf4;
}
.gmail-integration-source .gmail-source { margin: 0; }
.public-ean-source {
  border-color: #d9e1dd;
  background: #f7faf8;
}
.product-catalog-source {
  border-color: #b8d7f0;
  background: #f4f9ff;
}
.source-card {
  display: grid;
  gap: 13px;
  margin-top: 17px;
  padding: 17px;
  background: #f8f9f7;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.source-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.source-card-heading strong,
.source-card-heading small { display: block; }
.source-card-heading small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.source-state { width: 10px; height: 10px; background: var(--success); border-radius: 50%; box-shadow: 0 0 0 4px var(--success-soft); }
.source-state.offline { background: var(--error); box-shadow: 0 0 0 4px var(--error-soft); }
.source-state.waiting { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); }
.form-field { display: grid; gap: 6px; }
.form-field span { color: #606864; font-size: 10px; font-weight: 750; }
.form-field input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.form-field select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.form-field select:focus { border-color: var(--ink); outline: 0; box-shadow: 0 0 0 3px rgba(23, 32, 29, .06); }
.ksef-source { margin-top: 14px; border-color: #c9d9e7; background: #f8fbfe; }
.source-description { margin: 0; color: #59645f; font-size: 11px; line-height: 1.55; }
.ksef-production-confirm {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  color: #7d382f;
  font-size: 10px;
  font-weight: 700;
  background: #fff2ef;
  border: 1px solid #efc8c1;
  border-radius: 9px;
}
.ksef-production-confirm input { margin-top: 1px; }
.ksef-production-guide {
  padding: 13px 14px;
  color: #33413b;
  font-size: 10px;
  line-height: 1.5;
  background: #edf5fb;
  border: 1px solid #c9d9e7;
  border-radius: 9px;
}
.ksef-production-guide strong { display: block; margin-bottom: 6px; font-size: 11px; }
.ksef-production-guide ol { margin: 0 0 11px 18px; padding: 0; }
.ksef-production-guide li + li { margin-top: 3px; }
.ksef-production-guide .button { display: inline-flex; }
.ksef-result {
  padding: 10px 12px;
  color: #54605b;
  font-size: 10px;
  line-height: 1.45;
  background: var(--soft);
  border-radius: 9px;
}
.ksef-result.success { color: #245f3e; background: #eaf6ee; }
.ksef-result.error { color: #8e2f29; background: #fbeae8; }
.source-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-field textarea {
  width: 100%;
  padding: 11px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.form-field textarea:focus {
  border-color: var(--ink);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(23, 32, 29, .06);
}
.historical-scans-modal { width: min(720px, calc(100vw - 32px)); }
.historical-scans-modal form { display: grid; gap: 16px; margin-top: 20px; }
.camera-modal { overflow: hidden; width: min(720px, calc(100vw - 32px)); }
.camera-modal-toolbar {
  display: flex;
  align-items: center;
  min-height: 34px;
  margin-bottom: 13px;
}
.camera-back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.camera-back-button span { font-size: 17px; line-height: 1; }
.camera-preview {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 20px;
  aspect-ratio: 4 / 3;
  background: #0b100e;
  border-radius: 15px;
}
.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-preview.error video { display: none; }
.camera-frame {
  position: absolute;
  inset: 18% 8%;
  border: 2px solid rgba(83, 165, 235, .9);
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(8, 13, 11, .22);
}
.camera-frame::before,
.camera-frame::after,
.camera-frame span::before,
.camera-frame span::after {
  position: absolute;
  width: 34px;
  height: 34px;
  content: "";
  border-color: var(--accent);
  border-style: solid;
}
.camera-frame::before { top: -3px; left: -3px; border-width: 4px 0 0 4px; border-radius: 12px 0 0; }
.camera-frame::after { top: -3px; right: -3px; border-width: 4px 4px 0 0; border-radius: 0 12px 0 0; }
.camera-frame span::before { bottom: -3px; left: -3px; border-width: 0 0 4px 4px; border-radius: 0 0 0 12px; }
.camera-frame span::after { right: -3px; bottom: -3px; border-width: 0 4px 4px 0; border-radius: 0 0 12px; }
.camera-feedback {
  display: grid;
  gap: 4px;
  margin-top: 13px;
  padding: 13px 14px;
  background: var(--soft);
  border-radius: 11px;
}
.camera-feedback strong { font-size: 13px; }
.camera-feedback small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.camera-feedback.success { background: var(--success-soft); }
.camera-feedback.warning { background: var(--warning-soft); }
.camera-feedback.error { color: #8e2f29; background: var(--error-soft); }
.camera-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.camera-carton-review {
  position: absolute;
  inset: 66px 20px 20px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .28);
}
.camera-review-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.camera-review-heading h3 {
  overflow-wrap: anywhere;
  margin-top: 5px;
  font-size: 17px;
}
.camera-review-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.camera-review-summary div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  background: var(--soft);
  border-radius: 9px;
}
.camera-review-summary small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}
.camera-review-summary strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.camera-review-message {
  margin-top: 12px;
  padding: 11px 12px;
  color: #5e6762;
  font-size: 11px;
  line-height: 1.45;
  background: var(--soft);
  border-radius: 9px;
}
.camera-review-message.warning { color: #765c22; background: var(--warning-soft); }
.camera-review-message.error { color: #8e2f29; background: var(--error-soft); }
.camera-review-table {
  flex: 1;
  min-height: 120px;
  margin-top: 12px;
  overflow-x: hidden;
}
.camera-review-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.camera-compact-products col:nth-child(1) { width: 27%; }
.camera-compact-products col:nth-child(2) { width: 22%; }
.camera-compact-products col:nth-child(3) { width: 21%; }
.camera-compact-products col:nth-child(4) { width: 17%; }
.camera-compact-products col:nth-child(5) { width: 13%; }
.camera-review-table th,
.camera-review-table td {
  overflow-wrap: anywhere;
  padding: 9px 7px;
  font-size: 10px;
}
.camera-review-table th {
  overflow-wrap: anywhere;
  white-space: normal;
}
.camera-review-table .quantity { text-align: center; }
.camera-review-actions {
  display: grid;
  grid-template-columns: minmax(120px, .55fr) minmax(180px, 1fr);
  gap: 9px;
  margin-top: 14px;
}
.camera-review-actions .button { width: 100%; }
.form-field input:focus { border-color: var(--ink); outline: 0; box-shadow: 0 0 0 3px rgba(23, 32, 29, .06); }
.form-help { color: var(--muted); font-size: 9px; }
.muted-source p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.authorization-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  background: var(--warning-soft);
  border: 1px solid #f0dfb7;
  border-radius: 10px;
}
.authorization-step p { margin: 0; color: #765c22; font-size: 10px; line-height: 1.4; }

.toast-container { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: grid; gap: 8px; pointer-events: none; }
.toast {
  width: min(370px, calc(100vw - 44px));
  padding: 13px 15px;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  background: var(--ink);
  border-radius: 11px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, .18);
  animation: toast-in .2s ease;
}
.toast.error { background: #8e2f29; }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 235px minmax(0, 1fr); }
  .receiving-grid { grid-template-columns: 1fr; }
  .progress-card { padding-inline: 18px; }
  .batch-intro { grid-template-columns: 1fr; }
  .invoice-summary-toggle {
    grid-template-columns: minmax(170px, 1fr) auto;
  }
  .invoice-card-facts { grid-column: 1; }
  .invoice-card-status { grid-column: 2; grid-row: 2; }
  .invoice-line { grid-template-columns: 1fr 1fr 1fr; }
  .invoice-item-name { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: min(300px, 86vw);
    transition: transform .22s ease;
    box-shadow: 20px 0 50px rgba(0, 0, 0, .22);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { min-height: 86px; padding: 17px; }
  .mobile-menu { display: grid; flex: 0 0 auto; width: 40px; height: 40px; margin-right: 11px; background: var(--soft); border-radius: 10px; }
  .mobile-menu svg { width: 20px; }
  .topbar .eyebrow { display: none; }
  .topbar-actions .button { width: 42px; padding: 0; font-size: 0; }
  .auth-user-pill { display: none; }
  #authLogoutButton { width: auto; padding: 0 10px; font-size: 11px; }
  .camera-scan-button { order: -1; }
  .workspace { padding: 17px 14px 35px; }
  .batch-workspace { padding: 17px 14px 35px; }
  .section-workspace { padding: 17px 14px 35px; }
  #invoiceWorkspace:not(.hidden) { grid-template-columns: 1fr; }
  .invoice-hero { grid-column: 1; grid-row: 1; }
  .invoice-metrics { grid-column: 1; grid-row: 2; }
  .invoice-list-card { grid-column: 1; grid-row: 3; }
  .supplier-control-card {
    position: static;
    grid-column: 1;
    grid-row: 4;
    max-height: none;
  }
  .section-hero { align-items: stretch; flex-direction: column; padding: 20px; }
  .invoice-hero-badge { min-width: 0; text-align: left; }
  .section-hero-actions .button { flex: 1; }
  .section-hero-actions { flex-direction: column; }
  .inventory-layout { grid-template-columns: 1fr; }
  .batch-intro { padding: 20px; }
  .batch-intro h2 { font-size: 21px; }
  .batch-actions { width: 100%; }
  .batch-actions .button { flex: 1; }
  .batch-context { align-items: flex-start; flex-direction: column; gap: 7px; }
  .batch-metrics { grid-template-columns: 1fr 1fr; }
  .invoice-metrics { grid-template-columns: 1fr 1fr; }
  .supplier-form { grid-template-columns: 1fr; }
  .supplier-form .button { width: 100%; }
  .invoice-filters { width: 100%; }
  .invoice-filters select,
  .invoice-filters input { width: 100%; min-width: 0; }
  .invoice-filters .action-button { width: 100%; }
  .user-create-form { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr; }
  .user-controls { justify-content: stretch; }
  .user-controls select,
  .user-controls .action-button { flex: 1; }
  .invoice-detail-header { flex-direction: column; }
  .invoice-detail-actions { justify-content: stretch; width: 100%; }
  .invoice-detail-actions .button { flex: 1; }
  .invoice-summary-toggle {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 15px 13px;
  }
  .invoice-card-main { min-width: 0; }
  .invoice-card-main strong,
  .invoice-card-main small { overflow-wrap: anywhere; }
  .invoice-card-progress strong { font-size: 21px; }
  .invoice-card-facts { grid-column: 1 / -1; }
  .invoice-card-status { grid-column: 1 / -1; grid-row: auto; justify-content: space-between; }
  .invoice-expanded-content { padding: 12px; }
  .invoice-line { grid-template-columns: 1fr 1fr; }
  .invoice-item-name { grid-column: 1 / -1; }
  .invoice-line-state { grid-column: 1 / -1; justify-items: stretch; }
  .invoice-line-state .action-button { width: 100%; }
  .product-scan-actions { align-items: stretch; flex-direction: column; width: 100%; }
  .product-scan-actions .button { width: 100%; }
  .product-bulk-entry .button { justify-self: stretch; width: 100%; }
  .carton-content-metrics { grid-template-columns: 1fr 1fr; }
  .content-confirm-card { align-items: stretch; flex-direction: column; }
  .carton-status-groups { grid-template-columns: 1fr; padding: 0 14px 14px; }
  .carton-status-toolbar { justify-items: stretch; width: 100%; }
  .carton-status-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .carton-status-filters .action-button { white-space: normal; }
  .carton-selection-actions { justify-content: stretch; }
  .carton-selection-actions > span { width: 100%; }
  .carton-selection-actions .action-button,
  .carton-selection-actions .button { flex: 1; }
  .carton-status-list { max-height: 220px; }
  .carton-status-item { grid-template-columns: 1fr; gap: 3px; }
  .carton-inline-status { float: none; display: inline-flex; margin-top: 7px; }
  .carton-group-copy { display: flex; align-items: flex-start; flex-direction: column; }
  .carton-group-row small { margin-left: 0; }
  .confirmation-actions { flex-direction: column; }
  .content-confirm-card .button { width: 100%; }
  .batch-section-heading { align-items: stretch; flex-direction: column; }
  .allegro-bulk-actions { justify-content: stretch; }
  .allegro-bulk-actions > span { width: 100%; }
  .allegro-bulk-actions .action-button { flex: 1; }
  .view-switch { width: 100%; }
  .view-switch .action-button { flex: 1; }
  .batch-bottom-grid { grid-template-columns: 1fr; }
  .batch-list-row { grid-template-columns: 1fr; gap: 5px; }
  .progress-card { grid-template-columns: 1fr; gap: 11px; }
  .stage { min-width: 0; }
  .stage-line { display: none; }
  .scan-panel, .summary-panel { padding: 18px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .mode-switch { width: 100%; }
  .mode-switch button { flex: 1; }
  .scanner { flex-wrap: wrap; }
  .scanner input { min-width: calc(100% - 62px); }
  .scanner .button { width: 100%; }
  .table-tools { align-items: flex-start; flex-direction: column; }
  .search { width: 100%; }
  th, td { padding: 12px; }
  .empty-actions { align-items: stretch; flex-direction: column; width: min(290px, 100%); }
  .modal { padding: 26px 21px; }
  .integrations-modal {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }
  .modal-actions { flex-direction: column-reverse; }
  #cameraModal { padding: 0; }
  .camera-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    padding: max(10px, env(safe-area-inset-top)) 14px max(10px, env(safe-area-inset-bottom));
    border-radius: 0;
    overscroll-behavior: contain;
  }
  .camera-modal-toolbar {
    position: sticky;
    top: 0;
    z-index: 8;
    flex: 0 0 auto;
    margin-bottom: 7px;
    padding: 2px 44px 7px 0;
    background: #fff;
  }
  .camera-back-button { min-height: 42px; padding-inline: 16px; }
  .camera-modal > p { padding-right: 38px; }
  .camera-modal > .eyebrow { display: none; }
  .camera-modal > h2 { margin-bottom: 4px; font-size: 20px; }
  .camera-modal > #cameraTargetCopy { font-size: 11px; line-height: 1.35; }
  .camera-preview {
    flex: 0 0 min(48dvh, 360px);
    min-height: 220px;
    margin-top: 9px;
    aspect-ratio: auto;
  }
  .camera-frame { inset: 24% 6%; }
  .camera-feedback { margin-top: 8px; padding: 10px 12px; }
  .camera-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 8px;
  }
  .camera-actions .button { width: 100%; }
  .camera-actions .button:only-child { grid-column: 1 / -1; }
  .camera-carton-review {
    position: fixed;
    inset: 0;
    padding: max(70px, calc(env(safe-area-inset-top) + 62px)) 15px max(15px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
  }
  .camera-review-heading { padding-right: 35px; }
  .camera-review-summary { grid-template-columns: 1fr 1fr; }
  .camera-review-table { min-height: 0; }
  .camera-review-table th,
  .camera-review-table td {
    padding: 8px 4px;
    font-size: 8px;
    line-height: 1.25;
  }
  .camera-review-actions { grid-template-columns: 1fr; }
  .wake-lock-button { width: 42px !important; }
  .wake-lock-button #wakeLockLabel { display: none; }
  .authorization-step { align-items: stretch; flex-direction: column; }
}
