:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e4e6eb;
  --text: #14161a;
  --muted: #616a77;
  --accent: #ef1b1b;
  --accent-hover: #d81616;
  --danger: #b4232c;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e4e6eb;
    --text: #14161a;
    --muted: #616a77;
    --accent: #ef1b1b;
    --accent-hover: #d81616;
    --danger: #b4232c;
  }
}

* {
  box-sizing: border-box;
}

.req-star {
  color: var(--danger);
  font-weight: 700;
}

body {
  margin: 0;
  background: radial-gradient(1200px 700px at 15% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 45%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

body.role-worker .admin-only {
  display: none !important;
}

body.role-customer .admin-only,
body.role-customer .worker-tab-panel,
body.role-customer #pakbon-section,
body.role-customer #klanten-section {
  display: none !important;
}

body.role-customer main.layout > :not(.customer-only) {
  display: none !important;
}

body.role-customer .customer-only {
  display: block !important;
}

body.role-customer .layout {
  max-width: 920px;
  grid-template-columns: 1fr;
}

body.role-customer .header {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 95%, #fff), color-mix(in srgb, var(--bg) 85%, #fff));
}

body.role-customer #customer-portal-section {
  box-shadow: 0 10px 30px rgba(20, 22, 26, 0.06);
}

/* Medewerker: aparte pagina’s (tabs) + producten als kaarten */
.worker-nav {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.65rem clamp(1rem, 4vw, 2.5rem);
  margin: 0 auto;
  max-width: 1100px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.worker-nav__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.worker-print-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(15, 18, 24, 0.1);
}

.worker-print-status.is-paused {
  color: #b42318;
  font-weight: 600;
}

.worker-print-stop {
  background: #b42318;
  color: #fff;
  border-color: #b42318;
}

.worker-print-stop:hover {
  filter: brightness(1.05);
}

body.role-worker .worker-nav {
  display: flex;
}

.admin-nav {
  display: none;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.65rem clamp(1rem, 4vw, 2.5rem);
  margin: 0 auto;
  max-width: 1100px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}

body.role-admin .admin-nav {
  display: flex;
}

.admin-nav-context {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.35rem clamp(1rem, 4vw, 2.5rem) 0.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-nav__btn {
  min-height: 2.5rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.92rem;
  border-radius: 9px;
}

.admin-nav__btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

body.role-admin .admin-page {
  display: none;
}

body.role-admin .admin-page.is-active {
  display: block;
}

body.role-admin .layout {
  grid-template-columns: 1fr;
  max-width: 1280px;
}

body.role-admin [data-admin-page="labels-products"] {
  max-width: none;
}

.worker-nav__btn {
  min-height: 3rem;
  padding: 0.5rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  touch-action: manipulation;
}

.worker-nav__btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.auth-staff-reveal-wrap {
  margin: 0.35rem 0 0;
  text-align: center;
}

.auth-staff-reveal-btn {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  touch-action: manipulation;
}

.auth-staff-reveal-btn:hover {
  color: var(--text);
}

#auth-login-mode-label {
  margin: 0.2rem 0 0;
  font-weight: 600;
  color: var(--muted);
}

#cust-access-products {
  border: none;
  padding: 0;
  max-height: none;
  overflow: visible;
}

.cust-access-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

@media (max-width: 960px) {
  .cust-access-groups {
    grid-template-columns: 1fr;
  }
}

.cust-access-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem 0.65rem;
  background: color-mix(in srgb, var(--surface) 92%, white);
  display: flex;
  flex-direction: column;
  min-height: 8rem;
  max-height: 320px;
}

.cust-access-group__body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cust-access-group-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

body.role-admin .worker-tab-panel {
  display: none;
}

body.role-admin .worker-tab-panel.admin-page.is-active {
  display: block;
}

body.role-worker .worker-tab-panel {
  display: none;
}

body.role-worker .worker-tab-panel.is-active {
  display: block;
}

body.role-worker #admin-calendar-section .admin-cal-pakbon-panel {
  margin-top: 0;
}

body.role-worker .layout {
  max-width: 100%;
  grid-template-columns: 1fr;
  padding: 1rem clamp(0.75rem, 2vw, 1.5rem) 2.5rem;
}

