:root {
  --bg: #ffffff;
  --bg-2: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --surface-3: #eef0eb;
  --line: rgba(40, 54, 23, 0.1);
  --line-strong: rgba(40, 54, 23, 0.18);
  --text: #283617;
  --muted: #5a614d;
  --muted-2: #7a806f;
  --brand: #89b46a;
  --brand-2: #638b46;
  --brand-glow: rgba(137, 180, 106, 0.28);
  --accent: #e67e22;
  --topbar: #e7e7e8;
  --login-bg: #211a15;
  --login-accent: #ffde14;
  --danger: #dc3545;
  --danger-bg: rgba(220, 53, 69, 0.1);
  --ok: #28a745;
  --ok-bg: rgba(40, 167, 69, 0.12);
  --warn: #e67e22;
  --warn-bg: rgba(230, 126, 34, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow: 0 2px 12px rgba(40, 54, 23, 0.08);
  --shadow-lg: 0 8px 32px rgba(40, 54, 23, 0.14);
  --font: "ff-cocon-pro", system-ui, -apple-system, sans-serif;
  --font-heading: cubano, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
}

h1, h2, h3, .login-title, .panel-head h2 {
  font-family: var(--font-heading);
  font-weight: 400;
}

/* ── Login gate ── */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--login-bg);
}

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

.login-card {
  width: min(400px, 100%);
  padding: 28px 28px 24px;
  background: #fff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-title {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.login-hint {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-submit { width: 100%; justify-content: center; }

.login-error {
  margin: 0;
  padding: 10px 12px;
  background: var(--danger-bg);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}

.login-error.hidden { display: none; }

body.app-locked {
  overflow: hidden;
}

body.app-locked .layout {
  pointer-events: none;
  user-select: none;
}

.overview-only .layout,
.dashboard-mode .layout,
.layout--full {
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.view-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.view-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.view-tab:hover { color: var(--text); }

.view-tab.active {
  background: var(--surface);
  color: var(--brand-2);
  box-shadow: 0 1px 3px rgba(40, 54, 23, 0.1);
}

.overview-only .content,
.dashboard-mode .content {
  padding: 20px 24px 28px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-mode .panel:not(.active) {
  display: none !important;
}

.content-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.app-brand:hover .brand-name {
  color: var(--brand-2);
}

.content-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.content-bar .status-btn {
  width: auto;
}

.overview-only .panel:not([data-panel="overview"]) {
  display: none !important;
}

.overview-only .results,
.dashboard-mode .results {
  display: none !important;
}

.overview-intro {
  margin-top: 0;
  margin-bottom: 18px;
}

/* ── Sidebar ── */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-foot {
  flex-shrink: 0;
  padding: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  font-family: var(--font-heading);
}

.brand-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
  width: auto;
  height: auto;
}

.logo--vvo {
  background: var(--brand);
  padding: 8px 14px 8px 10px;
  border-radius: 4px;
  line-height: 0;
}

.logo--vvo img {
  display: block;
  height: 38px;
  width: auto;
  max-width: 120px;
}

.login-brand .logo--vvo {
  padding: 6px 12px 6px 8px;
}

.login-brand .logo--vvo img {
  height: 32px;
  max-width: 100px;
}

.sidebar-nav {
  display: none;
}

/* ── Status indicator ── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: background 0.2s, box-shadow 0.2s;
}

.status.ok .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status.ok { color: var(--ok); border-color: rgba(40, 167, 69, 0.35); }
.status.err .dot { background: var(--danger); box-shadow: 0 0 8px rgba(220, 53, 69, 0.35); }
.status.err { color: var(--danger); border-color: rgba(220, 53, 69, 0.35); }

.status-btn {
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.status-btn:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.status-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn-block { width: 100%; justify-content: center; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  min-height: 100vh;
}

/* ── Sidebar tabs ── */
.tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.15s ease;
}

.tab svg { flex-shrink: 0; opacity: 0.7; }

.tab:hover {
  background: var(--surface);
  color: var(--text);
}

.tab:hover svg { opacity: 1; }

.tab.active {
  background: linear-gradient(135deg, rgba(137, 180, 106, 0.15), rgba(99, 139, 70, 0.08));
  color: var(--brand);
  border: 1px solid rgba(137, 180, 106, 0.25);
}

.tab.active svg { opacity: 1; color: var(--brand); }

/* ── Content ── */
.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
  padding: 20px 24px 28px;
  align-items: start;
}

