/* ==========================================================================
   Quang Bách · hungbm — shared tokens + components for the Phase 3 mockups.
   Every screen (S1–S19) links this file. The first :root block is a 1:1 copy
   of docs/hungbm/DESIGN_SYSTEM.json. The second block only DERIVES values
   from those tokens (color-mix) where WCAG AA needs a darker ink or a soft
   tint; no new hues are introduced. Page-specific layout lives in each
   page's own <style> block.
  Palette re-derived 2026-10-02 from the Quang Bách logo (logo blue #4BC3EE); see docs/hungbm/ARCHITECTURE.md AD-34.
   ========================================================================== */

:root {
  /* colors (DESIGN_SYSTEM.json → colors) */
  --primary: #083A5E;
  --primary-hover: #0C4C78;
  --accent: #4BC3EE;
  --accent-hover: #1E9BD0;
  --warning: #F97316;
  --warning-hover: #EA580C;
  --success: #10B981;
  --error: #EF4444;
  --bg: #FFFFFF;
  --bg-2: #F8FAFC;              /* backgroundSecondary */
  --surface: #FFFFFF;
  --surface-hover: #F1F5F9;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --text: #0F172A;
  --text-2: #64748B;            /* textSecondary, 4.8:1 on white */
  --text-muted: #94A3B8;        /* decorative / disabled only, never meaningful text */
  --text-inverse: #F8FAFC;

  /* typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;
  --fs-4xl: 2.25rem;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --lh-tight: 1.25;
  --lh-normal: 1.5;
  --lh-relaxed: 1.75;

  /* spacing (unit 8) */
  --sp-xs: 0.25rem;
  --sp-sm: 0.5rem;
  --sp-md: 1rem;
  --sp-lg: 1.5rem;
  --sp-xl: 2rem;
  --sp-2xl: 3rem;

  /* radius */
  --r-sm: 0.25rem;
  --r-md: 0.5rem;
  --r-lg: 0.75rem;
  --r-xl: 1rem;
  --r-full: 9999px;

  /* shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  /* components */
  --btn-h-sm: 2rem;
  --btn-h-md: 2.5rem;
  --btn-h-lg: 3rem;
  --btn-min-w: 48px;
  --btn-px-sm: 0.75rem;
  --btn-px-md: 1rem;
  --btn-px-lg: 1.5rem;
  --input-h-sm: 2rem;
  --input-h-md: 2.5rem;
  --input-h-lg: 3rem;
  --input-px: 0.75rem;
  --card-pad: 1rem;
  --card-radius: 0.5rem;

  /* layout */
  --header-h: 4rem;
  --sidebar-w: 16rem;
  --bottom-nav-h: 4rem;
  --container: 1280px;
  --touch: 48px;
}

/* Derived tokens: tints + AA-safe inks mixed from the palette above ------- */
:root {
  --sp-3q: calc(var(--sp-sm) + var(--sp-xs));   /* 12px half-step */
  --sp-5q: calc(var(--sp-md) + var(--sp-xs));   /* 20px half-step */

  --border-strong: color-mix(in srgb, var(--text-2) 78%, white);   /* 3:1 control border (WCAG 1.4.11) */
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent);

  --accent-ink:  color-mix(in srgb, var(--accent) 35%, var(--primary));
  --accent-soft: color-mix(in srgb, var(--accent) 12%, white);
  --accent-line: color-mix(in srgb, var(--accent) 45%, white);

  --success-ink:  color-mix(in srgb, var(--success) 55%, var(--text));
  --success-soft: color-mix(in srgb, var(--success) 10%, white);
  --success-line: color-mix(in srgb, var(--success) 38%, white);

  --warning-ink:  color-mix(in srgb, var(--warning) 62%, var(--text));
  --warning-soft: color-mix(in srgb, var(--warning) 10%, white);
  --warning-line: color-mix(in srgb, var(--warning) 40%, white);

  --error-ink:  color-mix(in srgb, var(--error) 70%, var(--text));
  --error-soft: color-mix(in srgb, var(--error) 8%, white);
  --error-line: color-mix(in srgb, var(--error) 38%, white);

  --navy-soft: color-mix(in srgb, var(--primary) 6%, white);
  --navy-line: color-mix(in srgb, var(--primary) 22%, white);

  /* sidebar shades of primary */
  --side-bg: var(--primary);
  --side-2: var(--primary-hover);
  --side-line: color-mix(in srgb, var(--text-inverse) 10%, var(--primary));
  --side-text: color-mix(in srgb, var(--text-inverse) 78%, var(--primary));
  --side-dim: color-mix(in srgb, var(--text-inverse) 62%, var(--primary));
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); font-size: var(--fs-sm); line-height: var(--lh-normal);
  color: var(--text); background: var(--bg-2);
  font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: var(--fw-bold); letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-base); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--text); text-decoration-color: var(--accent-hover); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-md) 0; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); }

.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; flex: none; }
.i-sm { width: 15px; height: 15px; vertical-align: -2px; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 28px; height: 28px; }

/* ---------- Utilities ---------- */
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); white-space: nowrap; letter-spacing: -0.01em; }
.money-strong { font-weight: var(--fw-bold); }
.money-neg { color: var(--error-ink); }
.money-pos { color: var(--success-ink); }
.money-warn { color: var(--warning-ink); }
.muted { color: var(--text-2); }
.xs { font-size: var(--fs-xs); }
.sm { font-size: var(--fs-sm); }
.strong { font-weight: var(--fw-semibold); }
.bold { font-weight: var(--fw-bold); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; align-items: center; gap: var(--sp-sm); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-sm); }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: var(--sp-3q); }
.stack-sm > * + * { margin-top: var(--sp-sm); }
.stack-lg > * + * { margin-top: var(--sp-lg); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-md); }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-md); }
.mt-0 { margin-top: 0 !important; }
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.eyebrow { font-size: 0.6875rem; font-weight: var(--fw-bold); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }

/* Codes: long ERP codes, last 6 digits emphasised (what people actually read) */
.code { font-family: var(--mono); font-size: 0.86em; color: var(--text-2); letter-spacing: -0.01em; white-space: nowrap; }
.code b { color: var(--text); font-weight: 700; }
.kbd { font-family: var(--mono); font-size: 0.8em; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--r-sm); background: var(--surface); }