body.role-worker .product-pager-controls {
  display: none !important;
}

body.role-worker #product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 0.85rem;
}

body.role-worker .product-row {
  flex-direction: column;
  align-items: stretch;
  min-height: 100%;
}

body.role-worker .product-row .product-main {
  flex: 0 0 auto;
}

body.role-worker .product-row .product-batch {
  width: 100%;
  margin-top: auto;
}

body.role-worker .product-row .print-row {
  width: 100%;
}

body.role-worker .product-row .row-actions {
  width: 100%;
}

body.role-worker .product-row .gen-batch {
  width: 100%;
  justify-content: center;
  min-height: 2.75rem;
  font-size: 0.95rem;
}

.header {
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(8px);
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.header-titles {
  flex: 1 1 16rem;
  min-width: 0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.role-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 12%, white);
  color: var(--accent);
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
}

.sub {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
}

.sub a {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.sub a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--border) 55%, transparent);
}

.layout {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem clamp(1rem, 4vw, 2.5rem) 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 10px 24px rgba(15, 18, 24, 0.06);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-head h2 {
  margin: 0;
}

.card-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.customer-orders-danger-wrap {
  font-size: 0.88rem;
}

.customer-orders-danger-summary {
  cursor: pointer;
  color: var(--muted);
  list-style: none;
  user-select: none;
}

.customer-orders-danger-summary::-webkit-details-marker {
  display: none;
}

.customer-orders-danger-wrap[open] .customer-orders-danger-summary {
  margin-bottom: 0.35rem;
  color: var(--text);
}

.customer-orders-danger-wrap .btn.danger {
  width: 100%;
  max-width: 16rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-weight: 600;
  font-size: 0.9rem;
}

.field input,
.field textarea {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 1rem;
}

.field textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  outline-offset: 0;
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  filter: none;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent);
}

.btn.primary:hover {
  background: var(--accent-hover);
}

.btn.ghost {
  background: #fff;
}

.btn.danger {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}

.btn.small {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.empty {
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

body.role-admin #product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
  gap: 1rem;
  align-items: stretch;
}

body.role-admin #product-list .product-row {
  flex-direction: column;
  align-items: stretch;
  min-height: 100%;
  height: 100%;
  background: color-mix(in srgb, var(--surface) 95%, var(--bg));
  box-shadow: 0 2px 10px rgba(15, 18, 24, 0.05);
}

body.role-admin #product-list .product-main {
  flex: 0 0 auto;
}

body.role-admin #product-list .product-batch {
  width: 100%;
  margin-top: auto;
}

body.role-admin #product-list .print-row {
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

body.role-admin #product-list .row-actions {
  width: 100%;
}

body.role-admin #product-list .gen-batch {
  flex: 1 1 auto;
}

@media (min-width: 1100px) {
  body.role-admin #product-list {
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  }
}

body.role-admin .worker-tab-panel .card[aria-labelledby="list-title"] {
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(15, 18, 24, 0.07);
}

.pakbon-test-datetime-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pakbon-test-datetime-row input[type="date"],
.pakbon-test-datetime-row input[type="time"] {
  flex: 1 1 8rem;
  min-height: 2.5rem;
}

#pakbon-test-schedule-status.is-ok {
  color: #1a6b2e;
}

#pakbon-test-schedule-status.is-warn {
  color: #9a6700;
}

#pakbon-test-schedule-status.is-error {
  color: #b42318;
}

body.role-customer .customer-portal-groups {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

body.role-customer .customer-portal-group {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem 1rem;
  background: color-mix(in srgb, var(--surface) 94%, var(--bg));
  box-shadow: 0 2px 10px rgba(15, 18, 24, 0.04);
}

body.role-customer .customer-portal-group__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text);
}

body.role-customer .customer-portal-subgroup__title {
  margin: 0.85rem 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}

body.role-customer .customer-portal-group > .customer-portal-subgroup__title:first-of-type {
  margin-top: 0.15rem;
}

body.role-customer .customer-portal-group-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 0.85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

body.role-customer .customer-portal-group-list .product-row {
  min-height: 100%;
}

body.role-customer .customer-portal-group-list .customer-qty {
  width: 100%;
  max-width: 10rem;
}

