/* ══════════════════════════════════════════════════
   QR Order Scanner — Dark Design System
   Preserves all JS-targeted class names & IDs
   ══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
  color-scheme: dark;
  /* ── Core palette ── */
  --bg:          #07070f;
  --surface:     #0d0d1a;
  --card-bg:     #131320;   /* maps to old --card-bg */
  --card2:       #1a1a2e;
  --card3:       #20203a;

  /* ── Borders ── */
  --border:      rgba(255,255,255,0.07);
  --border2:     rgba(255,255,255,0.13);
  --border3:     rgba(255,255,255,0.20);

  /* ── Brand ── */
  --primary:     #6366f1;   /* maps to old --primary */
  --primary-hover: #4f46e5;
  --on-primary:  #ffffff;
  --cyan:        #06b6d4;
  --green:       #10b981;
  --red:         #f43f5e;
  --amber:       #f59e0b;
  --violet:      #8b5cf6;

  /* ── Text ── */
  --t:           #f1f5f9;
  --td:          #94a3b8;
  --tm:          #64748b;
  --text-on-dark: #f1f5f9;
  --text-on-light: #f1f5f9;

  /* ── Legacy aliases (keep JS-targeted refs working) ── */
  --default-bg:         rgba(99,102,241,0.12);
  --default-hover:      rgba(99,102,241,0.20);
  --default-disabled:   rgba(99,102,241,0.06);
  --shadow:             0 4px 20px rgba(0,0,0,0.4);
  --pin-empty-bg:       var(--card2);
  --pin-focus:          var(--primary);
  --pin-valid:          var(--green);
  --pin-error:          var(--red);
  --warn-bg:            rgba(245,158,11,0.10);
  --warn-border:        rgba(245,158,11,0.35);
  --success-bg:         rgba(16,185,129,0.10);
  --success-strong:     var(--green);
  --error-bg:           rgba(244,63,94,0.10);
  --error-strong:       var(--red);
  --toggle-on:          var(--green);
  --toggle-off:         #334155;

  /* ── Radii ── */
  --r8:8px; --r10:10px; --r12:12px; --r14:14px; --r16:16px; --r20:20px;

  /* ── Spacing (legacy) ── */
  --spacing-xs: 4px;
  --spacing-small: 8px;
  --spacing-sm: 10px;
  --spacing-medium: 12px;
  --spacing-large: 24px;
  --spacing-xl: 25px;
  --margin-left-small: 6px;
}

/* ══ LIGHT THEME ══════════════════════════════════ */
html[data-theme="light"] {
  color-scheme: light;
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --card-bg:       #ffffff;
  --card2:         #f8fafc;
  --card3:         #f1f5f9;
  --border:        rgba(0,0,0,0.08);
  --border2:       rgba(0,0,0,0.12);
  --border3:       rgba(0,0,0,0.20);
  --primary:       #4f46e5;
  --primary-hover: #4338ca;
  --cyan:          #0891b2;
  --green:         #059669;
  --red:           #e11d48;
  --amber:         #d97706;
  --t:             #0f172a;
  --td:            #334155;
  --tm:            #64748b;
  --shadow:        0 2px 12px rgba(0,0,0,0.08);
  --pin-empty-bg:  #f1f5f9;
  --warn-bg:       rgba(217,119,6,0.09);
  --warn-border:   rgba(217,119,6,0.28);
  --toggle-off:    #cbd5e1;
  --default-bg:    rgba(79,70,229,0.08);
  --default-hover: rgba(79,70,229,0.14);
}