/* Live indicator (real-time principle) */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--accent-ink); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-hover); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: live 1.8s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-sm);
  min-height: var(--btn-h-md); min-width: var(--btn-min-w); padding: 0 var(--btn-px-md);
  font-weight: var(--fw-semibold); font-size: var(--fs-sm); line-height: 1.2;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { background: var(--surface-hover); color: var(--text-muted); border-color: var(--border); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--text-inverse); }
.btn-accent { background: var(--accent); border-color: var(--accent-hover); color: var(--primary); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--text); }
.btn-success { background: var(--success-ink); border-color: var(--success-ink); color: #fff; }
.btn-success:hover { background: color-mix(in srgb, var(--success) 45%, var(--text)); color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning-hover); color: var(--primary); }
.btn-warning:hover { background: var(--warning-hover); color: var(--primary); }
.btn-danger { color: var(--error-ink); border-color: var(--error-line); }
.btn-danger:hover { background: var(--error-soft); border-color: var(--error); color: var(--error-ink); }
.btn-danger-solid { background: var(--error-ink); border-color: var(--error-ink); color: #fff; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--error) 55%, var(--text)); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); border-color: transparent; color: var(--text); }
.btn-link { background: none; border: 0; min-height: 0; min-width: 0; padding: 0; color: var(--text); text-decoration: underline; text-decoration-color: var(--accent-hover); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.btn-link:hover { background: none; text-decoration-color: var(--primary); }
.btn-sm { min-height: var(--btn-h-sm); padding: 0 var(--btn-px-sm); font-size: var(--fs-xs); min-width: 0; }
.btn-lg { min-height: var(--btn-h-lg); padding: 0 var(--btn-px-lg); font-size: var(--fs-base); border-radius: var(--r-lg); }
.btn-xl { min-height: 3.5rem; padding: 0 var(--btn-px-lg); font-size: var(--fs-lg); border-radius: var(--r-lg); font-weight: var(--fw-bold); }
.btn-block { display: flex; width: 100%; white-space: normal; text-align: center; padding-top: 6px; padding-bottom: 6px; }
.btn-icon { padding: 0; width: var(--btn-h-md); }
.btn-icon.btn-sm { width: var(--btn-h-sm); }
.btn .count { font-size: 11px; padding: 0 6px; border-radius: var(--r-full); background: var(--accent); color: var(--primary); font-weight: 700; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); }
.label .opt { font-weight: var(--fw-normal); color: var(--text-2); }
.req::after { content: " *"; color: var(--error-ink); }
.hint { font-size: var(--fs-xs); color: var(--text-2); }
.field-error { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--error-ink); }
.field-error .i { width: 15px; height: 15px; margin-top: 1px; }
.input, .select, .textarea {
  width: 100%; min-height: var(--input-h-md); padding: 0 var(--input-px);
  font-size: var(--fs-sm); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color .12s, box-shadow .12s;
}
.textarea { padding: 10px var(--input-px); min-height: 5rem; resize: vertical; line-height: var(--lh-normal); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.input::placeholder, .textarea::placeholder { color: var(--text-2); opacity: .8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.input[readonly], .input:disabled, .select:disabled { background: var(--surface-hover); color: var(--text-2); cursor: not-allowed; }
.is-invalid, .input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--error) !important; box-shadow: inset 0 0 0 1px var(--error); background: var(--error-soft); }
.input-lg, .select-lg { min-height: var(--input-h-lg); font-size: var(--fs-base); }
.input-sm, .select-sm { min-height: var(--input-h-sm); font-size: var(--fs-xs); }
.input-money { text-align: right; font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); }
.input-group { display: flex; align-items: stretch; }
.input-group > .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-addon { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; background: var(--surface-hover); color: var(--text-2); font-weight: var(--fw-semibold); border-radius: 0 var(--r-md) var(--r-md) 0; white-space: nowrap; }
.search { position: relative; }
.search > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.search > .input { padding-left: 38px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-md); }
.form-grid .span-2 { grid-column: 1 / -1; }
fieldset.fs { border: 0; padding: 0; margin-inline: 0; margin-bottom: 0; min-width: 0; }
fieldset.fs > legend { padding: 0; margin-bottom: 8px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-hover); border: 1px solid var(--border); border-radius: var(--r-md); }
.seg button, .seg a { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border: 0; border-radius: calc(var(--r-md) - 2px); background: none; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-2); cursor: pointer; text-decoration: none; white-space: nowrap; }
.seg button:hover, .seg a:hover { color: var(--text); }
.seg .is-active, .seg [aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

/* Filter chips (with counts) */
.fchips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.fchips::-webkit-scrollbar { display: none; }
.fchip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface); color: var(--text); font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap; cursor: pointer; text-decoration: none; }
.fchip:hover { border-color: var(--text-2); }
.fchip .n { min-width: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--surface-hover); font-size: 11px; text-align: center; color: var(--text-2); }
.fchip.is-active { background: var(--primary); border-color: var(--primary); color: var(--text-inverse); }
.fchip.is-active .n { background: var(--accent); color: var(--primary); }
.fchip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 24px; border-radius: var(--r-full); background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--accent); }
.switch input:focus-visible + .track { box-shadow: var(--focus-ring); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3q); padding: var(--sp-3q) var(--card-pad); border-bottom: 1px solid var(--border); min-height: 52px; }
.card-head h2, .card-head h3 { font-size: var(--fs-base); }
.card-head .sub { font-size: var(--fs-xs); color: var(--text-2); font-weight: var(--fw-normal); margin-top: 2px; }
.card-body { padding: var(--card-pad); }
.card-foot { padding: 10px var(--card-pad); border-top: 1px solid var(--border); background: var(--bg-2); border-radius: 0 0 var(--card-radius) var(--card-radius); font-size: var(--fs-xs); color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm); }
.card-flush .card-body { padding: 0; }
a.card { display: block; text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--text-2); }