.product-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
  align-items: end;
  margin-bottom: 0.5rem;
}

body.role-admin .product-toolbar {
  position: sticky;
  top: 0.35rem;
  z-index: 3;
  padding: 0.55rem 0.55rem 0.2rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 95%, white);
  border: 1px solid var(--border);
}

.product-search-field {
  flex: 1 1 22rem;
}

.product-search-field .auth-input-kbd-row {
  width: 100%;
}

.product-pager-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.product-page-size-field {
  min-width: 9rem;
}

.product-pager {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.product-pager .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
  transform: none;
}

.product-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .product-row {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  body.role-admin #product-list .product-row {
    flex-direction: column;
    align-items: stretch;
  }
}

.product-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.p-name {
  font-size: 1rem;
}

.p-sku {
  font-size: 0.88rem;
  color: var(--muted);
}

.p-letter {
  font-size: 0.82rem;
  color: var(--muted);
}

.product-batch {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: flex-start;
}

.next-batch {
  font-size: 1rem;
  padding: 0.25rem 0.45rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.footer {
  padding: 1rem clamp(1rem, 4vw, 2.5rem) 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ——— Inlog / rollen ——— */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: color-mix(in srgb, var(--bg) 88%, #000);
}

.auth-overlay[hidden] {
  display: none !important;
}

.auth-card {
  width: min(100%, 26rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1rem;
  box-shadow: 0 14px 34px rgba(15, 18, 24, 0.14);
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 0.55rem;
}

.auth-logo {
  max-width: 240px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.auth-sub {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-panel .field {
  margin-bottom: 0.75rem;
}

.auth-hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.auth-or {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.auth-footnote {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.auth-input-kbd-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.auth-input-kbd-row input {
  flex: 1;
  min-width: 0;
}

.auth-kbd-open {
  flex: 0 0 auto;
  min-width: 2.75rem;
  min-height: 2.5rem;
  padding: 0.25rem 0.4rem;
  font-size: 1.1rem;
  line-height: 1;
  touch-action: manipulation;
}

/* Schermtoetsenbord inlog / eerste setup */
.auth-touch-kbd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10052;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.5rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0.5rem));
  background: color-mix(in srgb, #000 45%, transparent);
}

.auth-touch-kbd-backdrop[hidden] {
  display: none !important;
}

.auth-touch-kbd {
  width: min(36rem, 100%);
  max-height: min(88vh, 28rem);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem 0.75rem;
  border-radius: 14px 14px 0 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 -8px 32px color-mix(in srgb, #000 35%, transparent);
}

.auth-touch-kbd.is-caps .auth-touch-kbd__key[data-auth-kbd="caps"] {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.auth-touch-kbd__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.auth-touch-kbd__close {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 8px;
}

.auth-touch-kbd__grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.auth-touch-kbd__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
}

.auth-touch-kbd__key {
  min-width: 2.15rem;
  min-height: 2.65rem;
  padding: 0.2rem 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 70ms ease, filter 70ms ease, background-color 70ms ease;
}

.auth-touch-kbd__key--letter {
  text-transform: lowercase;
}

.auth-touch-kbd.is-caps .auth-touch-kbd__key--letter {
  text-transform: uppercase;
  font-size: 1.2rem;
}

.auth-touch-kbd__key:active {
  filter: brightness(0.9);
  transform: translateY(1px) scale(0.98);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.auth-touch-kbd__key--wide {
  flex: 1 1 8rem;
  min-width: 6rem;
}

.auth-touch-kbd__actions {
  display: flex;
  gap: 0.4rem;
}

.auth-touch-kbd__wide {
  flex: 1;
  min-height: 2.75rem;
  font-size: 0.95rem;
}

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

.print-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.qty-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.zebra-intro {
  margin: 0 0 1rem;
  max-width: 70ch;
}

.zebra-form {
  margin-top: 0.25rem;
}

.field.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.field.inline-check span {
  font-weight: 500;
  font-size: 0.9rem;
}

.field.inline-check input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.qty-touch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.qty-label .label-qty {
  width: 4.5rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
  color: var(--text);
  font-size: 0.95rem;
}

.qty-numpad-btn {
  min-height: 2.5rem;
  min-width: 2.75rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
}

/* Touch cijferpad (kiosk) */
.touch-numpad-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.5rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0.5rem));
  background: color-mix(in srgb, #000 45%, transparent);
}

.touch-numpad-backdrop[hidden] {
  display: none !important;
}

.touch-numpad {
  width: min(22rem, 100%);
  max-height: min(85vh, 32rem);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem 0.85rem;
  border-radius: 14px 14px 0 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 -8px 32px color-mix(in srgb, #000 35%, transparent);
}

.touch-numpad__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.touch-numpad__close {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  border-radius: 8px;
}

.touch-numpad__display {
  text-align: right;
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  border: 1px solid var(--border);
}

.touch-numpad__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.touch-numpad__grid button {
  min-height: 3.1rem;
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}

.touch-numpad__grid button:active {
  filter: brightness(0.95);
}

.touch-numpad__grid .touch-numpad__wide {
  grid-column: span 1;
}

.touch-numpad__actions {
  display: flex;
  gap: 0.45rem;
}

.touch-numpad__actions .touch-numpad__wide {
  flex: 1;
  min-height: 3rem;
  font-size: 1rem;
}

/* ——— Afdruk-overlay (102 × 102 mm per vel) ——— */
.print-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg) 92%, #000);
  color: #111;
}

.print-overlay[hidden] {
  display: none !important;
}

.print-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: #f0f0f0;
  border-bottom: 1px solid #ccc;
}

.print-bar button {
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #bbb;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.print-bar button.primary {
  background: #1a6edb;
  color: #fff;
  border-color: #1a6edb;
}

.print-bar .meta {
  margin-left: auto;
  font-size: 0.85rem;
  color: #333;
  max-width: min(50ch, 100%);
}

.print-sheets {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  background: #ddd;
}

#print-overlay .sheet {
  width: 102mm;
  height: 102mm;
  background: #fff;
  border: 1px solid #333;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: 2.5mm 3mm;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #111;
}

/* Interbun — boven producttitel (zelfde volgorde als ZPL-voorbeeld) */
.sheet-brandbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2.5mm;
  padding-bottom: 1.5mm;
  margin-bottom: 1mm;
  border-bottom: 1pt solid #c8c8c8;
  min-height: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.03) 100%);
}