/* Light-mode element-level overrides */
html[data-theme="light"] .app-bar {
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
  border-bottom-color: rgba(0,0,0,0.07);
}
html[data-theme="light"] .btn-warn {
  background: #f1f5f9;
  color: #475569;
  border-color: rgba(0,0,0,0.12);
}
html[data-theme="light"] .btn-warn:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: rgba(0,0,0,0.18);
  color: #0f172a;
}
html[data-theme="light"] .order-header-card {
  background: linear-gradient(135deg, rgba(79,70,229,0.07), rgba(8,145,178,0.04));
  border-color: rgba(79,70,229,0.14);
}
html[data-theme="light"] .order-header-top {
  border-bottom-color: rgba(0,0,0,0.06);
}
html[data-theme="light"] .page-pin {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(79,70,229,0.07) 0%, transparent 65%);
}
html[data-theme="light"] .action-tile:hover {
  background: rgba(79,70,229,0.06);
}
html[data-theme="light"] .logs-table tbody tr:hover {
  background: rgba(79,70,229,0.04);
}
html[data-theme="light"] .page-signature .signature-wrap {
  background: #ffffff;
  border-color: rgba(0,0,0,0.12);
}
html[data-theme="light"] .scanner-viewport {
  box-shadow: 0 0 30px rgba(79,70,229,0.10);
}
html[data-theme="light"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-theme="light"] .btn-primary { box-shadow: 0 4px 16px rgba(79,70,229,0.30); }
html[data-theme="light"] .btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(79,70,229,0.38); }
/* ripple overlay dark in light mode */
html[data-theme="light"] .btn::after { background: rgba(0,0,0,0.07); }
html[data-theme="light"] .action-tile::after { background: rgba(0,0,0,0.05); }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--t);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  /* Smooth theme switch */
  transition: background-color 0.22s ease, color 0.22s ease;
}

/* ══ UTILITY ══════════════════════════════════════ */
.hidden          { display: none !important; }
.align-center    { text-align: center; }
.muted           { color: var(--tm); }
.pointer         { cursor: pointer; }

.margin-bottom-xs     { margin-bottom: var(--spacing-xs); }
.margin-bottom-small  { margin-bottom: var(--spacing-small); }
.margin-bottom-medium { margin-bottom: var(--spacing-medium); }
.margin-top-0         { margin-top: 0; }
.margin-top-small     { margin-top: var(--spacing-small); }
.margin-top-medium    { margin-top: var(--spacing-medium); }
.margin-top-large     { margin-top: var(--spacing-large); }
.margin-top-sm        { margin-top: var(--spacing-sm); }
.margin-left-small    { margin-left: var(--margin-left-small); }

/* ══ LAYOUT ═══════════════════════════════════════ */
.page {
  background: var(--bg);
  min-height: 100vh;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px;
}
.container.padded { padding: var(--spacing-large); }

/* ══ APP BAR ══════════════════════════════════════ */
.app-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-bar-back {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--card2);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--td);
  text-decoration: none;
  font-size: 18px;
  transition: background 0.12s, border-color 0.12s, transform 0.10s, opacity 0.10s;
  -webkit-tap-highlight-color: transparent;
}
.app-bar-back:hover { background: var(--card3); border-color: var(--border3); }
.app-bar-back:active         { transform: scale(0.87); opacity: 0.65; transition: transform 0.07s, opacity 0.07s; }
.app-bar-back.is-pressing    { transform: scale(0.87); opacity: 0.65; transition: transform 0.06s, opacity 0.06s; }

.app-bar-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  flex: 1;
  color: var(--t);
}

.app-bar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.app-bar-action {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.22);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--primary);
  font-size: 16px;
  transition: background 0.12s, transform 0.10s, opacity 0.10s;
  -webkit-tap-highlight-color: transparent;
}
.app-bar-action:active         { transform: scale(0.87); opacity: 0.65; transition: transform 0.07s, opacity 0.07s; }
.app-bar-action.is-pressing    { transform: scale(0.87); opacity: 0.65; transition: transform 0.06s, opacity 0.06s; }

/* Floating theme toggle (for pages without an app-bar, e.g. PIN page) */
.theme-toggle-float {
  position: fixed;
  top: 14px; right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--card2);
  border: 1px solid var(--border2);
  color: var(--td);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  transition: background 0.12s, transform 0.10s, opacity 0.10s;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle-float:active         { transform: scale(0.87); opacity: 0.65; transition: transform 0.07s, opacity 0.07s; }
.theme-toggle-float.is-pressing    { transform: scale(0.87); opacity: 0.65; transition: transform 0.06s, opacity 0.06s; }

/* ══ CARD ══════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--r14);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card.admin {
  text-align: left;
  max-width: 520px;
  margin: var(--spacing-large) auto var(--spacing-xl);
}
/* No extra top margin for first child inside card */
.card .btn-large:first-child  { margin-top: 0; }
.card .status-panel:first-child { margin-top: 0; }