/* ---------- KPI ---------- */
.kpi { position: relative; padding: var(--sp-md); background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--shadow-sm); min-width: 0; }
.kpi .eyebrow { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.kpi .eyebrow .i { width: 15px; height: 15px; color: var(--text-2); }
.kpi-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* KPI figures scale to their own tile so a 2-up phone grid never pushes amounts past the card edge. */
.kpi { container-type: inline-size; }
.kpi-value { font-size: clamp(1.0625rem, 14cqi, var(--fs-2xl)); white-space: normal; overflow-wrap: anywhere; }
.kpi-value small { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); margin-left: 2px; letter-spacing: 0; }
.kpi-sub { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.kpi-accent { border-top: 3px solid var(--accent); }
.kpi-warn { border-top: 3px solid var(--warning); }
.kpi-danger { border-top: 3px solid var(--error); }
.kpi-ok { border-top: 3px solid var(--success); }
.kpi-dark { background: var(--primary); border-color: var(--primary); color: var(--text-inverse); }
.kpi-dark .eyebrow, .kpi-dark .kpi-sub, .kpi-dark .eyebrow .i { color: var(--side-text); }
.kpi-dark .kpi-value small { color: var(--side-text); }
.on-dark-danger { color: color-mix(in srgb, var(--error) 62%, white); font-weight: var(--fw-semibold); }
a.kpi { display: block; text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--text-2); }
a.kpi.kpi-dark { color: var(--text-inverse); }
a.kpi.kpi-dark:hover { border-color: var(--accent-hover); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: var(--fw-bold); font-size: var(--fs-xs); }
.delta .i { width: 13px; height: 13px; }
.delta-up { color: var(--success-ink); }
.delta-down { color: var(--error-ink); }
.kpi-dark .delta-up { color: var(--success); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-2); font-size: 0.6875rem; font-weight: var(--fw-bold); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.tbl thead th .i { width: 12px; height: 12px; vertical-align: -1px; }
.tbl thead th.is-sorted { color: var(--text); }
.tbl tbody tr { transition: background-color .08s; }
.tbl tbody tr:hover td { background: var(--surface-hover); }
.tbl tbody tr.is-selected td { background: var(--accent-soft); }
.tbl tbody tr.is-flag td { background: var(--error-soft); }
.tbl tbody tr.is-flag td:first-child { box-shadow: inset 3px 0 0 var(--error); }
.tbl tbody tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--accent-hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot td { font-weight: var(--fw-bold); background: var(--bg-2); border-top: 2px solid var(--border-strong); border-bottom: 0; }
.tbl-compact th, .tbl-compact td { padding: 7px 10px; }
.tbl .cell-main { font-weight: var(--fw-semibold); display: block; }
.tbl .cell-sub { display: block; font-size: var(--fs-xs); color: var(--text-2); }
.tbl .center { text-align: center; }
.tbl .row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.clickable { cursor: pointer; }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: var(--fw-bold); font-size: var(--fs-xs); background: var(--surface-hover); color: var(--text-2); }
.rank-1 { background: var(--accent); color: var(--primary); }
.rank-2, .rank-3 { background: var(--primary); color: var(--text-inverse); }

/* ---------- Status badges (always icon + label, never colour alone) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 18px; border: 1px solid transparent; border-radius: var(--r-full); white-space: nowrap; }
.badge .i { width: 13px; height: 13px; vertical-align: 0; stroke-width: 2.4; }
.badge-lg { font-size: var(--fs-sm); padding: 4px 12px 4px 9px; }
.badge-lg .i { width: 16px; height: 16px; }
.tone-neutral { color: var(--text); background: var(--surface-hover); border-color: var(--border-strong); }
.tone-info    { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-line); }
.tone-success { color: var(--success-ink); background: var(--success-soft); border-color: var(--success-line); }
.tone-warning { color: var(--warning-ink); background: var(--warning-soft); border-color: var(--warning-line); }
.tone-danger  { color: var(--error-ink); background: var(--error-soft); border-color: var(--error-line); }
.tone-navy    { color: var(--primary); background: var(--navy-soft); border-color: var(--navy-line); }
.tone-muted   { color: var(--text-2); background: var(--bg-2); border-color: var(--border); }
.tone-muted span { text-decoration: line-through; }
.tone-solid-danger { color: #fff; background: var(--error-ink); border-color: var(--error-ink); }
.tone-solid-navy { color: var(--text-inverse); background: var(--primary); border-color: var(--primary); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; font-size: 11px; font-weight: var(--fw-semibold); border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); white-space: nowrap; }
.tag-daily::before, .tag-monthly::before { content: ""; width: 6px; height: 6px; border-radius: 1px; }
.tag-daily::before { background: var(--accent-hover); }
.tag-monthly::before { background: var(--primary); }
.tag-overdue { color: var(--error-ink); background: var(--error-soft); border-color: var(--error-line); }

/* Role chips */
.role { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; font-size: 11px; font-weight: var(--fw-bold); letter-spacing: .02em; border-radius: var(--r-sm); white-space: nowrap; }
.role::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.role-admin { background: var(--primary); color: var(--accent); }
.role-accountant { background: var(--accent-soft); color: var(--accent-ink); }
.role-manager { background: var(--navy-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--navy-line); }
.role-delivery { background: var(--warning-soft); color: var(--warning-ink); }
.role-sales { background: var(--success-soft); color: var(--success-ink); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: var(--sp-3q); align-items: flex-start; padding: var(--sp-3q) var(--sp-md); border: 1px solid; border-left-width: 4px; border-radius: var(--r-md); font-size: var(--fs-sm); }
.alert > .i { margin-top: 1px; }
.alert strong { font-weight: var(--fw-bold); }
.alert .alert-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.alert .alert-actions { display: flex; gap: var(--sp-sm); flex-wrap: wrap; margin-top: 6px; }
.alert-info    { background: var(--accent-soft); border-color: var(--accent-line); border-left-color: var(--accent-hover); color: var(--text); }
.alert-info > .i { color: var(--accent-ink); }
.alert-success { background: var(--success-soft); border-color: var(--success-line); border-left-color: var(--success); color: var(--text); }
.alert-success > .i { color: var(--success-ink); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-line); border-left-color: var(--warning); color: var(--text); }
.alert-warning > .i { color: var(--warning-ink); }
.alert-danger  { background: var(--error-soft); border-color: var(--error-line); border-left-color: var(--error); color: var(--text); }
.alert-danger > .i { color: var(--error-ink); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs [role="tab"], .tabs > a { display: inline-flex; align-items: center; gap: 7px; padding: 11px 12px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); cursor: pointer; white-space: nowrap; text-decoration: none; }
.tabs [role="tab"]:hover, .tabs > a:hover { color: var(--text); }
.tabs [aria-selected="true"], .tabs > a.is-active { color: var(--text); border-bottom-color: var(--accent-hover); }
.tabs .n { font-size: 11px; padding: 0 7px; border-radius: var(--r-full); background: var(--surface-hover); color: var(--text-2); }
.tabs [aria-selected="true"] .n { background: var(--primary); color: var(--text-inverse); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-sm); align-items: flex-end; padding: var(--sp-3q) var(--card-pad); border-bottom: 1px solid var(--border); background: var(--surface); }
.toolbar .field { min-width: 150px; }
.toolbar .field .label { font-size: var(--fs-xs); color: var(--text-2); }
.toolbar .search { flex: 1; min-width: 240px; }
.toolbar .spacer { flex: 1; }

