/*
 * pyactivate — the one stylesheet of every page (no CSS framework, no build step).
 *
 * [Summary]: design tokens on :root (colour, type, spacing, radius, elevation, layers, motion), the compact
 *   density of the staff / admin shell, base elements, the shared components (environment band, buttons, forms,
 *   alerts, badges, chips, panels, tables, pagination, empty states, Notify toast / modal), the staff shell (top
 *   bar with its user menu, menu with its disclosure groups, content) and the staff pages (sign-in, Today, Find order), then print.
 * [Notes]: Activate navy / cyan stand in until Activate's brand kit arrives — change the brand tokens only.
 *   The cyan accent marks the primary action, the current selection and focus, nothing else: text on the cyan
 *   fill is navy (9:1); lines in the accent on white use --color-accent-strong (3.7:1, the floor for focus
 *   rings and control edges); control borders use --color-border-strong (4.8:1). State colours always come
 *   with text and an icon. Body 14 px, line-height 1.5 (Vietnamese stacked diacritics), system font stack
 *   covering Vietnamese. Lucide icons are <i data-lucide> replaced by <svg data-lucide>: one selector sizes
 *   both. Layers: dropdown < sticky < backdrop < modal < toast < tooltip.
 *   Density: :root holds the full sizes, kept by every page outside the shell — guest, survey, the customer
 *   display, the 80 mm bill and ticket. body.staff-body / body.auth-body (the staff and /admin layouts, their
 *   sign-in pages) override the size tokens with one compact set — top bar 48 px, controls and menu rows 32 px
 *   (44 px and a 60 px top bar on a coarse pointer: counter tablets keep touch targets), tighter content, panel and
 *   cell padding, an 18 px page title. Heights and padding only: text stays 14 px, line-height 1.5. Rules read the
 *   tokens; a size is never copied into a rule.
 */

/* ===== Tokens ============================================================================================ */

:root {
  /* Brand (Activate, until the brand kit arrives) */
  --color-navy: #0b1d3a;
  --color-accent: #22d3ee;            /* cyan fill: primary action, current selection */
  --color-accent-hover: #06b6d4;
  --color-accent-strong: #0891b2;     /* cyan line on white: focus ring, selection bar, primary button edge */
  --color-accent-soft: #ecfeff;       /* background of the current selection */
  --color-on-accent: #0b1d3a;         /* text on the cyan fill */

  /* Neutrals */
  --color-page: #f5f7fa;
  --color-surface: #ffffff;
  --color-surface-muted: #f1f5f9;
  --color-row-hover: #f8fafc;
  --color-border: #e2e8f0;            /* dividers, panel edges */
  --color-border-strong: #64748b;     /* control borders, placeholders (4.8:1 on white) */
  --color-text: #0f172a;
  --color-text-muted: #475569;        /* secondary text (7.6:1 on white) */
  --color-link-hover: #0e7490;        /* 5.4:1 on white */

  /* States: text and icon colour, background, border (text on its background ≥ 4.9:1) */
  --color-success: #15803d;
  --color-success-bg: #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-warning: #92400e;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #fde68a;
  --color-danger: #b91c1c;
  --color-danger-hover: #991b1b;
  --color-danger-bg: #fef2f2;
  --color-danger-border: #fecaca;
  --color-info: #1d4ed8;
  --color-info-bg: #eff6ff;
  --color-info-border: #bfdbfe;
  --color-neutral: #334155;
  --color-neutral-bg: #f1f5f9;
  --color-neutral-border: #cbd5e1;

  /* Environment band: amber for UAT, slate for DEV */
  --band-uat-bg: #fbbf24;
  --band-uat-fg: #451a03;
  --band-dev-bg: #1e293b;
  --band-dev-fg: #f8fafc;

  /* Type — every size ≥ 14 px */
  --font-sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: Consolas, "Cascadia Mono", "Roboto Mono", "Courier New", monospace;
  --text-base: 14px;                  /* body, tables, labels, badges */
  --text-md: 16px;                    /* inputs on phones, slot times, empty-state titles */
  --text-lg: 18px;                    /* section titles */
  --text-xl: 22px;                    /* page titles */
  --text-2xl: 28px;                   /* key figures */
  --leading: 1.5;
  --leading-figure: 1.25;             /* digits only (no diacritics) */
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Spacing (4 px steps) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-full: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.22);

  /* Controls: 40 px with a mouse, 44 px on touch screens (touch targets ≥ 44 px) */
  --control-height: 40px;
  --icon-size: 18px;

  /* Layers */
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-backdrop: 40;
  --z-modal: 50;
  --z-toast: 60;
  --z-tooltip: 70;

  /* Motion (state changes and feedback only) */
  --motion-fast: 150ms;
  --motion-base: 200ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);

  /* Staff shell — the full sizes; the compact ones are in the block below */
  --topbar-height: 60px;
  --nav-width: 224px;
  --nav-item-height: 44px;            /* a menu row */
  --content-pad: var(--space-6);      /* around a page's content (var(--space-4) below 1024 px) */
  --panel-pad-y: var(--space-4);
  --panel-pad-x: var(--space-5);
  --cell-pad-y: var(--space-2);       /* table cells */
  --cell-pad-x: var(--space-3);
  --section-gap: var(--space-6);      /* above each section of a page */
  --page-title-size: var(--text-xl);
}

/* Compact density (HANDOVER §9): the staff and /admin layouts and their sign-in pages. Heights and padding only —
   a table row ≈ 32 px, a menu row 32 px; the type scale and line-height are not touched. */
body.staff-body, body.auth-body {
  --topbar-height: 48px;
  --nav-width: 216px;
  --control-height: 32px;
  --nav-item-height: 32px;
  --content-pad: var(--space-4);
  --panel-pad-y: 10px;
  --panel-pad-x: 14px;
  --cell-pad-y: 5px;
  --cell-pad-x: 10px;
  --section-gap: 14px;
  --page-title-size: var(--text-lg);
}

/* Touch screens: controls and menu rows back to 44 px, in the compact shell too (after its block, so it wins). The
   shell's top bar goes back to 60 px with them: its 44 px controls do not fit a 48 px row, and every sticky
   offset (the menu, Today's slot heads, New booking's aside, the permission matrix's head) follows. Those offsets read
   --topbar-offset — the bar's measured height, set on <body> by activate/js/shell.js while the bar is sticky, so a
   bar wrapped to two rows still covers nothing — and fall back to --topbar-height without it. */