.card-inner { padding: 16px; }

/* Staff / admin blocks — same vocabulary as Order Hub */
.container-page { padding-top: 20px; }

.app-bar-brand {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
  font-weight: 900;
  flex-shrink: 0;
  line-height: 1;
}

.hub-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tm);
  margin-bottom: 4px;
}
.hub-page-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--t);
  margin: 0;
}
.hub-lede {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.block-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 14px;
  color: var(--t);
}
.block-helper {
  font-size: 12px;
  line-height: 1.45;
  margin: 4px 0 0;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-stack-tight { gap: 10px; }

.subpanel-top {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.inline-actions-row {
  display: flex;
  gap: 10px;
}
.inline-actions-row .btn-large { flex: 1; margin-top: 0; }

.status-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.status-code-hint { font-size: 12px; }

.card-inner .pin-form {
  margin: 16px 0;
}

.card-inner-loading {
  padding: 32px 16px;
  text-align: center;
}

.logs-empty-inner {
  padding: 24px 16px;
  text-align: center;
}

/* Action tiles as buttons (Order Hub grid) */
button.action-tile {
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.action-tile-full {
  grid-column: 1 / -1;
}

.admin-settings-hub {
  margin-bottom: 14px;
}

.card-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.card-row:last-child { border-bottom: none; }
.card-row-label { font-size: 13px; font-weight: 500; color: var(--td); flex: 1; }
.card-row-val   { font-size: 13px; font-weight: 600; }

/* ══ SECTION HEADER ════════════════════════════════ */
.header { text-align: center; margin-bottom: 16px; }
.title  { text-align: center; margin: 20px 0 16px; font-size: 1.4rem; font-weight: 800; }

/* ══ TYPOGRAPHY ════════════════════════════════════ */
.order-name    { font-size: 1.6rem; font-weight: 900; margin: 8px 0; letter-spacing: -0.5px; }
.copy-order-name { display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;font-size:0.75rem;opacity:0.4;cursor:pointer;margin-left:6px;vertical-align:middle;transition:opacity 0.2s,background 0.2s;border-radius:8px;background:var(--card2,rgba(255,255,255,0.06));border:1px solid var(--border,rgba(255,255,255,0.08)); }
.copy-order-name:hover { opacity:1;background:var(--card3,rgba(255,255,255,0.1)); }
.customer-name { color: var(--td); margin-bottom: 8px; font-weight: 600; }

/* ══ BUTTONS ═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: var(--r12);
  font-size: 14px; font-weight: 700; letter-spacing: -0.2px;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
  /* Ripple setup */
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
/* Ripple overlay */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.18);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
}
/* Press: fast in (80ms) — mouse :active */
.btn:active:not(:disabled) {
  transform: scale(0.96);
  filter: brightness(0.88);
  transition: transform 0.08s ease, filter 0.08s ease;
}
.btn:active:not(:disabled)::after { opacity: 1; }
/* Press: iOS touch — JS adds .is-pressing on touchstart */
.btn.is-pressing:not(:disabled) {
  transform: scale(0.96);
  filter: brightness(0.88);
  transition: transform 0.06s ease, filter 0.06s ease;
}
.btn.is-pressing:not(:disabled)::after { opacity: 1; }
.btn:focus-visible { outline: 3px solid rgba(99,102,241,0.4); outline-offset: 2px; }

a.btn:link, a.btn:visited, a.btn:hover, a.btn:focus, a.btn:active { text-decoration: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 18px rgba(99,102,241,0.35);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 6px 22px rgba(99,102,241,0.45);
}
.btn-primary:disabled {
  background: rgba(99,102,241,0.25);
  border-color: rgba(99,102,241,0.15);
  color: var(--tm);
  cursor: not-allowed;
  box-shadow: none;
}
/* Lookup: keep primary treatment while loading (matches native ProgressView + label) */
#force-lookup-btn.btn-primary:disabled[aria-busy="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  opacity: 0.92;
  cursor: wait;
  box-shadow: 0 4px 18px rgba(99,102,241,0.35);
}