/* ---------- Bars / meters ---------- */
.hbar { height: 8px; background: var(--surface-hover); border-radius: var(--r-full); overflow: hidden; }
.hbar > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.hbar-accent > span { background: var(--accent-hover); }
.hbar-warn > span { background: var(--warning); }
.hbar-ok > span { background: var(--success); }
.hbar-danger > span { background: var(--error); }
.stackbar { display: flex; height: 10px; border-radius: var(--r-full); overflow: hidden; gap: 2px; background: var(--surface); }
.stackbar > span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.ring { --p: 0; --c: var(--success); width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-hover) 0); display: grid; place-items: center; flex: none; }
.ring::after { content: attr(data-label); width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: var(--fs-xs); font-weight: var(--fw-bold); }

/* Column chart (pure CSS) */
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: 10px; height: 180px; padding: 0 4px; border-bottom: 1px solid var(--border-strong); background-image: linear-gradient(var(--border-light) 1px, transparent 1px); background-size: 100% 45px; }
.cols .col { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; height: 100%; position: relative; }
.cols .col .bar { border-radius: 4px 4px 0 0; background: var(--primary); min-height: 2px; position: relative; }
.cols .col .bar.b2 { background: var(--accent-hover); border-radius: 0; }
.cols .col .v { font-size: 11px; font-weight: var(--fw-bold); text-align: center; margin-bottom: 4px; color: var(--text); }
.cols .col.is-today .bar { background: var(--accent); box-shadow: inset 0 0 0 2px var(--accent-hover); }
.cols-x { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; padding: 6px 4px 0; font-size: 11px; color: var(--text-2); text-align: center; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--primary) 50%, transparent); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .15s; }
.overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 90; box-shadow: var(--shadow-xl); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.drawer.is-open { transform: none; }
.overlay, .drawer, .modal { margin: 0; }
.drawer:focus, .modal:focus { outline: none; box-shadow: var(--shadow-xl); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: var(--sp-md) var(--sp-lg); border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow: auto; padding: var(--sp-lg); }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: var(--sp-3q) var(--sp-lg); border-top: 1px solid var(--border); background: var(--bg-2); }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-xl); z-index: 95; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.modal.is-open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.modal-head { padding: var(--sp-lg) var(--sp-lg) var(--sp-sm); display: flex; gap: var(--sp-3q); align-items: flex-start; }
.modal-head .m-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.modal-body { padding: var(--sp-sm) var(--sp-lg) var(--sp-md); color: var(--text); }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: var(--sp-3q) var(--sp-lg); border-top: 1px solid var(--border); background: var(--bg-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- Toast ---------- */
.toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--primary); color: var(--text-inverse); border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-weight: var(--fw-medium); max-width: min(520px, calc(100vw - 32px)); animation: toastIn .18s ease; pointer-events: auto; }
.toast .i { color: var(--accent); }
.toast-danger .i { color: var(--error); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: var(--sp-2xl) var(--sp-lg); color: var(--text-2); display: grid; justify-items: center; gap: 6px; }
.empty .empty-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-hover); display: grid; place-items: center; color: var(--text-2); margin-bottom: 6px; }
.empty .empty-ico .i { width: 26px; height: 26px; }
.empty strong { color: var(--text); font-size: var(--fs-base); }
.empty p { max-width: 36ch; }
.skeleton { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-hover) 0%, var(--border-light) 40%, var(--surface-hover) 80%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Definition list ---------- */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--text-2); font-size: var(--fs-sm); }
.dl dd { margin: 0; font-weight: var(--fw-medium); min-width: 0; }