.sheet-brandbar__img {
  display: block;
  max-height: 9mm;
  width: auto;
  object-fit: contain;
}

.sheet-brandbar__text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
  text-align: right;
}

.sheet-brandbar__name {
  font-weight: 800;
  font-size: 8pt;
  letter-spacing: 0.06em;
}

.sheet-brandbar__tag {
  font-size: 5.5pt;
  color: #444;
  max-width: 52mm;
}

#print-overlay .sheet-header {
  font-weight: 800;
  font-size: 19pt;
  line-height: 1.12;
  text-align: center;
  letter-spacing: 0.02em;
  border-bottom: 2.5pt solid #000;
  padding-bottom: 2mm;
  margin-bottom: 0;
}

#print-overlay .sheet-mid {
  display: grid;
  grid-template-columns: 1fr 45mm;
  gap: 2mm;
  margin-top: 1.5mm;
  min-height: 0;
  align-items: stretch;
}

#print-overlay .sheet-mid--no-weigh {
  grid-template-columns: 1fr;
}

#print-overlay .sheet-ingredients {
  border: 1.5pt solid #111;
  border-radius: 1mm;
  padding: 3mm 3.2mm;
  font-size: 12.5pt;
  line-height: 1.38;
  overflow: hidden;
  min-height: 0;
  background: linear-gradient(180deg, #fafafa 0%, #fff 35%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#print-overlay .sheet-mid:not(.sheet-mid--no-weigh) .sheet-ingredients {
  min-height: 65mm;
}

#print-overlay .sheet-mid--no-weigh .sheet-ingredients {
  min-height: 52mm;
}

#print-overlay .sheet-ingredients strong {
  font-size: 14.5pt;
  font-weight: 800;
  letter-spacing: 0.02em;
}

#print-overlay .sheet-ingredients .muted {
  color: #444;
}