.main-col { min-width: 0; }

@media (max-width: 1100px) {
  .content { grid-template-columns: 1fr; }
  .results { position: static; }
}

.content.content--overview {
  grid-template-columns: 1fr;
}

.content.content--overview .results {
  display: none;
}

.content.content--overview .panel-card {
  max-width: none;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-card { padding: 24px; }

/* ── Panels ── */
.panel { display: none; animation: fadeIn 0.25s ease; }
.panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.panel-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.endpoint {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--brand);
}

.hint {
  color: var(--muted);
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Form elements ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.grow { flex: 1; min-width: 180px; }

.field > span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-2);
}

input, select, textarea {
  background: var(--bg-2);
  border: 1px solid #ced4da;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 2rem;
  font-size: 13px;
  font-family: inherit;
  font-weight: 300;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder, textarea::placeholder { color: var(--muted-2); }

input:focus, select:focus, textarea:focus {
  border-color: #c4dab5;
  box-shadow: 0 0 0 0.25rem rgba(137, 180, 106, 0.25);
}

select {
  cursor: pointer;
  min-width: 160px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23283617' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.actions { margin-top: 8px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 2rem;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn-sm { padding: 7px 12px; font-size: 12px; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--brand-2);
  border-color: var(--brand-2);
  filter: none;
}

.login-submit.btn-primary {
  background: var(--login-bg);
  border-color: var(--login-bg);
  color: var(--login-accent);
}

.login-submit.btn-primary:hover {
  background: #2d241c;
  border-color: #2d241c;
}

.btn-danger {
  background: linear-gradient(135deg, #fca5a5, var(--danger));
  border-color: transparent;
  color: #450a0a;
}

.btn-danger:hover { filter: brightness(1.05); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}

.btn-ghost:hover { background: var(--surface-2); }

/* ── Code editor ── */
.editor-wrap {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

textarea.code {
  width: 100%;
  min-height: 320px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  border: none;
  border-radius: 0;
  background: #0d1117;
  tab-size: 2;
}

textarea.code:focus { box-shadow: none; }

/* ── Results panel ── */
.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 95px;
}

.result-card, .pdf-card { padding: 0; overflow: hidden; }

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.result-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.result-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.reqline {
  font-size: 11px;
  color: var(--muted-2);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── Pills ── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
}

.pill-idle { background: var(--surface-3); color: var(--muted); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-err { background: var(--danger-bg); color: var(--danger); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }

/* ── Response box ── */
.response {
  margin: 0;
  padding: 16px 18px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  background: #0d1117;
  color: #e6edf3;
}

.response .placeholder { color: var(--muted-2); font-style: italic; }

/* JSON syntax highlighting */
.json-key { color: #79c0ff; }
.json-str { color: #a5d6ff; }
.json-num { color: #ffa657; }
.json-bool { color: #ff7b72; }
.json-null { color: #8b949e; }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

/* ── PDF A6 ── */
.pdf-card.hidden { display: none; }

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  background: var(--brand-glow);
  color: var(--brand);
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.a6-stage {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}

.a6-frame {
  width: 105mm;
  height: 148mm;
  max-width: calc(100% - 40px);
  aspect-ratio: 105 / 148;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.a6-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* ── Order cards ── */
.order-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(137, 180, 106, 0.03);
  max-height: 280px;
  overflow-y: auto;
}

.order-cards.hidden { display: none; }

.order-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: grid;
  gap: 8px;
}

.order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.order-card-head strong {
  font-size: 14px;
  font-weight: 700;
}

.order-card-head .ref {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.order-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.err { background: var(--danger-bg); color: var(--danger); }
.chip.info { background: rgba(137, 180, 106, 0.12); color: var(--brand); }

.order-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.order-card-actions .btn { padding: 6px 10px; font-size: 11px; }

.order-card-addr {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Bezorgoverzicht ── */
.delivery-overview {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.overview-empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 20px;
  margin: 0;
}

.overview-loading { color: var(--brand); }

.delivery-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.delivery-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(137, 180, 106, 0.06);
  border-bottom: 1px solid var(--line);
}

.delivery-group-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tag-warning {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(230, 126, 34, 0.35);
}

.tag-packed {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid rgba(40, 167, 69, 0.3);
  vertical-align: middle;
}

.detail-row dd .tag-warning {
  margin-left: 8px;
  vertical-align: middle;
}

.delivery-group-head h3 {
  margin: 0;
  font-size: 15px;
  font-family: var(--font-heading);
  font-weight: 400;
}

.delivery-table-wrap { overflow-x: auto; }

.delivery-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.delivery-table th:nth-child(1),
.delivery-table .cell-customer {
  width: 55%;
}

.delivery-table th:nth-child(2),
.delivery-table .cell-order {
  width: 18%;
  white-space: nowrap;
}

.delivery-table th:nth-child(3),
.delivery-table .cell-action {
  width: 27%;
}

.delivery-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-2);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.delivery-table td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.delivery-table tbody tr:last-child td { border-bottom: 0; }

.delivery-table tbody tr:hover { background: rgba(137, 180, 106, 0.06); }

.paklijst-table tbody tr.paklijst-row {
  cursor: pointer;
}

.paklijst-table tbody tr.paklijst-row:hover {
  background: rgba(137, 180, 106, 0.08);
}

.paklijst-table {
  font-size: 13px;
}

/* Overschrijf bezorg-tabel kolombreedtes (55% op kolom 1) */
.paklijst-table th:nth-child(1),
.paklijst-table td:nth-child(1) { width: 5rem; }

.paklijst-table th:nth-child(2),
.paklijst-table td:nth-child(2) { width: 6.5rem; }

.paklijst-table th:nth-child(3),
.paklijst-table .cell-customer { width: auto; }

.paklijst-table th:nth-child(4),
.paklijst-table td:nth-child(4) { width: 7rem; }

.paklijst-table th {
  padding: 8px 12px;
  font-size: 10px;
  line-height: 1.2;
}

.paklijst-table td {
  padding: 8px 12px;
  line-height: 1.3;
  vertical-align: middle;
}

.paklijst-table .cell-customer {
  font-size: 13px;
  padding-right: 16px;
  line-height: 1.3;
  font-weight: 500;
}

.paklijst-table .cell-order {
  font-size: 13px;
  padding-right: 10px;
  line-height: 1.3;
}

.paklijst-table .cell-hint {
  font-size: 11px;
  line-height: 1.25;
}

.paklijst-table .pack-state {
  padding: 3px 8px;
  font-size: 10px;
  line-height: 1.2;
}

.paklijst-table .tag-packed {
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 9px;
}

.paklijst-table .cell-bin {
  font-size: 13px;
  line-height: 1.3;
}

.delivery-table .row-cancelled { opacity: 0.55; }

.cell-customer {
  font-weight: 600;
  color: var(--text);
  padding-right: 24px;
}

.cell-order {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  padding-right: 16px;
}

.cell-action { text-align: right; white-space: nowrap; }

.cell-action .btn + .btn { margin-left: 6px; }

/* ── Detail modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.hidden {
  display: none;
  pointer-events: none;
}

body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(90vh, 880px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-title-wrap { min-width: 0; }

.modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-sub {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex-shrink: 0;
}

.modal-foot--pack {
  justify-content: space-between;
  flex-wrap: wrap;
}

.modal-foot-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-dialog--detail {
  width: min(1080px, 96vw);
  max-height: min(94vh, 920px);
}

.modal-body--detail {
  overflow: hidden;
  min-height: 0;
}

.detail-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 16px;
  min-height: min(480px, 58vh);
  overflow: hidden;
}

.detail-layout-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.detail-layout-side {
  flex: 0 0 360px;
  width: 360px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.detail-layout-side h4 {
  flex-shrink: 0;
}

.detail-layout-side .package-list {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

@media (max-width: 800px) {
  .detail-layout {
    flex-direction: column;
    min-height: 0;
  }

  .detail-layout-side {
    flex: none;
    width: 100%;
    max-height: 360px;
  }
}

.detail-card {
  margin-bottom: 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.detail-card h4 { margin-bottom: 10px; }

.detail-section {
  margin-bottom: 20px;
}

.detail-section:last-of-type { margin-bottom: 0; }

.detail-section h4 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-grid {
  margin: 0;
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: start;
}

.detail-row dt {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-2);
}

.detail-row dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;
}

.detail-row dd.mono { font-family: var(--mono); font-size: 12px; }

.detail-row dd a { color: var(--brand); }

.track-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(137, 180, 106, 0.14), rgba(99, 139, 70, 0.08));
  border: 1px solid rgba(137, 180, 106, 0.35);
  border-radius: var(--radius-sm);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.track-btn:hover {
  background: linear-gradient(135deg, rgba(137, 180, 106, 0.22), rgba(99, 139, 70, 0.12));
  border-color: rgba(137, 180, 106, 0.55);
  box-shadow: 0 4px 20px var(--brand-glow);
  transform: translateY(-1px);
}

.track-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: rgba(137, 180, 106, 0.12);
  border-radius: 10px;
}

.track-btn-text {
  flex: 1;
  text-align: left;
}

.track-btn-arrow {
  display: flex;
  opacity: 0.7;
  transition: opacity 0.15s, transform 0.15s;
}

.track-btn:hover .track-btn-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

.detail-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.package-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.package-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.package-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.package-head strong { font-size: 14px; }

.package-contents {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.package-contents .content-tags { gap: 8px; }

.package-card .detail-grid { gap: 8px; }

.package-card .detail-row { grid-template-columns: 110px 1fr; }

.detail-row--tags dd { white-space: normal; }

.content-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.content-tag {
  display: inline-block;
  padding: 5px 10px;
  background: rgba(137, 180, 106, 0.08);
  border: 1px solid rgba(137, 180, 106, 0.2);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
}

[hidden] { display: none !important; }

.delivery-group-title h3 {
  margin: 0;
}

.delivery-group-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.cell-delivery {
  font-size: 12px;
  white-space: nowrap;
}

.cell-delivery .tag-warning {
  margin-right: 4px;
  vertical-align: middle;
  font-size: 9px;
  padding: 2px 6px;
}

.delivery-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cell-bin {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--brand);
  white-space: nowrap;
}

.cell-weight {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.cell-hint {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.85;
}

.pack-state {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pack-state--linked { background: rgba(148, 163, 184, 0.15); color: var(--muted); }
.pack-state--packing { background: var(--warn-bg); color: var(--warn); }
.pack-state--packed { background: var(--ok-bg); color: var(--ok); }

.actions--paklijst {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.actions--paklijst #pl_showPacked {
  margin-left: auto;
}

.btn-filter-on {
  background: var(--warn-bg);
  border-color: rgba(230, 126, 34, 0.35);
  color: var(--warn);
}

.btn-filter-on:hover {
  background: rgba(230, 126, 34, 0.18);
  border-color: rgba(230, 126, 34, 0.45);
  filter: none;
}

.overview-empty--inline {
  margin: 0;
  padding: 12px 16px 16px;
}

.paklijst-row--packed {
  opacity: 0.72;
}

.scan-state {
  display: inline-flex;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.scan-state--done {
  color: var(--ok);
}

.cell-scan {
  white-space: nowrap;
}

.pack-scan-summary {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.pack-line--done {
  opacity: 0.85;
}

.modal-dialog--wide { width: min(720px, 100%); }
.modal-dialog--sm { width: min(400px, 100%); }
.modal-dialog--print {
  width: min(960px, 100%);
  max-height: min(94vh, 1000px);
}

.modal-dialog--pack {
  width: min(1080px, 96vw);
  max-height: min(96vh, 980px);
}

.modal-head--pack {
  align-items: center;
}

.pack-modal-bin {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 5.5rem;
  padding: 10px 18px;
  margin-right: auto;
  margin-left: 20px;
  background: linear-gradient(135deg, rgba(137, 180, 106, 0.18), rgba(99, 139, 70, 0.1));
  border: 2px solid rgba(137, 180, 106, 0.45);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(137, 180, 106, 0.12);
}

.pack-modal-bin__label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  line-height: 1;
}

.pack-modal-bin__value {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0.02em;
}

.modal-body--pack {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 16px;
  min-height: min(520px, 62vh);
  overflow: hidden;
}

.modal-body--pack > #packModalLines {
  flex: 1;
  min-width: 0;
  overflow: auto;
}

.sticker-preview-wrap {
  flex: 0 0 300px;
  width: 300px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.sticker-preview-wrap.loading {
  opacity: 0.7;
}

.sticker-preview-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.sticker-preview-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.sticker-preview-error {
  margin: 0;
  font-size: 13px;
  color: var(--danger, #f87171);
}

.modal-body--print {
  padding: 16px 20px 20px;
  background: var(--bg);
}

.paklijst-preview-wrap {
  background: #fff;
  color: #111;
  padding: 28px 32px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.paklijst-preview-wrap .paklijst-a4 h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #111;
}

.paklijst-preview-wrap .paklijst-a4 > p {
  margin: 0 0 6px;
  font-size: 14px;
  color: #444;
}

.paklijst-preview-wrap .paklijst-a4 h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #ddd;
  color: #111;
}

.paklijst-preview-wrap .pick-list-table,
.paklijst-preview-wrap .paklijst-a4 table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 13px;
}

.paklijst-preview-wrap .pick-list-table th,
.paklijst-preview-wrap .pick-list-table td,
.paklijst-preview-wrap .paklijst-a4 th,
.paklijst-preview-wrap .paklijst-a4 td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.paklijst-preview-wrap .pick-list-table th,
.paklijst-preview-wrap .paklijst-a4 th {
  background: #f3f3f3;
  font-weight: 600;
}

.paklijst-preview-wrap .pick-loc {
  font-weight: 700;
  font-size: 14px;
  vertical-align: middle;
}

.paklijst-preview-wrap .pick-product {
  vertical-align: middle;
}

.paklijst-preview-wrap .pick-plu {
  font-size: 11px;
  color: #666;
}

.paklijst-preview-wrap .pick-qty {
  text-align: center;
  font-weight: 600;
}

.paklijst-preview-wrap .pick-bin {
  font-weight: 700;
  text-align: center;
}

.paklijst-preview-wrap .pick-order {
  text-align: right;
  color: #555;
  font-size: 12px;
}

.paklijst-ronde {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px dashed var(--line);
}

.paklijst-ronde:first-of-type {
  margin-top: 16px;
  padding-top: 0;
  border-top: 0;
}

.paklijst-preview-wrap .paklijst-ronde h2 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  border-bottom: 0;
  padding-bottom: 0;
}

.paklijst-preview-wrap .paklijst-ronde > p {
  margin: 0 0 10px;
  font-size: 13px;
  color: #666;
}

.paklijst-preview-wrap .paklijst-ronde .pick-list-table {
  margin-top: 8px;
}

.pack-lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pack-lines-table th,
.pack-lines-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.pack-lines-table tr.line-packed td { opacity: 0.65; }

.print-sheet {
  display: none;
}

@media print {
  body.print-paklijst * { visibility: hidden; }
  body.print-paklijst #printSheet,
  body.print-paklijst #printSheet * { visibility: visible; }
  body.print-paklijst #printSheet {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  .paklijst-a4 {
    font-family: Arial, sans-serif;
    font-size: 11pt;
    color: #000;
  }

  .paklijst-a4 h1 { font-size: 16pt; margin: 0 0 8px; }
  .paklijst-a4 h2 { font-size: 12pt; margin: 16px 0 6px; border-bottom: 1px solid #ccc; padding-bottom: 4px; }
  .paklijst-ronde {
    page-break-before: always;
    break-before: page;
  }
  .paklijst-ronde:first-of-type {
    page-break-before: auto;
    break-before: auto;
  }
  .paklijst-ronde > p {
    margin: 0 0 8px;
    font-size: 9pt;
    color: #333;
  }
  .pick-list-table,
  .paklijst-a4 table { width: 100%; border-collapse: collapse; margin-top: 12px; }
  .pick-list-table th, .pick-list-table td,
  .paklijst-a4 th, .paklijst-a4 td { border: 1px solid #ccc; padding: 4px 6px; font-size: 9pt; vertical-align: top; }
  .pick-list-table th, .paklijst-a4 th { background: #f0f0f0; }
  .pick-loc { font-weight: 700; }
  .pick-bin { font-weight: 700; text-align: center; }
  .pick-qty { text-align: center; font-weight: 600; }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .content-bar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .content-bar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .content { padding: 16px; }
  .modal { padding: 12px; }
  .modal-dialog { max-height: 94vh; }

  .modal-body--pack {
    flex-direction: column;
  }

  .sticker-preview-wrap {
    flex: none;
    width: 100%;
    min-height: 360px;
  }

  .sticker-preview-frame {
    min-height: 340px;
  }
}

/* ── Voorraad ── */
.voorraad-table-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 12px;
  min-height: 36px;
}

.voorraad-wrap {
  margin-top: 8px;
  overflow-x: auto;
}

.voorraad-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.voorraad-table th,
.voorraad-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.voorraad-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}

.voorraad-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

.voorraad-row--warn td {
  background: rgba(220, 53, 69, 0.06);
}

.voorraad-row--readonly td {
  opacity: 0.85;
}

.voorraad-row--saved td {
  background: rgba(40, 167, 69, 0.12);
  transition: background 0.3s ease;
}

.voorraad-status {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.voorraad-status.hidden {
  display: none;
}

.voorraad-status--ok {
  background: rgba(40, 167, 69, 0.12);
  color: #1e7e34;
  border: 1px solid rgba(40, 167, 69, 0.25);
}

.voorraad-status--err {
  background: rgba(220, 53, 69, 0.08);
  color: #b02a37;
  border: 1px solid rgba(220, 53, 69, 0.2);
}

.voorraad-status--busy {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.voorraad-warn {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--danger, #dc3545);
  font-weight: 600;
}

.voorraad-mut-input {
  width: 64px;
  padding: 4px 6px;
  font-size: 13px;
  text-align: right;
}

.voorraad-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.voorraad-audit-details {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.voorraad-audit-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  background: rgba(137, 180, 106, 0.06);
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.voorraad-audit-summary::-webkit-details-marker {
  display: none;
}

.voorraad-audit-summary::before {
  content: '▸';
  margin-right: 10px;
  color: var(--brand);
  font-size: 12px;
  transition: transform 0.15s ease;
}

.voorraad-audit-details[open] .voorraad-audit-summary::before {
  transform: rotate(90deg);
}

.voorraad-audit-summary-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.voorraad-audit-summary-hint {
  font-size: 12px;
  color: var(--muted);
}

.voorraad-audit {
  padding: 0;
}

.voorraad-audit .overview-empty {
  padding: 16px;
}

.voorraad-audit-wrap {
  overflow-x: auto;
}

.voorraad-audit-table {
  font-size: 13px;
  min-width: 640px;
}

.voorraad-audit-table th.cell-action,
.voorraad-audit-table td.cell-action {
  width: 7.5rem;
  text-align: right;
  white-space: nowrap;
}

.voorraad-audit-table th:nth-child(1),
.voorraad-audit-table td.cell-time {
  width: 7.5rem;
  white-space: nowrap;
}

.voorraad-audit-table th:nth-child(3),
.voorraad-audit-table td.cell-delta {
  width: 4.5rem;
  text-align: right;
}

.voorraad-audit-table th:nth-child(4),
.voorraad-audit-table td.cell-web {
  width: 8rem;
}

.voorraad-audit-date {
  display: block;
  font-weight: 500;
  line-height: 1.3;
}

.voorraad-audit-time {
  display: block;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.voorraad-audit-product {
  display: block;
  font-weight: 500;
  line-height: 1.35;
}

.voorraad-audit-sku {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.voorraad-audit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.voorraad-audit-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}

.voorraad-audit-tag--rollback {
  background: rgba(137, 180, 106, 0.1);
  color: var(--brand);
  border-color: rgba(137, 180, 106, 0.25);
}

.voorraad-audit-tag--reverted {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.3);
}

.voorraad-audit-delta {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.voorraad-audit-delta--plus {
  color: #3dd68c;
}

.voorraad-audit-delta--minus {
  color: #f87171;
}

.voorraad-audit-arrow {
  display: inline-block;
  margin: 0 4px;
  color: var(--muted);
}

.voorraad-audit-muted {
  color: var(--muted-2);
  font-size: 12px;
}

.voorraad-audit-row--rollback td {
  background: rgba(137, 180, 106, 0.04);
}

.voorraad-audit-row--reverted td {
  opacity: 0.72;
}

.voorraad-audit-row--busy td {
  background: rgba(137, 180, 106, 0.08);
  opacity: 0.85;
}

.voorraad-audit-row--busy .btn {
  opacity: 0.6;
}

.voorraad-audit-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .voorraad-table .hide-sm,
  .voorraad-audit-table .hide-sm { display: none; }
}