/* ---------- Avatar ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: var(--fw-bold); background: var(--navy-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--navy-line); flex: none; }
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who > div { min-width: 0; line-height: 1.3; }

/* ---------- Timeline ---------- */
.timeline { position: relative; display: grid; gap: var(--sp-md); padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; }
.tl-dot { position: absolute; left: -26px; top: 1px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-2); }
.tl-dot .i { width: 11px; height: 11px; stroke-width: 3; }
.tl-dot.ok { background: var(--success-ink); border-color: var(--success-ink); color: #fff; }
.tl-dot.info { background: var(--accent); border-color: var(--accent-hover); color: var(--primary); }
.tl-dot.warn { background: var(--warning); border-color: var(--warning-hover); color: var(--primary); }
.tl-dot.danger { background: var(--error-ink); border-color: var(--error-ink); color: #fff; }
.tl-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.tl-time { font-size: var(--fs-xs); color: var(--text-2); }
.tl-note { margin-top: 4px; padding: 8px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-md); font-size: var(--fs-sm); }

/* ---------- Receipt photo thumbnail (bank app screenshot mock) ---------- */
.shot { --bank: #0B6E4F; position: relative; width: 132px; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); font-family: var(--font); color: #1a1a1a; flex: none; }
.shot-top { background: var(--bank); color: #fff; padding: 8px 8px 22px; font-size: 7px; font-weight: 700; letter-spacing: .02em; }
.shot-top span { display: block; font-size: 6px; font-weight: 500; opacity: .85; }
.shot-ok { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid var(--bank); color: var(--bank); display: grid; place-items: center; margin: -15px auto 4px; position: relative; }
.shot-ok svg { width: 14px; height: 14px; stroke-width: 3.5; }
.shot-title { text-align: center; font-size: 7.5px; font-weight: 700; color: var(--bank); }
.shot-amt { text-align: center; font-size: 12px; font-weight: 800; margin: 2px 0 6px; letter-spacing: -0.02em; }
.shot-rows { padding: 0 8px; display: grid; gap: 3px; font-size: 5.6px; line-height: 1.3; }
.shot-rows div { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px dashed #ddd; padding-bottom: 2px; }
.shot-rows b { font-weight: 700; text-align: right; }
.shot-lg { width: 200px; }
.shot-lg .shot-top { font-size: 10px; padding: 12px 12px 30px; }
.shot-lg .shot-top span { font-size: 8.5px; }
.shot-lg .shot-ok { width: 38px; height: 38px; margin-top: -21px; }
.shot-lg .shot-ok svg { width: 20px; height: 20px; }
.shot-lg .shot-title { font-size: 11px; }
.shot-lg .shot-amt { font-size: 18px; }
.shot-lg .shot-rows { font-size: 8.4px; gap: 5px; padding: 0 12px; }
.shot-edited { filter: saturate(1.25) brightness(1.04) contrast(1.05); }
.shot-crop { clip-path: inset(6% 0 4% 0 round 10px); }
.shot-tag { position: absolute; top: 6px; right: 6px; font-size: 9px; font-weight: 800; padding: 1px 6px; border-radius: var(--r-full); background: var(--primary); color: var(--accent); }

/* Photo slot / camera capture */
.photo-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; padding: var(--sp-md); border: 2px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--bg-2); color: var(--text); font-weight: var(--fw-semibold); cursor: pointer; text-align: center; width: 100%; }
.photo-slot:hover { border-color: var(--primary); background: var(--accent-soft); }
.photo-slot .i { width: 30px; height: 30px; color: var(--primary); }
.photo-slot small { font-weight: var(--fw-normal); color: var(--text-2); font-size: var(--fs-xs); }
.photo-slot.is-invalid { border-color: var(--error); background: var(--error-soft); }

/* ==========================================================================
   Desktop shell (kế toán / quản lý / admin — ≥1024px)
   ========================================================================== */
.a-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.a-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: var(--side-2) transparent; }
.a-brand { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: var(--header-h); border-bottom: 1px solid var(--side-line); text-decoration: none; color: var(--text-inverse); flex: none; }
.a-brand strong { display: block; font-size: var(--fs-base); letter-spacing: -0.01em; }
.a-brand small { display: block; color: var(--side-dim); font-size: 11px; line-height: 1.3; }
.mark { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--accent); color: var(--primary); display: grid; place-items: center; flex: none; position: relative; }
.mark svg { width: 22px; height: 22px; stroke-width: 2.2; }
.mark--logo { background: #fff; }
.mark--logo img { width: 30px; height: auto; display: block; }
.a-nav { padding: 12px 12px 16px; flex: 1; }
.a-nav-group + .a-nav-group { margin-top: 18px; }
.a-nav-label { padding: 0 10px 6px; font-size: 10.5px; font-weight: var(--fw-bold); letter-spacing: .1em; text-transform: uppercase; color: var(--side-dim); }
.a-nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 0 10px; min-height: 40px; margin: 1px 0; color: var(--side-text); text-decoration: none; border-radius: var(--r-md); font-weight: var(--fw-medium); font-size: var(--fs-sm); }
.a-nav a .i { color: var(--side-dim); }
.a-nav a:hover { background: var(--side-2); color: var(--text-inverse); }
.a-nav a:hover .i { color: var(--text-inverse); }
.a-nav a.is-active { background: var(--side-2); color: var(--text-inverse); font-weight: var(--fw-semibold); }
.a-nav a.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.a-nav a.is-active .i { color: var(--accent); }
.a-nav a .pill { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: var(--r-full); font-size: 11px; font-weight: var(--fw-bold); text-align: center; background: var(--side-line); color: var(--text-inverse); }
.a-nav a .pill-alert { background: var(--error); color: #fff; }
.a-nav a .pill-accent { background: var(--accent); color: var(--primary); }
.a-side-foot { padding: 12px 14px; border-top: 1px solid var(--side-line); display: flex; align-items: center; gap: 10px; }
.a-side-foot .avatar { background: var(--side-2); color: var(--accent); box-shadow: none; }
.a-side-foot .who-t { flex: 1; min-width: 0; line-height: 1.3; }
.a-side-foot .who-t strong { display: block; color: var(--text-inverse); font-size: var(--fs-sm); }
.a-side-foot .who-t small { color: var(--side-dim); font-size: 11px; }
.a-side-foot a { color: var(--side-dim); display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md); }
.a-side-foot a:hover { color: var(--text-inverse); background: var(--side-2); }
.a-side-foot button { color: var(--side-dim); display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md); background: none; border: 0; cursor: pointer; flex: none; }
.a-side-foot button:hover { color: var(--text-inverse); background: var(--side-2); }
.a-side-foot .spinner { color: var(--text-inverse); }

.a-main { min-width: 0; display: flex; flex-direction: column; }
.a-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--sp-md); padding: 0 var(--sp-xl); height: var(--header-h); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); min-width: 0; flex: 1; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs .i { width: 14px; height: 14px; color: var(--text-muted); }
.crumbs > :last-child { color: var(--text); font-weight: var(--fw-semibold); }
.a-top .search { width: 300px; }
.a-top .search .input { min-height: 36px; background: var(--bg-2); }
.a-top-btn { position: relative; width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; color: var(--text-2); border: 1px solid transparent; background: none; cursor: pointer; }
.a-top-btn:hover { background: var(--surface-hover); color: var(--text); }
.a-top-btn .dot { position: absolute; top: 7px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-full); background: var(--error-ink); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }

.page { padding: var(--sp-lg) var(--sp-xl) var(--sp-2xl); max-width: var(--container); width: 100%; }
.page-wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-md); margin-bottom: var(--sp-lg); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-2xl); }
.page-head .sub { margin-top: 6px; color: var(--text-2); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.page-actions { display: flex; gap: var(--sp-sm); flex-wrap: wrap; align-items: center; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: var(--sp-lg) 0 var(--sp-3q); }
.section-title h2 { font-size: var(--fs-base); }

@media (max-width: 1180px) {
  .a-shell { grid-template-columns: 216px minmax(0, 1fr); }
  .a-brand small { display: none; }
  .a-nav a { font-size: 13px; }
  .page { padding: var(--sp-md) var(--sp-lg) var(--sp-2xl); }
  .a-top { padding: 0 var(--sp-lg); }
  .a-top .search { width: 220px; }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Phone stage (nhân viên giao hàng — 375–430px). On a desktop screen the
   mockup shows inside a 390×844 frame with review notes beside it; on a
   real phone (<520px) the frame disappears and the app goes full-bleed.
   ========================================================================== */
body.stage { background: radial-gradient(1200px 600px at 30% -10%, color-mix(in srgb, var(--accent) 14%, var(--bg-2)), var(--bg-2)); }
.stage-wrap { display: flex; gap: var(--sp-2xl); align-items: flex-start; justify-content: center; padding: var(--sp-xl) var(--sp-lg) var(--sp-2xl); min-height: 100vh; }
.phone { --ph-w: 390px; position: relative; width: var(--ph-w); height: 844px; flex: none; border-radius: 48px; background: var(--primary); padding: 12px; box-shadow: var(--shadow-xl), 0 0 0 1px var(--primary-hover), inset 0 0 0 2px color-mix(in srgb, var(--text-inverse) 12%, var(--primary)); }
.phone-screen { position: relative; width: 100%; height: 100%; border-radius: 38px; overflow: hidden; background: var(--bg-2); display: flex; flex-direction: column; font-size: var(--fs-base); }
.ph-status { flex: none; height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px 0 32px; font-size: 14px; font-weight: 700; background: var(--primary); color: var(--text-inverse); position: relative; }
.ph-status::after { content: ""; position: absolute; left: 50%; top: 10px; transform: translateX(-50%); width: 110px; height: 30px; border-radius: 20px; background: #000; }
.ph-status .ph-sys { display: flex; gap: 5px; align-items: center; }
.ph-status .ph-sys svg { width: 16px; height: 16px; }
.ph-top { flex: none; display: flex; align-items: center; gap: 4px; min-height: 60px; padding: 4px 8px 8px; background: var(--primary); color: var(--text-inverse); }
.ph-top h1 { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-top h1 small { display: block; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--side-text); }
.ph-top h1.pad { padding-left: 10px; }
.ph-iconbtn { width: var(--touch); height: var(--touch); display: grid; place-items: center; border-radius: var(--r-lg); color: var(--text-inverse); text-decoration: none; background: none; border: 0; cursor: pointer; position: relative; }
.ph-iconbtn:hover { background: var(--side-2); }
.ph-iconbtn .i { width: 24px; height: 24px; }
.ph-iconbtn .dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--primary); }
.ph-body { flex: 1; overflow-y: auto; padding: var(--sp-md) var(--sp-md) var(--sp-lg); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.ph-body::-webkit-scrollbar { display: none; }
.ph-head-ext { background: var(--primary); color: var(--text-inverse); padding: 0 var(--sp-md) var(--sp-md); flex: none; }
.ph-actionbar { flex: none; background: var(--surface); border-top: 1px solid var(--border); padding: 12px var(--sp-md) 14px; box-shadow: 0 -8px 20px rgba(15, 23, 42, .06); }
.ph-nav { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: calc(var(--bottom-nav-h) + 14px); padding-bottom: 14px; background: var(--surface); border-top: 1px solid var(--border); }
.ph-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: var(--fw-semibold); color: var(--text-2); text-decoration: none; }
.ph-nav a .i { width: 24px; height: 24px; }
.ph-nav a.is-active { color: var(--text); }
.ph-nav a.is-active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent-hover); }
.ph-nav a.is-active .i { color: var(--primary); stroke-width: 2.4; }
.ph-nav a .badge-n { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--error-ink); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.ph-home { position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%); width: 134px; height: 5px; border-radius: 3px; background: var(--primary); opacity: .9; z-index: 5; }
.ph-sheet-scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--primary) 50%, transparent); z-index: 40; }
.ph-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px var(--sp-md) 28px; box-shadow: var(--shadow-xl); max-height: 86%; overflow-y: auto; }
.ph-sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 12px; }
.ph-toast { position: absolute; left: 12px; right: 12px; bottom: 150px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--primary); color: var(--text-inverse); font-size: var(--fs-sm); font-weight: var(--fw-semibold); box-shadow: var(--shadow-lg); }
.ph-toast .i { color: var(--accent); }

/* stage notes (reviewer context, beside the phone) */
.stage-notes { width: 360px; flex: none; position: sticky; top: var(--sp-xl); display: grid; gap: var(--sp-md); }
.stage-notes .sn-screen { font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.stage-notes h1 { font-size: var(--fs-2xl); }
.stage-notes p { color: var(--text-2); }
.stage-notes .sn-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-md); box-shadow: var(--shadow-sm); font-size: var(--fs-sm); }
.stage-notes .sn-card h2 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); margin-bottom: 8px; }
.stage-notes ul { display: grid; gap: 6px; }
.stage-notes li { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: baseline; }
.stage-notes li .code { font-size: 11px; }
.stage-notes .sn-back { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--fw-semibold); font-size: var(--fs-sm); }

@media (max-width: 960px) { .stage-notes { display: none; } }
@media (max-width: 520px) {
  .stage-wrap { padding: 0; display: block; }
  .phone { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; padding: 0; box-shadow: none; }
  .phone-screen { border-radius: 0; }
  .ph-status, .ph-home { display: none; }
  .ph-top { padding-top: 8px; }
  .ph-nav { padding-bottom: 0; height: var(--bottom-nav-h); }
}