/* Vak voor Digi-weegschaal: ca. 4,5 cm × 6,5 cm (zoals fysiek etiket) */
#print-overlay .sheet-scale-slot {
  width: 45mm;
  height: 65mm;
  min-width: 45mm;
  min-height: 65mm;
  max-height: 65mm;
  box-sizing: border-box;
  border: 1.2pt dashed #333;
  border-radius: 0.8mm;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 8.5pt;
  line-height: 1.28;
  color: #3a3a3a;
  padding: 1.5mm;
  flex-shrink: 0;
  background: #fafafa;
}

#print-overlay .sheet-footer {
  border-top: 2pt solid #000;
  margin-top: 1.5mm;
  padding-top: 2mm;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2mm;
  align-items: end;
}

#print-overlay .sheet-batchline {
  font-size: 12.5pt;
  font-weight: 600;
}

#print-overlay .sheet--plain .sheet-header {
  font-size: 21pt;
}

#print-overlay .sheet--plain .sheet-ingredients {
  font-size: 13.5pt;
}

#print-overlay .sheet--plain .sheet-ingredients strong {
  font-size: 15.5pt;
}

#print-overlay .sheet--plain .sheet-batchline {
  font-size: 13.5pt;
}

#print-overlay .sheet-brand {
  font-size: 7.5pt;
  font-weight: 700;
  text-align: right;
  color: #222;
  line-height: 1.2;
}

#print-overlay .sheet-brand__sub {
  display: block;
  font-weight: 500;
  font-size: 6pt;
  color: #444;
  margin-top: 0.5mm;
}

#print-overlay .barcode-wrap {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 3mm;
}

#print-overlay .barcode-wrap svg {
  max-width: 100%;
  height: auto;
}

#print-overlay .human-read {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10pt;
  margin-top: 0.5mm;
}

/* ——— Klanten & pakbon ——— */
.customer-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.customer-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}

#cust-login-list .customer-login-admin-row__meta {
  flex: 1 1 12rem;
  min-width: 0;
}

#cust-login-list .customer-login-admin-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.customer-cart-wrap {
  margin-top: 0.7rem;
}

.customer-history-card {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}

.customer-history-row td {
  vertical-align: top;
}

.customer-history-row .customer-history-toggle {
  margin-bottom: 0.2rem;
}

.customer-history-details td {
  background: color-mix(in srgb, var(--surface) 96%, var(--bg));
}

.customer-history-details__inner {
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 0.35rem 0.1rem;
}

.label-alias-wrap {
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 0.4rem;
}

.label-alias-field {
  margin: 0;
}

.label-alias-field span {
  font-size: 0.82rem;
  opacity: 0.88;
}

.label-alias-input {
  max-width: min(100%, 26rem);
}

.cust-access-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}

.cust-access-row .field.inline-check {
  margin: 0;
}

.cust-access-portal-field {
  margin: 0;
  width: 100%;
}

.cust-access-portal-field .cust-access-portal-label {
  font-size: 0.82rem;
  opacity: 0.88;
}

.cust-access-portal-field input {
  max-width: min(100%, 28rem);
}

.status-ok {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
  color: #1f9d55;
  font-weight: 600;
}

.pakbon-toolbar {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
}

.pakbon-field-grow {
  flex: 1 1 14rem;
}

.pakbon-select {
  width: 100%;
  max-width: 32rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 1rem;
}

.pakbon-hint {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.92rem;
  color: color-mix(in srgb, var(--accent) 82%, #5a1f1f);
  font-weight: 600;
}

.pakbon-manual {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface, #fff) 92%, #f5f5f5);
}

.pakbon-manual__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.pakbon-manual__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-end;
}

.pakbon-manual__product {
  flex: 1 1 14rem;
  min-width: 12rem;
}

.pakbon-manual__qty {
  flex: 0 1 10rem;
  min-width: 8rem;
}

.pakbon-scan-input {
  width: 100%;
  max-width: 100%;
  font-size: 1.15rem;
  padding: 0.65rem 0.75rem;
  letter-spacing: 0.02em;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
  color: var(--text);
}