@media (pointer: coarse) {
  :root { --control-height: 44px; }
  body.staff-body, body.auth-body { --control-height: 44px; --nav-item-height: 44px; --topbar-height: 60px; }
}

/* Below 1024 px a page's content sits closer to the screen's edges: 16 px, 12 px in the compact shell. */
@media (max-width: 1023px) {
  :root { --content-pad: var(--space-4); }
  body.staff-body, body.auth-body { --content-pad: var(--space-3); }
}

/* ===== Base ============================================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--color-text);
  background: var(--color-page);
}

h1, h2, h3, p, ul { margin: 0; }
h1, h2, h3 { font-weight: var(--weight-semibold); line-height: var(--leading); }

a { color: var(--color-navy); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--color-link-hover); }

:focus-visible { outline: 2px solid var(--color-accent-strong); outline-offset: 2px; }

[hidden] { display: none !important; }

[data-lucide] {
  display: inline-block;
  flex-shrink: 0;
  width: var(--icon-size);
  height: var(--icon-size);
  vertical-align: middle;
}

pre { font-family: var(--font-mono); }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-navy);
  color: #fff;
}
.skip-link:focus { top: var(--space-2); color: #fff; }

.stack > * + * { margin-top: var(--space-4); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-time { font-variant-numeric: tabular-nums; }
.code { font-family: var(--font-mono); font-weight: var(--weight-semibold); white-space: nowrap; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Environment band (UAT / DEV, never in production) ================================================= */

.env-band {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 6px var(--space-4);
  background: var(--band-uat-bg);
  color: var(--band-uat-fg);
  font-weight: var(--weight-bold);
  letter-spacing: 0.04em;
  text-align: center;
}
.env-band--dev { background: var(--band-dev-bg); color: var(--band-dev-fg); }

/* ===== Buttons =========================================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-weight: var(--weight-semibold);
  line-height: var(--leading);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
}
.btn:hover { color: inherit; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent-strong);
  color: var(--color-on-accent);
}
.btn-primary:hover:not(:disabled) { background: var(--color-accent-hover); color: var(--color-on-accent); }
.btn-primary:active:not(:disabled) { background: var(--color-accent-strong); }

.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn-secondary:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--color-surface-muted); color: var(--color-text); }

.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--color-danger-hover); color: #fff; }

.btn-ghost { color: var(--color-text); }
.btn-ghost:hover:not(:disabled) { background: var(--color-surface-muted); color: var(--color-text); }

.btn-block { width: 100%; }

/* An icon-only button (the top bar's sign-out): as wide as it is high, one control (--control-height); its name is
   its aria-label, shown on hover by its title. */
.btn-square { width: var(--control-height); padding: 0; }

/* Loading: the button's icon gives way to a spinning loader (base.html data-submit-loading, or page JS). */
.btn .btn-spinner { display: none; }
.btn.is-loading .btn-spinner { display: inline-block; animation: spin 0.9s linear infinite; }
.btn.is-loading .btn-icon { display: none; }

/* ===== Forms ============================================================================================= */

.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field-label { font-weight: var(--weight-semibold); }
.field-help { color: var(--color-text-muted); }
.field-error { display: flex; align-items: flex-start; gap: var(--space-1); color: var(--color-danger); }
.field-error [data-lucide] { margin-top: 2px; width: 16px; height: 16px; }

.input, .select {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  line-height: var(--leading);
}
.input::placeholder { color: var(--color-border-strong); }
.input:hover, .select:hover { border-color: var(--color-text-muted); }
.input:focus-visible, .select:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 1px;
  border-color: var(--color-accent-strong);
}
.input[aria-invalid="true"] { border-color: var(--color-danger); }
.input:disabled, .select:disabled { background: var(--color-surface-muted); cursor: not-allowed; }

@media (max-width: 767px) {
  .input, .select { font-size: var(--text-md); }   /* phones do not zoom into a 16 px field */
}

/* ===== Alerts and flash messages (shown inline; with JavaScript, flash messages become toasts) =========== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-neutral-border);
  border-radius: var(--radius-md);
  background: var(--color-neutral-bg);
  color: var(--color-neutral);
}
.alert [data-lucide] { margin-top: 2px; }
.alert--success { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }
.alert--warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning); }
.alert--danger { background: var(--color-danger-bg); border-color: var(--color-danger-border); color: var(--color-danger); }
.alert--info { background: var(--color-info-bg); border-color: var(--color-info-border); color: var(--color-info); }

.flash-list { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4) 0; list-style: none; }

/* ===== Badges and chips (text + icon, never colour alone) ================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  border: 1px solid var(--color-neutral-border);
  border-radius: var(--radius-full);
  background: var(--color-neutral-bg);
  color: var(--color-neutral);
  font-weight: var(--weight-semibold);
  line-height: var(--leading);
  white-space: nowrap;
}
.badge [data-lucide] { width: 16px; height: 16px; }
.badge--success { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }
.badge--warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning); }
.badge--danger { background: var(--color-danger-bg); border-color: var(--color-danger-border); color: var(--color-danger); }
.badge--info { background: var(--color-info-bg); border-color: var(--color-info-border); color: var(--color-info); }
.badge-group { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  max-width: 100%;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text);
  white-space: nowrap;
}
.chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip-meta { color: var(--color-text-muted); }
.chip--success { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }
.chip--warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning); }
.chip--danger { background: var(--color-danger-bg); border-color: var(--color-danger-border); color: var(--color-danger); }
/* An icon-only chip (the top bar's worker chip while the worker runs): its words in a .visually-hidden span, which
   it positions, and in its title. */
.chip--icon { position: relative; padding: 0 var(--space-2); }

/* A chip that is a link (the staff top bar's checklist reminder): no underline, its tone's colour kept on hover (a:hover
   would recolour it) and the hover shown by its border taking that colour; focus keeps the shared ring. */
a.chip { text-decoration: none; }
a.chip:hover { border-color: currentColor; }
a.chip--warning:hover { color: var(--color-warning); }
a.chip--danger:hover { color: var(--color-danger); }