/* ---------- Mobile components ---------- */
.m-section { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: var(--sp-lg) 0 var(--sp-sm); }
.m-section h2 { font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.m-section a, .m-section button { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.m-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.m-card + .m-card { margin-top: 10px; }
.m-card-body { padding: 14px var(--sp-md); }
.m-row { display: flex; align-items: center; gap: 12px; padding: 12px var(--sp-md); min-height: 56px; border-bottom: 1px solid var(--border-light); color: inherit; text-decoration: none; }
.m-row:last-child { border-bottom: 0; }
a.m-row:hover { background: var(--surface-hover); }
.m-row .i { color: var(--text-2); }
.m-kv { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 6px 0; font-size: var(--fs-sm); }
.m-kv span:first-child { color: var(--text-2); }
.m-kv strong { font-variant-numeric: tabular-nums; }
.m-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px var(--sp-md); background: var(--primary); color: var(--text-inverse); border-radius: var(--r-lg); }
.m-total .lbl { font-weight: var(--fw-semibold); }
.m-total .lbl small { display: block; font-weight: var(--fw-normal); font-size: var(--fs-xs); color: var(--side-text); }
.m-total .val { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.m-money { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* Order card (mobile list) */
.ocard { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; overflow: hidden; position: relative; }
.ocard + .ocard { margin-top: 10px; }
.ocard:hover { border-color: var(--text-2); }
.ocard:active { transform: scale(.995); }
.ocard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--oc, var(--border-strong)); }
.ocard[data-st="in_progress"] { --oc: var(--accent-hover); border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow-md); }
.ocard[data-st="completed"] { --oc: var(--success); }
.ocard[data-st="completed_with_debt"] { --oc: var(--warning); }
.ocard[data-st="partial_return"] { --oc: var(--primary); }
.ocard[data-st="failed_returned"] { --oc: var(--error); }
.ocard[data-st="cancelled"] { --oc: var(--border); opacity: .7; }
.oc-main { padding: 12px 14px 10px 18px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.oc-seq { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.oc-name { font-size: var(--fs-lg); font-weight: var(--fw-bold); line-height: 1.3; }
.oc-addr { font-size: var(--fs-sm); color: var(--text-2); display: flex; gap: 6px; align-items: flex-start; line-height: 1.35; }
.oc-addr .i { width: 15px; height: 15px; margin-top: 2px; }
.oc-amt { text-align: right; align-self: start; font-size: var(--fs-lg); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.oc-amt small { display: block; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-2); }
.oc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px 10px 18px; border-top: 1px dashed var(--border); font-size: var(--fs-xs); color: var(--text-2); }
.oc-foot .row { gap: 6px; }

/* Payment method tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 96px; padding: 14px; border: 2px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; font-weight: var(--fw-bold); font-size: var(--fs-base); }
.tile:hover { border-color: var(--text-2); }
.tile .t-ico { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface-hover); color: var(--primary); }
.tile .t-ico .i { width: 22px; height: 22px; }
.tile small { display: block; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-2); }
.tile.is-on { border-color: var(--primary); background: var(--navy-soft); }
.tile.is-on .t-ico { background: var(--primary); color: var(--accent); }
.tile-cash .t-ico { background: var(--success-soft); color: var(--success-ink); }
.tile-transfer .t-ico { background: var(--accent-soft); color: var(--accent-ink); }
.tile-debt .t-ico { background: var(--warning-soft); color: var(--warning-ink); }
.tile-return .t-ico { background: var(--error-soft); color: var(--error-ink); }

/* Payment line (one method inside a multi-method payment) */
.pline { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.pline + .pline { margin-top: 10px; }
.pline-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.pline-head .t-ico { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; }
.pline-head .t-ico .i { width: 18px; height: 18px; }
.pline-head strong { flex: 1; font-size: var(--fs-base); }
.pline-head .ph-iconbtn { width: 40px; height: 40px; color: var(--text-2); }
.pline-head .ph-iconbtn:hover { background: var(--surface-hover); }
.pline-body { padding: 12px; display: grid; gap: 12px; }
.pline.is-invalid { border-color: var(--error); }
.money-input { position: relative; }
.money-input .input { min-height: 56px; font-size: var(--fs-2xl); font-weight: 800; text-align: right; padding-right: 40px; letter-spacing: -0.01em; border-width: 1.5px; }
.money-input::after { content: "đ"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: var(--fs-xl); font-weight: 800; color: var(--text-2); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { min-height: 36px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--border-strong); background: var(--surface); font-size: var(--fs-xs); font-weight: var(--fw-bold); cursor: pointer; color: var(--text); }
.quick button:hover { background: var(--surface-hover); }
.quick button.is-fill { background: var(--accent-soft); border-color: var(--accent-line); color: var(--primary); }

/* Reason chips (finger-sized radio chips) */
.rchips { display: flex; flex-wrap: wrap; gap: 8px; }
.rchip { position: relative; }
.rchip input { position: absolute; opacity: 0; pointer-events: none; }
.rchip span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--r-full); cursor: pointer; }
.rchip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--text-inverse); }
.rchip input:checked + span::before { content: "✓"; color: var(--accent); font-weight: 800; }
.rchip input:focus-visible + span { box-shadow: var(--focus-ring); }
.rchips.is-invalid .rchip span { border-color: var(--error-line); }

/* Qty stepper */
.stepper { display: inline-flex; align-items: stretch; border: 1.5px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.stepper button { width: 48px; min-height: 48px; border: 0; background: var(--bg-2); cursor: pointer; display: grid; place-items: center; color: var(--primary); }
.stepper button:hover { background: var(--surface-hover); }
.stepper button[disabled] { color: var(--text-muted); cursor: not-allowed; }
.stepper output { min-width: 52px; display: grid; place-items: center; font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }

/* Remaining-amount meter (sum of methods vs order total) */
.sumbar { padding: 12px 14px; border-radius: var(--r-lg); border: 1.5px solid var(--border); background: var(--surface); }
.sumbar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: var(--fs-sm); }
.sumbar-top strong { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.sumbar .stackbar { margin-top: 10px; height: 12px; background: var(--surface-hover); }
.sumbar.is-ok { border-color: var(--success-line); background: var(--success-soft); }
.sumbar.is-ok .sumbar-top strong { color: var(--success-ink); }
.sumbar.is-short { border-color: var(--warning-line); background: var(--warning-soft); }
.sumbar.is-short .sumbar-top strong { color: var(--warning-ink); }
.sumbar.is-over { border-color: var(--error-line); background: var(--error-soft); }
.sumbar.is-over .sumbar-top strong { color: var(--error-ink); }

/* ---------- App phone shell (verbatim from app/tenants/hungbm/tenant.css) ---------- */
.m-actionbar { display: flex; flex-wrap: wrap; gap: var(--sp-sm); justify-content: flex-end; margin-top: var(--sp-lg); }

.m-top, .m-nav { display: none; }
.m-top { position: sticky; top: 0; z-index: 30; align-items: center; gap: 8px; min-height: 56px; padding: 6px 8px 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); background: var(--primary); color: var(--text-inverse); box-shadow: inset 0 -2px 0 var(--accent); }
.m-top__brand { width: 36px; height: 36px; border-radius: var(--r-md); background: #fff; display: grid; place-items: center; flex: none; text-decoration: none; }
.m-top__brand img { width: 30px; height: auto; display: block; }
.m-top__title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.m-top__title small { display: block; font-size: var(--fs-xs); font-weight: 500; color: var(--side-text); }
.m-top__btn { width: var(--touch); height: var(--touch); display: grid; place-items: center; border-radius: var(--r-lg); color: var(--text-inverse); text-decoration: none; background: none; border: 0; cursor: pointer; position: relative; }
.m-top__btn:hover { background: var(--side-2); }
.m-top__btn .i { width: 24px; height: 24px; }

.m-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; grid-auto-flow: column; grid-auto-columns: 1fr; height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); }
.m-nav a, .m-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: var(--fw-semibold); color: var(--text-2); text-decoration: none; }
.m-nav button { background: none; border: 0; font: inherit; font-size: 11.5px; font-weight: var(--fw-semibold); cursor: pointer; }
.m-nav a .i, .m-nav button .i { width: 24px; height: 24px; }
.m-nav .is-active { color: var(--text); }
.m-nav .is-active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent-hover); }
.m-nav .is-active .i { color: var(--primary); stroke-width: 2.4; }