.btn-warn {
  background: var(--card2);
  color: var(--td);
  border-color: var(--border2);
}
.btn-warn:hover:not(:disabled) {
  background: var(--card3);
  border-color: var(--border3);
  color: var(--t);
}
.btn-warn:disabled {
  background: var(--card2);
  color: var(--tm);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Danger/red variant */
.btn-danger {
  background: rgba(244,63,94,0.12);
  color: var(--red);
  border-color: rgba(244,63,94,0.25);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(244,63,94,0.20);
}

/* Green variant */
.btn-success {
  background: rgba(16,185,129,0.12);
  color: var(--green);
  border-color: rgba(16,185,129,0.25);
}
.btn-success:hover:not(:disabled) {
  background: rgba(16,185,129,0.20);
}

.btn-large  { width: 100%; margin-top: 16px; padding: 18px; font-size: 16px; }
/* Full-width grey nav under content — same height as lookup Scan QR (.btn-large); gap between buttons */
.staff-bottom-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
}
.staff-bottom-nav .btn-large { margin-top: 0; }
.or-row--flush-bottom { margin-bottom: 0; }
.btn-tall   { padding: 16px; font-size: 18px; min-height: 54px; }
.btn-sm     { padding: 9px 14px; font-size: 13px; border-radius: 10px; }
.btn-xs     { padding: 7px 12px; font-size: 12px; border-radius: 8px; width: auto; }

/* ══ FORMS ═════════════════════════════════════════ */
.label { display: block; font-weight: 700; font-size: 12px; color: var(--tm); text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 7px; }
.input-label { font-weight: 600; font-size: 14px; color: var(--td); }

.select {
  width: 100%;
  padding: 13px 40px 13px 14px;
  border-radius: var(--r12);
  border: 1px solid var(--border2);
  font-size: 15px;
  background: var(--card2);
  color: var(--t);
  font-family: 'Inter', sans-serif;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}

.form-grid  { display: grid; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.phone-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.input-text {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--r12);
  border: 1px solid var(--border2);
  font-size: 15px;
  background: var(--card2);
  color: var(--t);
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-text:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.input-text:disabled,
.input-text[readonly] {
  color: var(--tm);
  background: var(--card3);
  cursor: default;
}
.input-text::placeholder { color: var(--tm); }
/* Alias used in admin/address forms */
.input {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--r12);
  border: 1px solid var(--border2);
  font-size: 15px;
  background: var(--card2);
  color: var(--t);
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.input::placeholder { color: var(--tm); }
.input:disabled, .input[readonly] { color: var(--tm); background: var(--card3); cursor: default; }

/* ══ STATUS PANELS ═════════════════════════════════ */
.status-panel {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--r12);
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--amber);
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}
.status-panel.warning {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--amber);
}
.status-panel.success {
  border-color: rgba(16,185,129,0.35);
  background: rgba(16,185,129,0.10);
  color: var(--green);
}
.status-panel.error {
  border-color: rgba(244,63,94,0.35);
  background: rgba(244,63,94,0.10);
  color: var(--red);
}

.centered-panel { margin-left: auto; margin-right: auto; max-width: 520px; }

/* ══ STATUS PILLS ══════════════════════════════════ */
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid var(--border2);
  background: var(--card2);
  color: var(--td);
}
.status-pill + .status-pill { margin-left: 6px; }
.status-pill.neutral { border-color: var(--border2); background: var(--card2); color: var(--td); }
.status-pill.warn    { border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.10); color: var(--amber); }
.status-pill.success { border-color: rgba(16,185,129,0.35); background: rgba(16,185,129,0.10); color: var(--green); }

/* ══ SUCCESS CHECK ═════════════════════════════════ */
.success-check {
  width: 100px; height: 100px;
  border-radius: 24px;
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.25);
  display: grid; place-items: center;
  margin: 24px auto;
}
.success-check svg { width: 50px; height: 50px; stroke: var(--green); }

/* ══ HELPER / FOOTER TEXT ══════════════════════════ */
.helper { margin-top: 12px; color: var(--td); font-size: 14px; }
.helper.error { color: var(--red); }
.footer { text-align: center; color: var(--tm); margin-top: 24px; font-size: 13px; }