/* The pulse of a chip that asks for action (a checklist round waiting): a dot in the chip's colour that fades and
   shrinks every 1.6 s — decorative (aria-hidden: the chip's words say it); still under prefers-reduced-motion. */
.chip-pulse {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: currentColor;
  animation: chip-pulse 1.6s var(--ease-out) infinite;
}
@keyframes chip-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.6); }
}
@media (prefers-reduced-motion: reduce) {
  .chip-pulse { animation: none; }
}

/* ===== Panels, sections, page header ===================================================================== */

/* A panel's padding, the page title's size and the gap above a section are density tokens (compact in the shell). */
.panel {
  padding: var(--panel-pad-y) var(--panel-pad-x);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.page-title { font-size: var(--page-title-size); }
.page-subtitle { margin-top: var(--space-1); color: var(--color-text-muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.section { margin-top: var(--section-gap); }
.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
  margin-bottom: var(--space-3);
}
.section-title { font-size: var(--text-lg); }
.section-meta { color: var(--color-text-muted); }

/* Key figure: icon, label, value, note. */
.stat-panel { display: flex; align-items: center; gap: var(--space-4); }
.stat-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-success-bg);
  color: var(--color-success);
}
.stat-icon [data-lucide] { width: 24px; height: 24px; }
.stat-label { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--color-text-muted); }
.stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-figure);
  font-variant-numeric: tabular-nums;
}
.stat-meta { color: var(--color-text-muted); }

/* ===== Tables ============================================================================================ */

.table-wrap {
  position: relative;   /* contains the absolute .visually-hidden header texts, or they widen the whole page */
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.table { width: 100%; border-collapse: collapse; }
/* Cell padding is a density token: a row ≈ 32 px in the compact shell. */
.table th, .table td {
  padding: var(--cell-pad-y) var(--cell-pad-x);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle;
}
.table thead th {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--color-row-hover); }
.table .num { text-align: right; }
.cell-truncate {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* ===== Pagination ======================================================================================== */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.pagination-info { color: var(--color-text-muted); }
.pagination-links { display: flex; gap: var(--space-2); }

/* ===== Empty states ====================================================================================== */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-muted);
  text-align: center;
}
.empty > [data-lucide] { width: 32px; height: 32px; color: var(--color-border-strong); }
.empty-title { color: var(--color-text); font-size: var(--text-md); font-weight: var(--weight-semibold); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-2); }
/* A one-line empty state in a panel (Today's "Không có đơn hàng nào cần xử lý"): the panel's own padding. */
.empty--compact { flex-direction: row; justify-content: flex-start; padding: var(--panel-pad-y) var(--panel-pad-x); }
.empty--compact > [data-lucide] { width: 24px; height: 24px; color: var(--color-success); }
.empty--page { max-width: 560px; margin: var(--space-8) auto 0; }

/* ===== Staff shell: top bar, menu, content =============================================================== */

/* The top bar: one row exactly --topbar-height high (48 px in the compact shell, 60 px on a coarse
   pointer) — its vertical padding is what that height leaves around one control (--control-height) and the 1 px
   bottom border, so a row of controls and 32 px chips never grows it; 8 px between items and the content's side
   padding (--content-pad) keep a Manager's bar on one row at 1366 px. When its items still do not fit it wraps, and
   shell.js's --topbar-offset moves the sticky offsets under it. Below 1024 px it wraps (rule further down). */
.staff-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--topbar-height);
  padding: calc((var(--topbar-height) - var(--control-height) - 1px) / 2) var(--content-pad);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.topbar-spacer { flex: 1 1 0; }
.staff-topbar form { margin: 0; }

/* The customer-display chip of the top bar (activate_staff/layout.html, station_display.js): the chip naming what the
   guest's screen shows and its "Về quảng cáo" button side by side, one item of the bar; [hidden] until the counter's
   Activate Station answers with a display. */
.station-chip { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }

/* The VI · EN switch (activate_staff/_language_switch.html): two joined buttons, the current one filled and bold
   (aria-pressed). Not `.lang-switch`: guest.css styles that name for the guest header. The switch with its 1 px
   border is one control high (--control-height: 32 px in the shell, 44 px on a coarse pointer). */
.staff-lang { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-full); overflow: hidden; }
.staff-lang-option {
  min-width: 40px;
  min-height: calc(var(--control-height) - 2px);
  padding: 0 var(--space-3);
  border: 0;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font: inherit;
  cursor: pointer;
}
.staff-lang-option + .staff-lang-option { border-left: 1px solid var(--color-border-strong); }
.staff-lang-option:hover { background: var(--color-surface-muted); color: var(--color-text); }
.staff-lang-option[aria-pressed="true"] { background: var(--color-accent-soft); color: var(--color-text); font-weight: var(--weight-bold); }
.staff-lang-option:focus-visible { outline: 2px solid var(--color-accent-strong); outline-offset: -2px; }
.auth-lang { display: flex; justify-content: flex-end; margin-bottom: var(--space-4); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-navy);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  text-decoration: none;
}
.brand:hover { color: var(--color-navy); }

/* Activate's logo (activate/_brand.html): the cyan mark + the black wordmark (392 : 35), one size per place — bar (the
   staff / admin top bar) mark 28 px, wordmark 14 px high; auth (sign-in cards) 40 / 18; display (customer display)
   48 / 22. The wordmark's width follows from its height; the <img> width / height attributes hold the same sizes, so
   nothing shifts while the files load. In a box narrower than the logo (a sign-in card on a 320 px phone) the
   wordmark shrinks, its height box kept and the drawing scaled to fit (object-fit), instead of widening the page. */
.brand-logo { display: inline-flex; flex: none; align-items: center; gap: var(--space-2); max-width: 100%; }
.brand-logo__mark { display: block; flex: none; }
.brand-logo__wordmark {
  display: block;
  width: auto;
  min-width: 0;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}
.brand-logo--bar .brand-logo__mark { width: 28px; height: 28px; }
.brand-logo--bar .brand-logo__wordmark { height: 14px; }
.brand-logo--auth { gap: var(--space-3); }
.brand-logo--auth .brand-logo__mark { width: 40px; height: 40px; }
.brand-logo--auth .brand-logo__wordmark { height: 18px; }
.brand-logo--display { gap: var(--space-3); }
.brand-logo--display .brand-logo__mark { width: 48px; height: 48px; }
.brand-logo--display .brand-logo__wordmark { height: 22px; }