.pakbon-table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pakbon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.pakbon-table th,
.pakbon-table td {
  padding: 0.45rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.pakbon-table th {
  background: color-mix(in srgb, var(--border) 35%, transparent);
  font-weight: 600;
}

.pakbon-actions {
  margin-top: 0.5rem;
}

/* ——— Pakbon A4 printvoorbeeld ——— */
.pakbon-print-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  background: rgba(15, 20, 25, 0.88);
}

.pakbon-print-overlay[hidden] {
  display: none !important;
}

.pakbon-print-root {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.pakbon-a4 {
  display: flex;
  flex-direction: column;
  width: 210mm;
  min-height: 297mm;
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
  padding: 18mm 16mm 20mm;
  font-family: "Segoe UI", system-ui, sans-serif;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
}

.pakbon-a4__brand {
  border-bottom: 3px solid #111;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.pakbon-a4__mark {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4mm 6mm;
}

.pakbon-a4__logo-img {
  display: block;
  max-height: 22mm;
  width: auto;
  object-fit: contain;
}

.pakbon-a4__wordmark {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.pakbon-a4__logo {
  font-size: 22pt;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.pakbon-a4__tag {
  font-size: 9pt;
  color: #444;
  margin-top: 2px;
}

.pakbon-a4__title {
  margin: 0 0 6px;
  font-size: 18pt;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pakbon-a4__subtitle {
  margin: 0 0 16px;
  font-size: 10pt;
  color: #555;
}

.pakbon-a4__meta {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 6px 14px;
  font-size: 10.5pt;
  margin: 0 0 18px;
}

.pakbon-a4__meta dt {
  margin: 0;
  font-weight: 700;
  color: #333;
}

.pakbon-a4__meta dd {
  margin: 0;
}

.pakbon-a4__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
  margin-bottom: 22px;
}

.pakbon-a4__table th,
.pakbon-a4__table td {
  border: 1px solid #222;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.pakbon-a4__table th {
  background: #f0f0f0;
  font-weight: 700;
}

.pakbon-a4__table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pakbon-a4__foot {
  font-size: 9pt;
  color: #555;
  margin-bottom: 20px;
}

.pakbon-a4__signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12mm;
  margin-top: auto;
  padding-top: 10mm;
  font-size: 10pt;
}

.pakbon-a4__sign {
  border-top: 1px solid #333;
  padding-top: 6px;
}

@media print {
  /* Standaard A4; etiketten gebruiken aparte @page label (zie #print-overlay .sheet). */
  @page {
    size: A4;
    margin: 12mm;
  }

  @page label {
    size: 102mm 102mm;
    margin: 0;
  }

  body.printing-pakbon #session-header,
  body.printing-pakbon #app-root,
  body.printing-pakbon #auth-overlay,
  body.printing-pakbon #print-overlay {
    display: none !important;
  }

  body.printing-pakbon {
    background: #fff;
  }

  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  .pakbon-print-overlay {
    position: static !important;
    display: block !important;
    background: #fff;
  }

  .pakbon-print-bar {
    display: none !important;
  }

  .pakbon-print-root {
    padding: 0;
    overflow: visible;
    display: block;
  }

  .pakbon-a4 {
    display: block;
    box-shadow: none;
    width: 100%;
    min-height: auto;
    max-width: none;
    padding: 0;
  }

  .pakbon-a4--page-break {
    page-break-after: always;
    break-after: page;
  }

  .pakbon-a4__continued,
  .pakbon-a4__meta-cont {
    font-size: 0.9rem;
    color: #555;
  }

  .pakbon-a4__meta-cont {
    margin: 0 0 0.5rem;
  }

  .pakbon-a4__signatures {
    margin-top: 10mm;
    padding-top: 4mm;
  }
}

@media print {
  body {
    margin: 0;
    background: #fff;
  }

  body.printing-labels #app-root,
  body.printing-labels #session-header {
    display: none !important;
  }

  .print-overlay {
    position: static !important;
    display: block !important;
    background: #fff;
  }

  .print-bar {
    display: none !important;
  }

  .print-sheets {
    padding: 0;
    gap: 0;
    background: #fff;
    overflow: visible;
  }

  #print-overlay .sheet {
    page: label;
    border: none;
    page-break-after: always;
    break-after: page;
  }

  #print-overlay .sheet-ingredients {
    background: #fff;
    box-shadow: none;
  }

  #print-overlay .sheet-scale-slot {
    background: #fff;
  }

  #print-overlay .sheet:last-of-type {
    page-break-after: auto;
    break-after: auto;
  }
}