.m-sheet-scrim { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--primary) 50%, transparent); }
.m-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px var(--sp-md) calc(28px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-xl); max-height: 86vh; overflow-y: auto; }
.m-sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 12px; }
.m-sheet__who { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.m-sheet__group + .m-sheet__group { margin-top: 14px; }
.m-sheet__label { padding: 0 10px 6px; font-size: 10.5px; font-weight: var(--fw-bold); letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.m-sheet__link { display: flex; align-items: center; gap: 12px; min-height: var(--touch); padding: 0 10px; border-radius: var(--r-md); color: var(--text); text-decoration: none; font-weight: var(--fw-medium); }
.m-sheet__link:hover { background: var(--surface-hover); }
.m-sheet__link.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

@media (min-width: 768px) {
  .only-mobile { display: none !important; }
}

@media (max-width: 767px) {
  .only-desktop { display: none !important; }
  .a-shell { grid-template-columns: minmax(0, 1fr); }
  .a-side, .a-top { display: none; }
  .m-top { display: flex; }
  .m-nav { display: grid; }
  .a-main { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
  body { font-size: var(--fs-base); }
  .page { padding: var(--sp-md) var(--sp-md) var(--sp-2xl); }
  .page-head h1 { font-size: var(--fs-xl); }
  .page-head { align-items: flex-start; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input, .select, .textarea { min-height: var(--touch); font-size: 16px; }
  .btn { min-height: var(--touch); }
  .btn-sm { min-height: 40px; }
  .m-actionbar { position: fixed; left: 0; right: 0; bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); z-index: 25; margin: 0; padding: 12px var(--sp-md) 14px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 20px rgba(15, 23, 42, .06); flex-wrap: nowrap; }
  .m-actionbar > .btn { flex: 1; }
  .page.has-actionbar { padding-bottom: 6.5rem; }
  .toolbar .field, .toolbar .search { min-width: 0; flex: 1 1 100%; }
  .cols, .cols-x { gap: 3px; padding-left: 0; padding-right: 0; }
  .cols-x { font-size: 10px; }
  .cols-x > :nth-child(even) { visibility: hidden; }
  .cols .col .v { font-size: 9px; white-space: nowrap; letter-spacing: -0.02em; }
}


/* Phone stage overrides: inside the framed preview the app's fixed/sticky phone shell becomes a flex column. */
.phone-screen .m-top { display: flex; position: static; flex: none; }
.phone-screen .m-nav { display: grid; position: static; flex: none; height: calc(var(--bottom-nav-h) + 14px); padding-bottom: 14px; }
.phone-screen > main.page { flex: 1; overflow-y: auto; padding: var(--sp-md) var(--sp-md) var(--sp-lg); max-width: none; scrollbar-width: none; }
.phone-screen > main.page::-webkit-scrollbar { display: none; }
.phone-screen .m-actionbar { position: static; flex: none; margin: 0; padding: 12px var(--sp-md) 14px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 20px rgba(15, 23, 42, .06); flex-wrap: nowrap; }
.phone-screen .m-actionbar > .btn { flex: 1; }
.phone-screen .m-sheet-scrim, .phone-screen .m-sheet { position: absolute; }
.phone-screen .m-sheet { max-height: 86%; }
@media (max-width: 520px) {
  .phone-screen .m-nav { height: var(--bottom-nav-h); padding-bottom: 0; }
}

/* ==========================================================================
   Reviewer-only "Mockup" state panel (not part of the product)
   ========================================================================== */
.mock { position: fixed; left: 12px; bottom: 12px; z-index: 200; font-family: var(--font); font-size: 13px; line-height: 1.4; }
.mock__toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 34px; background: #5B2A86; color: #fff; border: 0; border-radius: 999px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(91, 42, 134, .35); }
.mock__toggle svg { width: 16px; height: 16px; }
.mock__panel { position: absolute; left: 0; bottom: calc(100% + 8px); width: min(22rem, calc(100vw - 1.5rem)); max-height: min(72vh, 34rem); overflow: auto; padding: 12px; background: #fff; color: #1d1330; border: 2px solid #5B2A86; border-radius: 12px; box-shadow: var(--shadow-xl); }
.mock__panel h2 { font-size: 13px; color: #5B2A86; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.mock__panel > p { color: #4a3d5c; margin-bottom: 8px; }
.mock__list { display: grid; gap: 4px; }
.mock__opt { display: grid; gap: 1px; text-align: left; width: 100%; padding: 7px 9px; border: 1px solid #e0d4ee; border-radius: 8px; background: #faf7fd; cursor: pointer; color: inherit; }
.mock__opt:hover { border-color: #5B2A86; }
.mock__opt[aria-pressed="true"] { background: #5B2A86; color: #fff; border-color: #5B2A86; }
.mock__opt small { opacity: .82; }
.mock__links { display: flex; gap: 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #e0d4ee; }
.mock__links a { color: #5B2A86; font-weight: 600; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