.venue-picker { display: flex; align-items: center; gap: var(--space-2); }
.venue-picker .select { width: auto; max-width: 240px; }

/* The scan box (activate_staff/_scan_box.html, scan.js): a search field up to 18rem wide — from 12rem, so the top
   bar's chips and sign-out stay on one row on a 1280 px screen —, the scan icon inside on the left; while a lookup
   runs (is-loading) a spinning loader takes the icon's place. Below 1024 px: a row of its own. */
.scan-box { position: relative; flex: 1 1 12rem; min-width: 0; max-width: 18rem; }
.scan-box .input { padding-left: calc(var(--space-3) + var(--icon-size) + var(--space-2)); }
.scan-box .scan-box-icon, .scan-box .scan-box-spinner {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--space-3);
  margin: auto 0;
  color: var(--color-text-muted);
  pointer-events: none;
}
.scan-box .scan-box-spinner { display: none; }
.scan-box.is-loading .scan-box-icon { display: none; }
.scan-box.is-loading .scan-box-spinner { display: inline-block; animation: spin 0.9s linear infinite; }
.scan-box:focus-within .input {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 1px;
  border-color: var(--color-accent-strong);
}
.scan-box:focus-within .scan-box-icon { color: var(--color-accent-strong); }

/* The user menu of the top bar (activate_staff/layout.html: "Hồ sơ của tôi"; activate_admin/layout.html, a username
   sign-in: "Đổi mật khẩu"): a <details data-menu> whose chip is the disclosure button (no script needed) and whose
   panel drops under it. activate/js/shell.js closes it on a click or focus outside and on Escape, and moves the panel
   to the chip's right edge (is-end) when it would leave the window. The chip is one control high (32 px in the
   shell, a 44 px touch target on a coarse pointer); the caret turns while open, motion only under no reduced-motion
   preference. Its items are as high as a menu row (--nav-item-height); the current page's item (aria-current) is
   marked as the left menu marks its own — the soft fill and semibold —, and so is the chip while it holds it. */
.user-menu { position: relative; }
.user-menu > summary { min-height: var(--control-height); cursor: pointer; list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover,
.user-menu[open] > summary { border-color: var(--color-border-strong); }
.user-menu:has(.user-menu-item[aria-current="page"]) > summary { background: var(--color-accent-soft); }
.user-menu-caret { width: 16px; height: 16px; }
.user-menu[open] .user-menu-caret { transform: rotate(180deg); }
@media (prefers-reduced-motion: no-preference) {
  .user-menu-caret { transition: transform 150ms ease-out; }
}
.user-menu-panel {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  z-index: var(--z-dropdown);
  min-width: 100%;
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}
.user-menu-panel.is-end { left: auto; right: 0; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--nav-item-height);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.user-menu-item:hover { background: var(--color-surface-muted); color: var(--color-text); }
.user-menu-item[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-navy);
  font-weight: var(--weight-semibold);
}

.staff-frame { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); align-items: start; }
.staff-frame--no-nav { grid-template-columns: minmax(0, 1fr); }   /* a signed-in user outside the staff groups */

.staff-nav {
  position: sticky;
  top: var(--topbar-offset, var(--topbar-height));
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Exactly the viewport under the bar, scrolling on its own: a menu taller than that (every group open, a short
     window) would otherwise stay stuck with its lower items out of reach. overscroll-behavior keeps the wheel at the
     menu's end from scrolling the page. */
  height: calc(100vh - var(--topbar-offset, var(--topbar-height)));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-4) var(--space-3);
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
}
/* A menu row: its height is the --nav-item-height token (32 px in the compact shell, 44 px on a coarse pointer); no
   vertical padding, the text centred, so one line of 14 px text fits the row without growing it. 8 px between icon,
   label and badge: the longest English label with its badge ("Personal source" 1) stays on one line in 216 px. */
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--nav-item-height);
  padding: 0 var(--space-3);
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: background-color var(--motion-fast) var(--ease-out);
}
.nav-item:hover { background: var(--color-surface-muted); color: var(--color-text); }
.nav-item.is-active {
  border-left-color: var(--color-accent-strong);
  background: var(--color-accent-soft);
  color: var(--color-navy);
  font-weight: var(--weight-semibold);
}
/* A menu group is a disclosure (activate/js/shell.js opens, closes and remembers it): its button is a
   menu row high (--nav-item-height) with the group label's muted semibold text, the caret in the items' icon column
   and the label in their text column (the same border, padding and gap as .nav-item); more space above it than
   below. The caret points down while open and to the inline end while closed, turning in --motion-fast only under no
   reduced-motion preference. A closed group's list carries hidden; an open one stacks its items as the menu does. */
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--nav-item-height);
  margin-top: var(--space-3);
  padding: 0 var(--space-3);
  border: 0;
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
}
.nav-group-toggle:hover { background: var(--color-surface-muted); color: var(--color-text); }
.nav-group-toggle[aria-expanded="false"] .nav-group-caret { transform: rotate(-90deg); }
@media (prefers-reduced-motion: no-preference) {
  .nav-group-caret { transition: transform var(--motion-fast) var(--ease-out); }
}
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }

/* The page's content: padded by --content-pad (its value below 1024 px is set with the tokens). */
.staff-content { min-width: 0; padding: var(--content-pad); }
.staff-content:focus { outline: none; }

/* Below 1024 px: the top bar static, the menu a strip; the top bar, the strip and the content share one left edge
   (--content-pad). */
@media (max-width: 1023px) {
  .staff-topbar { position: static; padding: var(--space-2) var(--content-pad); }
  .scan-box { order: 10; flex-basis: 100%; max-width: none; }
  .staff-frame { grid-template-columns: minmax(0, 1fr); }
  .staff-nav {
    position: static;
    flex-direction: row;
    gap: var(--space-1);
    height: auto;
    overflow-y: hidden;
    padding: var(--space-1) var(--content-pad) 0;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }
  /* No group buttons in the strip: every list joins the one row, a closed one too (beats [hidden]'s !important). */
  .nav-group-toggle { display: none; }
  .nav-group-items, .nav-group-items[hidden] { display: contents !important; }
  .nav-item {
    flex: 0 0 auto;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
  .nav-item.is-active { border-bottom-color: var(--color-accent-strong); }
  .slot-head { top: 0; }   /* the top bar no longer sticks */
}

/* ===== Sign-in =========================================================================================== */

.auth-page { display: grid; place-items: center; min-height: 80vh; padding: var(--space-6) var(--space-4); }
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: var(--space-8) var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}
/* Activate's logo on its own row, the title (and the admin 503 page's sub-line) under it. */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.auth-brand-name { color: var(--color-text-muted); font-weight: var(--weight-semibold); }
.auth-title { font-size: var(--text-xl); }
.auth-note { margin-top: var(--space-5); color: var(--color-text-muted); text-align: center; }