/* Geen technische voettekst voor ingelogde klanten (alleen admin ziet uitleg over server/localStorage). */
body.role-customer .footer {
  display: none;
}

.admin-calendar-feed {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, white);
}

.admin-calendar-feed-url {
  font-size: 0.82rem;
  font-family: ui-monospace, Consolas, monospace;
}

.admin-calendar-feed-lead {
  margin: 0.85rem 0 0.25rem;
  font-weight: 600;
}

.admin-calendar-feed-steps {
  margin: 0.25rem 0 0.65rem;
  padding-left: 1.2rem;
}

.admin-data-status--warn {
  color: #a61b1b;
  font-weight: 600;
  border-left: 3px solid #c62828;
  padding-left: 0.5rem;
}

.admin-calendar-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0d7a3a;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, #0d7a3a 12%, transparent);
}

.admin-calendar-live-badge::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #0d7a3a;
  animation: admin-cal-live-pulse 1.2s ease-in-out infinite;
}

@keyframes admin-cal-live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.admin-calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.admin-calendar-month-label {
  flex: 1 1 auto;
  text-align: center;
  font-size: 1.05rem;
  min-width: 10rem;
}

.admin-calendar-days {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-cal-day {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: var(--surface);
}

.admin-cal-day.is-today {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

.admin-cal-day__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.admin-cal-day__title {
  font-weight: 700;
}

.admin-cal-day__count {
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-cal-order {
  padding: 0.45rem 0;
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.admin-cal-order--clickable {
  cursor: pointer;
  border-radius: 6px;
  margin: 0 -0.35rem;
  padding: 0.45rem 0.35rem;
  transition: background 0.12s ease;
}

.admin-cal-order--clickable:hover,
.admin-cal-order--clickable:focus-visible {
  background: color-mix(in srgb, var(--accent, #2563eb) 10%, transparent);
  outline: none;
}

.admin-cal-order--clickable:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #2563eb) 35%, transparent);
}

.admin-cal-order:first-of-type {
  border-top: none;
  padding-top: 0;
}

.admin-cal-order__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  font-size: 0.9rem;
}

.admin-cal-order__lines {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}

.admin-cal-order-lines--preview {
  margin: 0.35rem 0 0.2rem;
  font-size: 0.88rem;
}

.admin-cal-order-lines--preview li {
  padding: 0.2rem 0;
  border-top: none;
  list-style: none;
}

.admin-cal-order-lines--preview li span {
  color: var(--muted);
}

.admin-cal-order__tap {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
}

.admin-cal-dialog {
  border: none;
  padding: 0;
  max-width: min(96vw, 42rem);
  width: 100%;
  background: transparent;
}

.admin-cal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.admin-cal-dialog__panel {
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-cal-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-cal-dialog__head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.admin-cal-dialog__body {
  padding: 1rem;
  overflow-y: auto;
  font-size: 1rem;
  line-height: 1.45;
}

.admin-cal-order-detail__meta {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.admin-cal-order-detail__meta strong {
  font-size: 1.05rem;
}

.admin-cal-order-lines {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.admin-cal-order-lines li {
  padding: 0.55rem 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  font-size: 1rem;
}

.admin-cal-order-lines li:first-child {
  border-top: none;
}

.admin-cal-order-lines li span {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-cal-dialog__totals {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 50%, var(--card, #fff));
}

.admin-cal-dialog__totals h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.admin-cal-totals-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.admin-cal-totals-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.admin-cal-pakbon-panel {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card, #fff);
}

.admin-cal-pakbon-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.admin-cal-pakbon-fields {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(14rem, 1.4fr);
  gap: 1rem;
  margin: 0.65rem 0;
  align-items: start;
}

.pakbon-date-input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 1rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text, #111);
  box-sizing: border-box;
}

.pakbon-date-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-color: var(--accent);
}

.pakbon-field-customer .pakbon-customer-search {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.45rem;
  font-size: 0.95rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 8px;
  box-sizing: border-box;
}

.pakbon-customer-select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.95rem;
  border: 1px solid var(--border, #ccc);
  border-radius: 8px;
  background: var(--surface, #fff);
  box-sizing: border-box;
}

.pakbon-customer-select[size]:not([size="1"]) {
  min-height: 8rem;
  max-height: 14rem;
  overflow-y: auto;
}

.pakbon-summary {
  margin: 0.45rem 0 0;
  font-size: 0.88rem;
  color: var(--muted, #555);
  min-height: 1.25rem;
}

.pakbon-summary.is-loading {
  color: var(--accent);
  font-style: italic;
}

.admin-cal-pakbon-actions {
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .admin-cal-pakbon-fields {
    grid-template-columns: 1fr;
  }
}

.admin-cal-totals-result {
  margin: 0.65rem 0 0;
  padding: 0.75rem;
  max-height: 40vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
}

@media (max-width: 640px) {
  .admin-calendar-feed .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-calendar-feed .actions .btn {
    width: 100%;
  }

  .admin-calendar-toolbar .btn {
    min-height: 2.75rem;
    min-width: 2.75rem;
  }
}

/* ——— Admin dashboard (WordPress-achtig) ——— */
body.role-admin {
  background: #f0f0f1;
}

body.role-admin #session-header {
  display: none !important;
}

body.role-admin #admin-sidebar {
  display: flex;
}

body.role-admin #admin-topbar {
  display: flex;
}

.admin-sidebar {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: 260px;
  height: 100vh;
  background: #1d2327;
  color: #f0f0f1;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
}

.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar__logo {
  border-radius: 6px;
  background: #fff;
  padding: 2px;
}

.admin-sidebar__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-size: 0.82rem;
  opacity: 0.85;
}

.admin-sidebar__brand-text strong {
  font-size: 1rem;
  color: #fff;
  opacity: 1;
}

.admin-sidebar__nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.5rem 0.5rem 1rem;
}

.admin-sidebar__group-label {
  margin: 0.85rem 0.35rem 0.25rem;
  padding: 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(240, 240, 241, 0.45);
}

.admin-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0.1rem 0;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #f0f0f1;
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.admin-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-sidebar__link.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.admin-sidebar__icon {
  width: 1.1rem;
  opacity: 0.75;
  text-align: center;
  flex-shrink: 0;
}

.admin-sidebar__link.is-active .admin-sidebar__icon {
  opacity: 1;
}

.admin-sidebar__foot {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar__logout {
  width: 100%;
  color: rgba(240, 240, 241, 0.85);
  border-color: rgba(255, 255, 255, 0.2);
}

.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0, 0, 0, 0.45);
}

body.role-admin.admin-sidebar-open .admin-sidebar-backdrop {
  display: block;
}

.admin-topbar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  margin-left: 260px;
  padding: 0.65rem clamp(1rem, 3vw, 1.75rem);
  background: #fff;
  border-bottom: 1px solid #c3c4c7;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.admin-topbar__menu {
  display: none;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.35rem;
}

.admin-topbar__titles {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-topbar__breadcrumb {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-topbar__title {
  margin: 0.1rem 0 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
}

.admin-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.admin-user-chip {
  font-size: 0.82rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #f0f0f1;
  color: var(--muted);
  border: 1px solid #dcdcde;
}

body.role-admin .admin-main.layout {
  margin-left: 260px;
  max-width: none;
  padding: 1.25rem clamp(1rem, 3vw, 2rem) 2.5rem;
  min-height: calc(100vh - 3.5rem);
}

body.role-admin .admin-page.card {
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.admin-dashboard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.admin-dashboard__head h2 {
  margin: 0;
}

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.25rem;
}

.admin-stat-card {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.admin-stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

.admin-stat-card__label {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.admin-stat-card--accent {
  border-left: 4px solid var(--accent);
}

.admin-stat-card--warn {
  border-left: 4px solid #dba617;
}

.admin-dashboard__quick h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.admin-dashboard__quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

@media (max-width: 900px) {
  .admin-topbar__menu {
    display: inline-flex;
  }

  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.role-admin.admin-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-topbar,
  body.role-admin .admin-main.layout {
    margin-left: 0;
  }
}