/* ══ PIN PAGE ══════════════════════════════════════ */
.page-pin {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,0.10) 0%, transparent 65%);
}
.page-pin .container {
  margin: 0 auto;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

/* PIN inputs */
.pin-form {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 12px;
  justify-content: center;
  margin: 28px 0;
}

.pin-digit {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  width: 2.5ch;
  height: 68px;
  padding: 0;
  border: 1.5px solid var(--border2);
  border-radius: var(--r12);
  background: var(--card2);
  color: var(--t);
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  caret-color: var(--primary);
}
.pin-digit:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.pin-digit.valid {
  border-color: rgba(16,185,129,0.6);
  background: rgba(16,185,129,0.06);
  color: var(--green);
}
.pin-digit.error {
  border-color: rgba(244,63,94,0.6);
  background: rgba(244,63,94,0.06);
  color: var(--red);
}

/* Smaller PIN digits for inline forms */
.pin-form-small {
  gap: 8px;
  margin: 8px 0 0;
  justify-content: flex-start;
}
.pin-digit-small {
  font-size: 22px;
  width: 2ch;
  height: 46px;
}

/* ══ LOOKUP PAGE ═══════════════════════════════════ */
.lookup-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 15px;
}
.lookup-fixed {
  font-weight: 600;
  font-size: 19px;
  color: var(--tm);
  line-height: 68px;
  letter-spacing: 0.5px;
}
.lookup-row.center { justify-content: center; }

/* ══ QUANTITY CONTROLS ═════════════════════════════ */
.qty-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.qty-row {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 32px 0;
}
.qty-group.wide {
  display: flex;
  width: 100%;
  justify-content: center;
  gap: 12px;
}

.qty-btn {
  padding: 10px 12px;
  min-width: 52px;
  min-height: 52px;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r10);
  background: var(--card2);
  border: 1px solid var(--border2);
  color: var(--td);
  cursor: pointer;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  transition: all 0.1s;
}
.qty-btn:hover { background: var(--card3); border-color: var(--border3); color: var(--t); }
.qty-btn:active { transform: scale(0.96); }

.qty-input {
  width: 72px;
  text-align: center;
  padding: 10px 8px;
  border: 1px solid var(--border2);
  border-radius: var(--r10);
  font-size: 18px;
  font-weight: 700;
  background: var(--card-bg);
  color: var(--t);
  font-family: 'Inter', sans-serif;
}
.qty-input:disabled { background: var(--card2); color: var(--tm); }
.qty-input.tall { font-size: 18px; padding: 16px 14px; min-height: 54px; height: auto; }

/* ══ FULFILLMENT LIST ══════════════════════════════ */
.fulfill-lines-list {
  list-style: none;
  padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.fulfill-lines-list-item {
  border: 1px solid var(--border2);
  padding: 14px;
  border-radius: var(--r12);
  background: var(--card2);
}

/* ══ TOGGLE SWITCH ═════════════════════════════════ */
.switch-center { display: flex; justify-content: center; }
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
.switch .switch-label { font-weight: 600; color: var(--t); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: relative;
  width: 52px; height: 28px;
  background: var(--toggle-off);
  border-radius: 999px;
  border: 1px solid var(--border2);
  transition: background-color 0.2s ease;
}
.switch .slider::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.switch input:checked + .slider { background: var(--green); border-color: rgba(16,185,129,0.3); }
.switch input:checked + .slider::before { transform: translateX(24px); }

/* ══ CHECKBOXES (admin) ════════════════════════════ */
.chk-square {
  appearance: none;
  -webkit-appearance: none;
  width: 38px; height: 38px;
  min-width: 38px; min-height: 38px;
  border-radius: 8px;
  border: 2px solid var(--border2);
  background: var(--card2);
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.chk-square:hover { border-color: var(--primary); }
.chk-square:focus-visible { outline: 3px solid rgba(99,102,241,0.35); outline-offset: 2px; }
.chk-square::after {
  content: '';
  width: 14px; height: 14px;
  border-radius: 3px;
  transform: scale(0);
  transition: transform 0.12s ease;
  background: #fff;
}
.chk-square:checked { background: var(--primary); border-color: var(--primary); }
.chk-square:checked::after { transform: scale(1); }

label[for^="st-"] {
  line-height: 1.2;
  font-size: 16px;
  color: var(--t);
}

/* ══ ALLOWED STATUSES LIST ═════════════════════════ */
.allowed-statuses-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.allowed-statuses-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r10);
  border: 1px solid var(--border);
  background: var(--card2);
  transition: border-color 0.12s;
}
.allowed-statuses-list-item:hover { border-color: var(--border2); }