/* ===== Today: the slot list ============================================================================== */

.slot-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.slot-head, .slot-summary {
  display: grid;
  grid-template-columns: minmax(64px, 0.8fr) repeat(4, minmax(64px, 1fr)) minmax(150px, 2.4fr) 20px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
}
.slot-head {
  position: sticky;
  top: var(--topbar-offset, var(--topbar-height));
  z-index: 1;
  border-bottom: 1px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-weight: var(--weight-semibold);
}
.slot { border-bottom: 1px solid var(--color-border); }
.slot:last-child { border-bottom: 0; }
.slot-summary {
  min-height: 52px;
  list-style: none;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out);
}
.slot-summary::-webkit-details-marker { display: none; }
.slot-summary:hover { background: var(--color-row-hover); }
.slot[open] > .slot-summary { background: var(--color-accent-soft); box-shadow: inset 3px 0 0 var(--color-accent-strong); }
.slot.is-closed .slot-time { color: var(--color-text-muted); }
.slot-time { font-size: var(--text-md); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.slot-cell-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.slot-left.is-zero { color: var(--color-danger); font-weight: var(--weight-bold); }
.slot-state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); min-width: 0; }
.slot-count { color: var(--color-text-muted); }
.slot-chevron { color: var(--color-text-muted); transition: transform var(--motion-base) var(--ease-out); }
.slot[open] .slot-chevron { transform: rotate(90deg); }
.slot-bookings { padding: var(--space-3) var(--space-4) var(--space-4); }
.slot-bookings .table-wrap { border-radius: var(--radius-md); }
.slot-empty { color: var(--color-text-muted); }

/* Phones: time and chevron, then the four figures with their labels, then the state. */
@media (max-width: 599px) {
  .slot-head { display: none; }
  .slot-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .slot-time { grid-column: 1 / 4; grid-row: 1; }
  .slot-chevron { grid-column: 4; grid-row: 1; justify-self: end; }
  .slot-state { grid-column: 1 / -1; }
  .slot-cell-label {
    position: static;
    display: block;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    color: var(--color-text-muted);
  }
  .slot-summary .num { text-align: left; }
}

/* ===== Find order: filter bar ============================================================================ */

.filter-bar {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.filter-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.field-grow { flex: 1 1 320px; }
.field-date { flex: 0 1 200px; }
.filter-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.filter-bar .field-help { margin-top: var(--space-2); }

/* ===== Notify: toasts and the alert / confirm modal ====================================================== */

/* --toast-offset: room a page keeps at the bottom for a sticky bar of its own (the permission matrix's foot bar sets it
   from permissions.js); 0 everywhere else. */
.notify-toasts {
  position: fixed;
  right: var(--space-4);
  bottom: calc(var(--toast-offset, 0px) + var(--space-4));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-3);
  width: min(400px, calc(100vw - 2 * var(--space-4)));
  pointer-events: none;
}
.notify-toast {
  --toast-tone: var(--color-info);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--toast-tone);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: notify-toast-in var(--motion-base) var(--ease-out);
}
.notify-toast.is-leaving { animation: notify-toast-out var(--motion-base) ease-in forwards; }
.notify-toast--success { --toast-tone: var(--color-success); }
.notify-toast--error { --toast-tone: var(--color-danger); }
.notify-toast--warning { --toast-tone: var(--color-warning); }
.notify-toast--info { --toast-tone: var(--color-info); }
.notify-toast-icon { margin-top: 1px; color: var(--toast-tone); }
.notify-toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notify-toast-close {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: -6px 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}
.notify-toast-close:hover { background: var(--color-surface-muted); color: var(--color-text); }
.notify-toast-close [data-lucide] { width: 16px; height: 16px; }

@keyframes notify-toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes notify-toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(24px); } }

.notify-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.notify-backdrop { position: absolute; inset: 0; z-index: var(--z-backdrop); background: rgba(15, 23, 42, 0.55); }
.notify-card {
  position: relative;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 2 * var(--space-4));
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  animation: notify-modal-in 180ms var(--ease-out);
}
.notify-card:focus { outline: none; }
.notify-card-body { display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-6) var(--space-6) var(--space-2); }
.notify-card-text { flex: 1; min-width: 0; }
.notify-title { font-size: var(--text-lg); }
.notify-message { margin-top: var(--space-1); color: var(--color-text-muted); white-space: pre-line; }
.notify-detail {
  margin: var(--space-3) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  font-size: var(--text-base);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.notify-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-6) var(--space-5); }
.notify-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-info-bg);
  color: var(--color-info);
}
.notify-icon [data-lucide] { width: 24px; height: 24px; }
.notify-icon--success { background: var(--color-success-bg); color: var(--color-success); }
.notify-icon--error { background: var(--color-danger-bg); color: var(--color-danger); }
.notify-icon--warning { background: var(--color-warning-bg); color: var(--color-warning); }
.notify-modal-open { overflow: hidden; }

@keyframes notify-modal-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

@media (max-width: 599px) {
  .notify-toasts { right: var(--space-2); left: var(--space-2); width: auto; align-items: stretch; }
}

/* ===== Print: content only, black on white =============================================================== */

@media print {
  .skip-link, .staff-topbar, .staff-nav, .page-actions, .filter-bar, .pagination-links, .notify-toasts,
  .notify-modal, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .staff-frame { display: block; }
  .staff-content { padding: 0; }
  .panel, .table-wrap, .slot-list { border-color: #999; box-shadow: none; }
  .table thead th, .slot-head { background: #fff; color: #000; }
  tr, .slot { break-inside: avoid; }
}

/* ===== Staff booking pages: new booking, booking detail, customer display, daily report, needs
   attention, audit log. Tokens only; the page script is activate_staff/js/booking.js. ===================== */

/* Shared bits: text, rows of buttons, input groups, form grid, facts, choices, switch, textarea */
.muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.input-group { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2); }
.input-group .input { flex: 1 1 220px; min-width: 0; }
.textarea { min-height: 72px; padding: var(--space-2) var(--space-3); resize: vertical; }
.field-optional { color: var(--color-text-muted); font-weight: var(--weight-medium); }
.section-title--spaced { margin-bottom: var(--space-3); }
.subsection-title { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-md); }
.spin { animation: spin 0.9s linear infinite; }
.cell-truncate--wide { max-width: 320px; }
.cell-detail { min-width: 180px; color: var(--color-text-muted); }
.row-head { font-weight: var(--weight-semibold); }
.print-only { display: none; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
}
.form-grid .field--full { grid-column: 1 / -1; }

.facts { display: grid; gap: var(--space-2); margin: 0; }
.facts > div { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: var(--space-3); }
.facts dt { color: var(--color-text-muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldset > legend { padding: 0; margin-bottom: var(--space-2); }
.choice-list { display: grid; gap: var(--space-2); }
.choice-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.choice:hover { background: var(--color-surface-muted); }
.choice:has(input:checked) { border-color: var(--color-accent-strong); background: var(--color-accent-soft); }
.choice--inline { align-items: center; }
.choice input { flex-shrink: 0; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--color-accent-strong); }
.choice--inline input { margin-top: 0; }
.choice-text { display: flex; flex-direction: column; min-width: 0; }
.choice-title { font-weight: var(--weight-semibold); }
.choice-help { color: var(--color-text-muted); }

.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  margin-top: var(--space-3);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}
.switch input { width: 20px; height: 20px; margin: 0; accent-color: var(--color-accent-strong); }

@media (max-width: 599px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* New booking: slot grid, ticket steppers, summary */
.new-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-items: start; margin-top: var(--space-5); }
.new-main { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.new-booking .field-date { max-width: 240px; margin-bottom: var(--space-4); }
.company-fields { margin-top: var(--space-3); }

.slot-picker-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) 0;
  color: var(--color-text-muted);
}
.slot-picker-status--error { color: var(--color-danger); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); }
.slot-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  line-height: var(--leading);
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}
.slot-option:hover:not(:disabled) { background: var(--color-surface-muted); }
.slot-option-time { font-size: var(--text-md); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.slot-option-left { color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.slot-option.is-started { border-style: dashed; }
.slot-option[aria-pressed="true"] {
  border-color: var(--color-accent-strong);
  background: var(--color-accent);
  box-shadow: inset 0 0 0 1px var(--color-accent-strong);
  color: var(--color-on-accent);
}
.slot-option[aria-pressed="true"] .slot-option-left { color: var(--color-on-accent); }
.slot-option:disabled { border-color: var(--color-border); background: var(--color-surface-muted); color: var(--color-text-muted); cursor: not-allowed; }
.slot-grid[aria-invalid="true"] { padding: var(--space-2); border: 1px solid var(--color-danger); border-radius: var(--radius-md); }

.product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(110px, auto);
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.product-row:last-child { border-bottom: 0; }
.product-info { min-width: 0; }
.product-name { font-weight: var(--weight-semibold); }
.product-meta { color: var(--color-text-muted); }
.product-unavailable { display: flex; align-items: center; gap: var(--space-1); color: var(--color-text-muted); }
.product-row.is-unavailable .product-name { color: var(--color-text-muted); }
.product-line { font-weight: var(--weight-semibold); }
.product-error { grid-column: 1 / -1; }
.stepper { display: inline-flex; align-items: center; gap: var(--space-1); }
.stepper-btn { width: 44px; min-height: 44px; padding: 0; }
.stepper-input { width: 64px; min-height: 44px; text-align: center; font-variant-numeric: tabular-nums; }

.summary-panel .facts { margin-top: var(--space-3); }
.summary-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-weight: var(--weight-semibold);
}
.summary-total strong { font-size: var(--text-xl); line-height: var(--leading-figure); font-variant-numeric: tabular-nums; }
.summary-warning { display: flex; align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-3); color: var(--color-warning); }
.summary-panel .field-help { margin-top: var(--space-3); }

@media (min-width: 1100px) {
  .new-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .new-aside { position: sticky; top: calc(var(--topbar-offset, var(--topbar-height)) + var(--space-4)); }
}
@media (max-width: 599px) {
  .product-row { grid-template-columns: minmax(0, 1fr) auto; }
  .product-info { grid-column: 1 / -1; }
}

/* Booking detail: header, columns, payment tabs, QR, cash, ticket, attention, invoice, cancel */
.booking-heading { min-width: 0; }
.booking-code { font-size: var(--text-xl); }
.booking-badges { margin-top: var(--space-2); }
.hold-line { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); color: var(--color-warning); font-weight: var(--weight-semibold); }
.hold-line--over { color: var(--color-text-muted); font-weight: var(--weight-medium); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-items: start; margin-top: var(--space-5); }
.detail-main, .detail-aside { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.detail-main > .section, .detail-aside > .section { margin-top: 0; }
@media (min-width: 1200px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
}

.pay-total { font-size: var(--text-lg); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: var(--space-1); margin-bottom: var(--space-4); overflow-x: auto; border-bottom: 1px solid var(--color-border); }
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.tab:hover { background: var(--color-surface-muted); color: var(--color-text); }
.tab[aria-selected="true"] { border-bottom-color: var(--color-accent-strong); color: var(--color-navy); }
.tab-panel:focus-visible { outline-offset: 4px; }

.qr-image { display: block; max-width: 100%; height: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.qr-image--large { width: 320px; }
.qr-pay { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-5); }
.qr-pay-info { display: flex; flex: 1 1 240px; flex-direction: column; gap: var(--space-3); min-width: 0; }
.qr-amount { font-size: var(--text-2xl); font-weight: var(--weight-bold); line-height: var(--leading-figure); font-variant-numeric: tabular-nums; }
.wait-line { display: flex; align-items: center; gap: var(--space-2); color: var(--color-info); }
.qr-start { display: flex; flex-direction: column; gap: var(--space-4); max-width: 640px; }
.copy-field { margin-top: var(--space-5); }

.cash-form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 420px; }
.cash-total { font-size: var(--text-lg); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.input--amount { max-width: 280px; font-size: var(--text-lg); font-variant-numeric: tabular-nums; text-align: right; }
.cash-change { font-size: var(--text-lg); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; color: var(--color-text-muted); }
.cash-change.is-short { color: var(--color-danger); }
.cash-change.is-ok { color: var(--color-success); }

.ticket {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-5);
  padding: var(--space-4);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.ticket-qr { width: 200px; }
.ticket-body { display: flex; flex: 1 1 240px; flex-direction: column; gap: var(--space-2); min-width: 0; }
.ticket-venue { color: var(--color-text-muted); font-weight: var(--weight-semibold); }
.ticket-code { font-size: var(--text-2xl); line-height: var(--leading-figure); letter-spacing: 0.04em; }
.ticket-note { color: var(--color-text-muted); }
.resend-form { margin-top: var(--space-4); }

.attention-panel { border-color: var(--color-danger-border); background: var(--color-danger-bg); }
.attention-head { display: flex; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); }
.attention-head > [data-lucide] { width: 24px; height: 24px; margin-top: 2px; color: var(--color-danger); }
.attention-note { color: var(--color-danger); font-weight: var(--weight-semibold); }