/* ══ USER MANAGEMENT ═══════════════════════════════ */
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--r12);
  margin-bottom: 8px;
  background: var(--card2);
  transition: border-color 0.12s;
}
.user-row:hover { border-color: var(--border3); }

.user-info {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.user-name {
  font-weight: 700; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--t);
}
.user-pin-display { font-size: 12px; color: var(--tm); letter-spacing: 2px; }

.user-actions { display: flex; gap: 8px; flex-shrink: 0; }
.user-edit-btn,
.user-delete-btn {
  padding: 8px 12px;
  min-width: 42px; min-height: 42px;
  font-size: 15px;
  flex-shrink: 0;
}
.user-add-form {
  margin-top: 12px;
  display: flex; flex-direction: column; gap: 12px;
}

.staff-connect-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
}
.staff-connect-qr-img {
  display: block;
  width: 216px;
  max-width: 100%;
  height: auto;
  border-radius: var(--r12);
  border: 1px solid var(--border2);
  background: #fff;
  padding: 10px;
  box-sizing: border-box;
}

/* ══ LOGGED-IN USER / FOOTER ═══════════════════════ */
.logged-in-user {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}
.logout-link { margin-bottom: 6px; }
.logout-link a {
  font-size: 12px;
  color: var(--red);
  text-decoration: underline;
  opacity: 0.85;
}
.logout-link a:hover { opacity: 1; }
.app-version { font-size: 12px; color: var(--tm); }

/* ══ SIGNATURE PAGE ════════════════════════════════ */
.page-signature .signature-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--card2);
  border-radius: var(--r12);
  border: 1px solid var(--border2);
  overflow: hidden;
}
.page-signature .signature-wrap canvas {
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}
.page-signature .button-row {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; margin-top: 16px;
}

/* ══ ACTIVITY LOGS ═════════════════════════════════ */
.logs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.logs-header .title { margin: 0; text-align: left; }
.logs-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.logs-card { padding: 0; overflow: hidden; }

.logs-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.logs-table th,
.logs-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.logs-table th {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--tm);
  background: var(--card2);
  position: sticky; top: 0; z-index: 1;
}
.logs-table tbody tr:last-child td { border-bottom: none; }
.logs-table tbody tr:hover { background: rgba(99,102,241,0.05); }
.logs-date-cell { white-space: nowrap; color: var(--tm); font-size: 13px; }

.logs-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.logs-page-info { font-weight: 600; font-size: 14px; color: var(--td); }
.logs-pagination .btn { padding: 18px 16px; font-size: 16px; min-width: auto; width: auto; }
.logs-pagination .btn.btn-warn { width: auto; margin-top: 0; }

.logs-bottom-actions { display: flex; justify-content: center; margin-top: 16px; }

/* ══ SCANNER PAGE ══════════════════════════════════ */
.scanner-page {
  display: flex; flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}
.scanner-viewport {
  position: relative;
  width: 100%; max-width: 340px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: var(--r20);
  overflow: hidden;
  border: 1px solid var(--border2);
  background: #000;
  box-shadow: 0 0 40px rgba(99,102,241,0.15);
}
.scanner-viewport video,
.scanner-viewport canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.scan-corners {
  position: absolute; inset: 14px;
  pointer-events: none;
}
.scan-corner {
  position: absolute;
  width: 24px; height: 24px;
}
.scan-corner::before,
.scan-corner::after {
  content: '';
  position: absolute;
  background: var(--primary);
  border-radius: 2px;
}
.scan-corner::before { width: 100%; height: 3px; top: 0; left: 0; }
.scan-corner::after  { width: 3px; height: 100%; top: 0; left: 0; }
.scan-corner.tr { top: 0; right: 0; transform: scaleX(-1); }
.scan-corner.bl { bottom: 0; left: 0; transform: scaleY(-1); }
.scan-corner.br { bottom: 0; right: 0; transform: scale(-1); }