/* .invoice-adjusted: the read-back's note under an issued invoice's facts ("Đã thay thế bằng hóa đơn số …"), staff and
   guest pages alike. */
.invoice-actions, .invoice-error, .invoice-adjusted { margin-top: var(--space-3); }
/* The line "Kế toán (TRUSTA)" with its error and "Thử lại": a group of its own after the invoice's facts and PDF. */
.invoice-accounting { margin-top: var(--space-4); }
/* A provider error carries long unbroken URLs / JSON: let the text wrap anywhere instead of widening the panel. */
.invoice-error-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* The small copy button tucked into the alert's top-right corner, in the alert's own colour. */
.invoice-error-copy { width: 28px; height: 28px; min-height: 28px; margin: -4px -8px 0 0; padding: 0; color: inherit; }
.invoice-error-copy:hover { background: var(--color-surface); border-color: currentColor; }
.invoice-error-copy [data-lucide] { width: 16px; height: 16px; margin-top: 0; }
.invoice-retry { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.invoice-retry .subsection-title { margin-top: 0; }
.danger-zone { border-color: var(--color-danger-border); }
.danger-zone .muted { margin-bottom: var(--space-3); }

.table tfoot th, .table tfoot td { border-top: 1px solid var(--color-border); background: var(--color-surface-muted); font-weight: var(--weight-semibold); }
.table tfoot th { text-align: right; }
.table tfoot .total-row th, .table tfoot .total-row td { font-weight: var(--weight-bold); }

/* Resolve forms (booking detail, Needs attention) */
.resolve-form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 680px; }
.resolve-row > td { background: var(--color-surface-muted); }
.resolve-row:hover { background: transparent; }
.resolve-help { margin-bottom: var(--space-3); color: var(--color-text-muted); }

/* Audit log filter */
.field-action { flex: 0 1 280px; }

/* Customer display: a tablet turned towards the guest */
.display-body { background: var(--color-surface); }
.display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  min-height: 85vh;
  padding: var(--space-8) var(--space-4);
  text-align: center;
}
.display-head { display: flex; align-items: center; gap: var(--space-3); text-align: left; }
.display-venue { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.display-booking { color: var(--color-text-muted); font-size: var(--text-md); }
.display-amount { font-size: calc(var(--text-2xl) * 1.5); font-weight: var(--weight-bold); line-height: var(--leading-figure); font-variant-numeric: tabular-nums; }
.display-state { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); max-width: 640px; }
.display-qr { width: min(400px, 80vw, 55vh); }
.display-lead { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: var(--leading); }
.display-text { font-size: var(--text-lg); color: var(--color-text-muted); }
.display-countdown strong { color: var(--color-text); font-size: var(--text-xl); }
.display-icon { width: 96px; height: 96px; color: var(--color-text-muted); }
.display-state--paid .display-icon, .display-state--paid .display-lead { color: var(--color-success); }

/* Activate Station's display page (/display/, activate_station/display.html and js/display.js; HANDOVER §21): the
   guest-facing monitor of a counter PC, 800 × 1200 portrait (1280 high on the dev machine), read at arm's length
   across the counter. One column filling the window — head, the stage holding one scene, the idle layer over both —
   and nothing to touch: no cursor, no selection, no scrollbar (display.js cuts a line list too long for the screen,
   "+N dòng nữa"). Its sizes are the page's own tokens on .display-station (body text ≥ 24 px, line-height ≥ 1.3 for
   Vietnamese diacritics, the amount the largest text); colours, spacing and motion are :root's. Heights come from
   flex and vh only, never a fixed screen height. Scenes cross-fade in 200 ms (a view transition started by
   display.js); the one other change is a review value just typed, marked for a second (.is-changed, its fade off
   under prefers-reduced-motion by the Base block's rule). */
body.display-station-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; cursor: none; user-select: none; }
.display-station {
  --station-pad-x: var(--space-10);
  --station-gap: var(--space-6);
  --station-leading: 1.35;
  --station-label: 24px;              /* labels, the order code, secondary lines */
  --station-text: 26px;               /* body text, line rows */
  --station-value: 32px;              /* a review value, a row's amount */
  --station-lead: 40px;               /* the scene's sentence */
  --station-total: 60px;              /* review's total */
  --station-figure: 96px;             /* the amount: the largest text of the page */
  --station-icon: 88px;
  --station-narrow: 600px;            /* rows of figures in a centred scene */
  --station-qr: min(440px, 55vw, 38vh);
  --station-ticket-qr: min(400px, 50vw, 34vh);
  --station-poster-mark: min(240px, 30vw);
  --station-poster-wordmark: min(448px, 56vw);
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  font-size: var(--station-text);
  line-height: var(--station-leading);
}
.display-station-root::view-transition-old(root),
.display-station-root::view-transition-new(root) { animation-duration: var(--motion-base, 200ms); animation-timing-function: var(--ease-out); }
.display-station-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6) var(--station-pad-x);
  border-bottom: 1px solid var(--color-border);
}
.display-station-venue { min-width: 0; color: var(--color-text-muted); font-size: var(--station-label); font-weight: var(--weight-semibold); text-align: right; overflow-wrap: anywhere; }
.display-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.display-scene { display: flex; flex-direction: column; gap: var(--station-gap); height: 100%; overflow: hidden; padding: var(--space-8) var(--station-pad-x); }
.display-scene > * { flex-shrink: 0; }
.display-scene--center { align-items: center; justify-content: safe center; text-align: center; }
.display-scene--dense { gap: var(--space-4); padding-top: var(--space-6); padding-bottom: var(--space-6); }
.display-scene-lead { color: var(--color-navy); font-size: var(--station-lead); font-weight: var(--weight-semibold); line-height: var(--station-leading); text-wrap: balance; }
.display-scene-text { color: var(--color-text-muted); }
.display-scene-code { color: var(--color-text-muted); font-size: var(--station-label); }
.display-scene-code .code { color: var(--color-text); }
.display-station .display-scene-icon { width: var(--station-icon); height: var(--station-icon); color: var(--color-text-muted); }
.display-scene--paid .display-scene-icon, .display-scene--paid .display-scene-lead { color: var(--color-success); }
.display-subtitle { color: var(--color-text-muted); font-size: var(--station-label); font-weight: var(--weight-semibold); line-height: var(--station-leading); }
.display-block { display: flex; flex-direction: column; gap: var(--space-2); }

/* The amount: digits large, the unit small beside them (display.js), tabular figures */
.display-hero { display: flex; flex-direction: column; gap: var(--space-1); }
.display-scene--center .display-hero { align-items: center; }
.display-hero-label { color: var(--color-text-muted); font-size: var(--station-label); font-weight: var(--weight-semibold); }
.display-figure { display: flex; flex-wrap: wrap; align-items: baseline; color: var(--color-navy); font-size: min(var(--station-figure), 12vw); font-weight: var(--weight-bold); line-height: var(--leading-figure); font-variant-numeric: tabular-nums; }
.display-scene--center .display-figure { justify-content: center; }
.display-figure-num { white-space: nowrap; }
.display-figure-unit { margin-left: 0.2em; color: var(--color-text-muted); font-size: 0.4em; font-weight: var(--weight-semibold); }

/* review: a labelled list — label above, value large beneath, three columns as wide as their values (a long value
   gets a row of its own: --wide, or the rest of its row: --rest); the value just changed marked (.is-changed) */
.display-fields { display: grid; grid-template-columns: fit-content(40%) fit-content(40%) minmax(0, 1fr); gap: var(--space-3) var(--space-8); margin: 0; }
.display-field { display: flex; flex-direction: column; min-width: 0; }
.display-field--wide { grid-column: 1 / -1; }
.display-field--rest { grid-column: 2 / -1; }
.display-field dt { color: var(--color-text-muted); font-size: var(--station-label); }
.display-field dd {
  margin: 0 calc(-1 * var(--space-2));
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--station-value);
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
  transition: background-color var(--motion-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out);
}
.display-field dd.is-empty { color: var(--color-border-strong); font-weight: var(--weight-medium); }
.display-station .is-changed { background-color: var(--color-accent-soft); box-shadow: inset 4px 0 0 var(--color-accent-strong); }

/* Lines and totals */
.display-lines { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--color-border); }
.display-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  transition: background-color var(--motion-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out);
}
.display-line.is-changed { margin: 0 calc(-1 * var(--space-2)); padding-inline: var(--space-2); }
.display-line-name { min-width: 0; overflow-wrap: anywhere; }
.display-line-amount { flex: none; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.display-line--more { color: var(--color-text-muted); font-size: var(--station-label); }
.display-totals { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; }
.display-totals--narrow { width: 100%; max-width: var(--station-narrow); text-align: left; }
.display-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }
.display-total-row dt { min-width: 0; color: var(--color-text-muted); }
.display-total-row dd { margin: 0; font-size: var(--station-value); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.display-total-row--strong dt { color: var(--color-text); font-weight: var(--weight-semibold); }
.display-total-row--strong dd { color: var(--color-navy); font-weight: var(--weight-bold); }
.display-total-row--grand { align-items: center; padding-top: var(--space-3); border-top: 2px solid var(--color-navy); }
.display-total-row--grand dt { color: var(--color-text); font-size: var(--station-value); font-weight: var(--weight-semibold); }
.display-total-row--grand .display-figure { font-size: var(--station-total); }
.display-total-note:not(:empty)::before { content: "· "; }

/* The instruction of a scene, and the e-voucher's OTP hint: an info callout */
.display-callout {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-lg);
  background: var(--color-info-bg);
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  text-align: left;
}
.display-callout--lead { font-size: var(--station-value); }
.display-callout strong { overflow-wrap: anywhere; }
.display-station .display-callout [data-lucide] { width: var(--station-value); height: var(--station-value); margin-top: 0.2em; color: var(--color-info); }
.display-callout-body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.display-callout-label { color: var(--color-text-muted); font-weight: var(--weight-medium); }

/* QR scene (its states as today's customer display) and the paid scene's ticket QR */
.display-qr-part { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.display-scene-qr { width: var(--station-qr); height: auto; aspect-ratio: 1; background: var(--color-surface); }
.display-countdown-line [data-countdown-text] { color: var(--color-text); font-size: var(--station-value); }
.display-ticket { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); margin: 0; }
.display-ticket-qr { width: var(--station-ticket-qr); height: auto; aspect-ratio: 1; background: var(--color-surface); }

/* Idle: the promo clip letterboxed on navy (never cropped), or the brand poster — the wordmark turned white */
.display-idle { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; background: var(--color-navy); }
.display-video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--color-navy); }
.display-poster { display: flex; flex-direction: column; align-items: center; gap: var(--space-10); }
.display-poster-mark { width: var(--station-poster-mark); height: auto; }
.display-poster-wordmark { width: var(--station-poster-wordmark); height: auto; filter: brightness(0) invert(1); }

/* Print: the daily report's heading line */
@media print {
  .print-only { display: block; }
  .print-head { margin-bottom: var(--space-3); font-weight: var(--weight-semibold); }
  .report-section { margin-top: var(--space-4); }
  .table-wrap { overflow: visible; }
}