/* ══ ORDER HUB ════════════════════════════════════ */
.order-header-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(6,182,212,0.07));
  border: 1px solid rgba(99,102,241,0.20);
  border-radius: var(--r16);
  overflow: hidden;
  margin-bottom: 16px;
}
.order-header-top {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}
.order-header-top .order-name {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.order-header-main {
  flex: 1;
  min-width: 0;
}
.order-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.order-header-body {
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 7px;
}
.order-meta-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.order-meta-row .status-pill {
  flex-shrink: 1;
  min-width: 0;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.order-meta-label { font-size: 12px; color: var(--tm); font-weight: 500; }
.order-meta-val   { font-size: 13px; font-weight: 700; }
.status-set-at    { font-size: 11px; font-weight: 400; opacity: 0.75; margin-left: 2px; }

/* ── Order line items card ── */
.order-lines-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(6,182,212,0.07));
  border: 1px solid rgba(99,102,241,0.20);
  border-radius: var(--r16);
  overflow: hidden;
  margin-bottom: 16px;
}
.order-lines-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
}
.order-lines-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}
.order-lines-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0 16px;
}
.order-lines-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.order-lines-badge.fulfilled {
  background: rgba(16,185,129,0.14);
  color: var(--green);
}
.order-lines-badge.unfulfilled {
  background: rgba(245,158,11,0.14);
  color: var(--amber);
}
.order-lines-badge.removed {
  background: rgba(148,163,184,0.14);
  color: var(--tm);
}
html[data-theme="light"] .order-lines-card {
  background: linear-gradient(135deg, rgba(79,70,229,0.07), rgba(8,145,178,0.04));
  border-color: rgba(79,70,229,0.14);
}
html[data-theme="light"] .order-lines-divider {
  background: rgba(0,0,0,0.07);
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.action-tile {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--r14);
  padding: 14px 12px;
  cursor: pointer;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.15s, background 0.15s, transform 0.10s, filter 0.10s;
  position: relative; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.action-tile::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
}
.action-tile:hover { border-color: var(--primary); background: rgba(99,102,241,0.07); }
.action-tile:active             { transform: scale(0.96); filter: brightness(0.90); transition: transform 0.08s ease, filter 0.08s ease; }
.action-tile:active::after      { opacity: 1; }
.action-tile.is-pressing        { transform: scale(0.96); filter: brightness(0.90); transition: transform 0.06s ease, filter 0.06s ease; }
.action-tile.is-pressing::after { opacity: 1; }
.action-tile-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: rgba(99,102,241,0.15);
}
.action-tile-label { font-size: 12px; font-weight: 700; color: var(--t); }
.action-tile-sub   { font-size: 11px; color: var(--tm); margin-top: 1px; }

/* ══ ALERT BANNERS ═════════════════════════════════ */
.alert-banner {
  border-radius: var(--r12);
  padding: 11px 14px;
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
}
.alert-warn    { background: var(--warn-bg);                 border: 1px solid var(--warn-border);                color: var(--amber); }
.alert-success { background: rgba(16,185,129,0.10);          border: 1px solid rgba(16,185,129,0.30);             color: var(--green); }
.alert-error   { background: rgba(244,63,94,0.10);           border: 1px solid rgba(244,63,94,0.30);              color: var(--red); }
.alert-info    { background: rgba(99,102,241,0.10);          border: 1px solid rgba(99,102,241,0.25);             color: var(--primary); }

/* ══ DIVIDER ═══════════════════════════════════════ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.or-row {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0;
}
.or-line { flex: 1; height: 1px; background: var(--border); }
.or-txt  { font-size: 11px; font-weight: 600; color: var(--tm); }

/* ══ RESPONSIVE ════════════════════════════════════ */
@media (max-width: 480px) {
  .logs-table th,
  .logs-table td { padding: 8px 10px; font-size: 13px; }
  .logs-header { flex-direction: column; align-items: stretch; }
  .logs-header .title { text-align: center; }
  .container { padding: 14px; }
  .action-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
