/* =====================================================================
   POS PRO — Design system · Luxe Gold (Dark / Light)
   ===================================================================== */

:root {
  --font-ui: 'IBM Plex Sans Thai', 'Noto Sans Thai', 'Leelawadee UI', 'Thonburi', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Noto Serif Thai', 'Playfair Display', Georgia, 'Times New Roman', serif;

  --r-xs: 8px; --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 140ms; --t-med: 240ms; --t-slow: 380ms;

  --appbar-h: 58px;
  --tabbar-h: 64px;
  --rail-w: 96px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0A08;
  --bg-2: #0F0D0A;
  --bg-glow: radial-gradient(900px 520px at 50% -180px, rgba(212, 178, 106, .13), transparent 70%);
  --surface: #16130F;
  --surface-2: #1E1A14;
  --surface-3: #28231B;
  --surface-glass: rgba(18, 15, 11, .80);
  --line: rgba(236, 214, 170, .085);
  --line-2: rgba(236, 214, 170, .15);
  --line-gold: rgba(212, 178, 106, .45);
  --text: #F5EFE3;
  --text-2: #C4BBAA;
  --text-3: #8D8576;
  --gold: #D4B26A;
  --gold-2: #EACF90;
  --gold-3: #A8833E;
  --gold-ink: #E3C47E;
  --gold-soft: rgba(212, 178, 106, .10);
  --gold-soft-2: rgba(212, 178, 106, .18);
  --gold-grad: linear-gradient(135deg, #F8E6AE 0%, #E4C47A 36%, #C9A253 70%, #A98236 100%);
  --on-gold: #1B1408;
  --success: #6CC593; --success-soft: rgba(108, 197, 147, .14);
  --danger: #EE7468;  --danger-soft: rgba(238, 116, 104, .14);
  --warning: #EDB25A; --warning-soft: rgba(237, 178, 90, .15);
  --info: #79AEE0;    --info-soft: rgba(121, 174, 224, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .65);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .85);
  --shadow-gold: 0 10px 28px -10px rgba(212, 178, 106, .55);
  --overlay: rgba(5, 4, 3, .62);
  --skeleton: linear-gradient(90deg, rgba(255, 255, 255, .03) 25%, rgba(255, 255, 255, .08) 37%, rgba(255, 255, 255, .03) 63%);
  --card-sheen: linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, 0) 42%);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #F5F1E9;
  --bg-2: #EEE8DC;
  --bg-glow: radial-gradient(900px 520px at 50% -200px, rgba(201, 160, 74, .17), transparent 70%);
  --surface: #FFFFFF;
  --surface-2: #F7F3EC;
  --surface-3: #ECE5D8;
  --surface-glass: rgba(255, 253, 249, .84);
  --line: rgba(58, 44, 20, .085);
  --line-2: rgba(58, 44, 20, .15);
  --line-gold: rgba(168, 131, 62, .5);
  --text: #1D1A15;
  --text-2: #554E3F;
  --text-3: #877E6D;
  --gold: #B8913F;
  --gold-2: #C9A24F;
  --gold-3: #8E6C22;
  --gold-ink: #87651F;
  --gold-soft: rgba(184, 145, 63, .10);
  --gold-soft-2: rgba(184, 145, 63, .19);
  --gold-grad: linear-gradient(135deg, #F3DB9C 0%, #DDB867 38%, #C29B4D 72%, #A27D33 100%);
  --on-gold: #1B1408;
  --success: #2E9C62; --success-soft: rgba(46, 156, 98, .11);
  --danger: #D2483C;  --danger-soft: rgba(210, 72, 60, .10);
  --warning: #C17C12; --warning-soft: rgba(201, 132, 24, .12);
  --info: #3A7BC0;    --info-soft: rgba(58, 123, 192, .10);
  --shadow-sm: 0 1px 2px rgba(60, 45, 20, .08);
  --shadow: 0 10px 30px -14px rgba(60, 45, 20, .28);
  --shadow-lg: 0 24px 60px -24px rgba(60, 45, 20, .42);
  --shadow-gold: 0 10px 26px -12px rgba(176, 138, 62, .6);
  --overlay: rgba(30, 24, 14, .42);
  --skeleton: linear-gradient(90deg, rgba(0, 0, 0, .04) 25%, rgba(0, 0, 0, .08) 37%, rgba(0, 0, 0, .04) 63%);
  --card-sheen: none;
}

/* ---------------- Base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-glow), var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
img, svg { vertical-align: middle; }
button { font: inherit; color: inherit; }
a { color: var(--gold-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
p { margin: 0; }
code { font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
hr { border: 0; height: 1px; background: var(--line); margin: 14px 0; }
::selection { background: var(--gold-soft-2); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover { background-color: var(--line-gold); }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* ---------------- Typography ---------------- */
.display { font-family: var(--font-display); letter-spacing: .005em; }
.h1 { font-size: 28px; }
.h2 { font-size: 22px; }
.h3 { font-size: 18px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.gold { color: var(--gold-ink); }
.gold-text { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { text-align: center; }
.right { text-align: right; }
.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.warning-text { color: var(--warning); }

/* ---------------- Icons ---------------- */
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-xs { width: 14px; height: 14px; }
.ic-sm { width: 17px; height: 17px; }
.ic-lg { width: 24px; height: 24px; }
.ic-xl { width: 32px; height: 32px; }

/* ---------------- Buttons ---------------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px;
  border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; font-size: 15px; line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-user-select: none; text-decoration: none !important;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast), filter var(--t-fast);
  touch-action: manipulation; position: relative;
}
.btn:hover { border-color: var(--line-gold); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.is-loading { opacity: .55; pointer-events: none; }
.btn.is-loading::after {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn-gold { background: var(--gold-grad); color: var(--on-gold); border-color: transparent; box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255, 255, 255, .38); }
.btn-gold:hover { filter: brightness(1.05) saturate(1.05); border-color: transparent; }
.btn-dark { background: #17130D; color: var(--gold-2); border-color: rgba(212, 178, 106, .35); }
.btn-outline { background: transparent; border-color: var(--line-gold); color: var(--gold-ink); }
.btn-outline:hover { background: var(--gold-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-success { background: var(--success); border-color: transparent; color: #fff; }
.btn-sm { --h: 34px; padding: 0 12px; font-size: 13.5px; border-radius: var(--r-sm); gap: 6px; }
.btn-lg { --h: 54px; padding: 0 24px; font-size: 16.5px; border-radius: var(--r-lg); }
.btn-xl { --h: 60px; padding: 0 26px; font-size: 17.5px; border-radius: var(--r-lg); }
.btn-block { display: flex; width: 100%; }
.btn .ic { width: 19px; height: 19px; }
.btn-sm .ic { width: 16px; height: 16px; }

.icon-btn {
  width: 42px; height: 42px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--text-2);
  cursor: pointer; transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast); touch-action: manipulation;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.bordered { border-color: var(--line-2); background: var(--surface); }
.icon-btn.gold { color: var(--gold-ink); }
.icon-btn .ic { width: 22px; height: 22px; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: var(--r-sm); }
.icon-btn.sm .ic { width: 18px; height: 18px; }

/* ---------------- Forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field > small { font-size: 12px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px;
  border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 16px; outline: none; min-width: 0;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.textarea { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft-2); background: var(--surface); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input[readonly] { color: var(--text-2); }
.input-sm { height: 38px; font-size: 14px; padding: 0 11px; border-radius: var(--r-sm); }
.input-lg { height: 56px; font-size: 20px; font-weight: 600; border-radius: var(--r-lg); }
.select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238D8576' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.select.input-sm { padding-right: 32px; background-position: right 9px center; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ic { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.input-wrap > .input { padding-left: 42px; }
.input-wrap > .input-suffix { position: absolute; right: 14px; color: var(--text-3); font-size: 14px; pointer-events: none; }
.input-wrap > .icon-btn { position: absolute; right: 3px; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 5px 0; font-size: 14.5px; line-height: 1.45; }
.check input {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; flex: none; margin: 1px 0 0;
  border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--surface-2);
  display: grid; place-items: center; cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast);
}
.check input:checked { background: var(--gold-grad); border-color: transparent; }
.check input:checked::after { content: ''; width: 10px; height: 5px; border-left: 2.2px solid var(--on-gold); border-bottom: 2.2px solid var(--on-gold); transform: translateY(-1px) rotate(-45deg); }
.check input[type="radio"] { border-radius: 50%; }
.check input[type="radio"]:checked::after { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--on-gold); transform: none; }

.switch { position: relative; display: inline-block; width: 48px; height: 28px; flex: none; }
.switch input {
  appearance: none; -webkit-appearance: none; position: absolute; inset: 0; margin: 0; cursor: pointer;
  border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background var(--t-med);
}
.switch input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform var(--t-med) var(--ease-spring);
}
.switch input:checked { background: var(--gold); border-color: transparent; }
.switch input:checked::after { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .sr-text b { display: block; font-weight: 600; }
.switch-row .sr-text small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 1px; }

/* ---------------- Surfaces ---------------- */
.card { background: var(--card-sheen), var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); min-height: 58px; }
.card-title { font-family: var(--font-display); font-size: 16.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .ic { color: var(--gold-ink); }
.card-body { padding: 16px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); }
.card.gold-edge { border-color: var(--line-gold); }

.alert { padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start; }
.alert .ic { margin-top: 1px; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(238, 116, 104, .25); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(108, 197, 147, .25); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(237, 178, 90, .25); }
.alert-info { background: var(--gold-soft); color: var(--gold-ink); border-color: var(--line-gold); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 600; line-height: 1;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge .ic { width: 13px; height: 13px; }
.badge-gold { background: var(--gold-soft-2); color: var(--gold-ink); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-solid { background: var(--gold-grad); color: var(--on-gold); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 16px; scroll-padding: 0 16px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px;
  border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.chip:active { transform: scale(.95); }
.chip.active { background: var(--gold-soft-2); border-color: var(--line-gold); color: var(--gold-ink); font-weight: 600; }
.chip .count { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.chip .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--gold)); }

.segmented { display: flex; padding: 4px; gap: 4px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.segmented button {
  flex: 1; min-width: 0; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2);
  font: inherit; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast); white-space: nowrap;
}
.segmented button .ic { width: 18px; height: 18px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line-gold); }
[data-theme="dark"] .segmented button.active { background: var(--surface-3); }
.segmented button .count { font-size: 12px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold-soft-2); color: var(--gold-ink); display: inline-grid; place-items: center; }

.list { background: var(--card-sheen), var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; width: 100%;
  border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left;
  cursor: pointer; text-decoration: none !important; transition: background var(--t-fast);
}
.list-item:last-child { border-bottom: 0; }
.list-item:active, .list-item:hover { background: var(--surface-2); }
.li-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-ink); flex: none; }
.slip-thumb { width: 42px; height: 54px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line-gold); flex: none; display: block; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-item .li-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.list-item .li-end { text-align: right; flex: none; }
.list-item .li-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.list-item > .ic:last-child { color: var(--text-3); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-weight: 700; font-size: 14px; color: #1B1408; background: var(--c, var(--gold));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

.empty { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty .ic { width: 46px; height: 46px; stroke-width: 1.25; color: var(--gold-ink); opacity: .75; margin-bottom: 12px; }
.empty h3 { color: var(--text); font-family: var(--font-display); font-size: 17px; margin-bottom: 4px; }
.empty p { font-size: 14px; }

.skel { background: var(--skeleton); background-size: 400% 100%; animation: skel 1.3s ease infinite; border-radius: var(--r-md); }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(237, 178, 90, .55); } 70% { box-shadow: 0 0 0 10px rgba(237, 178, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(237, 178, 90, 0); } }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--gold-soft-2); border-top-color: var(--gold); animation: spin .8s linear infinite; }
.loading-block { display: grid; place-items: center; padding: 60px 0; }

/* ---------------- Layout helpers ---------------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-top { align-items: flex-start; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; }
.w-full { width: 100%; }
@media (max-width: 760px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 > .span-2 { grid-column: auto; }
  .hide-sm { display: none !important; }
}
@media (min-width: 561px) { .show-sm { display: none !important; } }

.form-section { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; margin-top: 6px; display: flex; align-items: center; gap: 12px; }
.form-section::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-gold), transparent); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.gold-rule { height: 1px; background: linear-gradient(90deg, transparent, var(--line-gold), transparent); margin: 16px 0; border: 0; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.stat-row b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--gold-ink); }
.stat-row span { font-size: 12.5px; color: var(--text-3); }

/* ---------------- Toast / overlay / sheet ---------------- */
.toast-host { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 12px); z-index: 1500; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 460px; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-weight: 500; font-size: 14.5px;
  animation: toast-in .32s var(--ease-spring);
}
.toast .ic { color: var(--gold-ink); }
.toast.success .ic { color: var(--success); }
.toast.error { border-color: rgba(238, 116, 104, .4); }
.toast.error .ic { color: var(--danger); }
.toast.out { animation: toast-out .24s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(.97); } }

.overlay { position: fixed; inset: 0; z-index: 1000; background: var(--overlay); opacity: 0; transition: opacity var(--t-med) var(--ease); }
.overlay.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; background: var(--surface);
  border-radius: 26px 26px 0 0; border-top: 1px solid var(--line-2); box-shadow: var(--shadow-lg);
  transform: translateY(105%); transition: transform var(--t-slow) var(--ease);
  padding-bottom: var(--safe-bottom);
}
.sheet.show { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 9px auto 3px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 6px 14px 10px 20px; flex: none; }
.sheet-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; flex: 1; min-width: 0; }
.sheet-sub { font-size: 13px; color: var(--text-3); font-family: var(--font-ui); font-weight: 400; }
.sheet-body { overflow-y: auto; padding: 2px 20px 18px; flex: 1; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; padding: 12px 20px 14px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 720px) {
  .sheet {
    left: 50%; right: auto; top: 50%; bottom: auto; width: min(560px, calc(100vw - 48px)); max-height: 86vh;
    border-radius: 24px; border: 1px solid var(--line-2); padding-bottom: 0;
    transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
  }
  .sheet.show { transform: translate(-50%, -50%); opacity: 1; }
  .sheet.wide { width: min(880px, calc(100vw - 48px)); }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 16px; }
}

.option-list { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit;
}
.option.active { border-color: var(--gold); background: var(--gold-soft); }
.option .opt-main { flex: 1; min-width: 0; }
.option .opt-title { font-weight: 600; }
.option .opt-sub { font-size: 12.5px; color: var(--text-3); }

/* ---------------- Auth / standalone pages ---------------- */
.auth-page, .center-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); background: var(--bg-glow), var(--bg); background-repeat: no-repeat; }
.auth-wrap { width: 100%; max-width: 420px; animation: fade-up .5s var(--ease); }
.auth-wrap-wide { max-width: 640px; }
.auth-brand { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 22px; }
.logo-mark { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 8px 22px rgba(212, 178, 106, .32)); }
.brand-word { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: .16em; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.15; }
.brand-sub { font-size: 13px; color: var(--text-3); letter-spacing: .03em; }
.auth-card { padding: 26px 22px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .h2 { margin-bottom: 2px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--text-3); }
.pw-toggle { color: var(--text-3); }
.error-card { max-width: 420px; padding: 34px 26px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.error-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-size: 30px; font-weight: 700; background: var(--gold-soft-2); color: var(--gold-ink); border: 1px solid var(--line-gold); }

.success-mark { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; background: var(--gold-grad); display: grid; place-items: center; box-shadow: var(--shadow-gold); animation: pop .5s var(--ease-spring); }
.success-mark svg { width: 44px; height: 44px; stroke: var(--on-gold); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .25s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* =====================================================================
   APP SHELL (staff / cashier) — mobile first
   ===================================================================== */
body.app-body { height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
.app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.views { flex: 1; position: relative; overflow: hidden; min-height: 0; }
.view {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  background: var(--bg-glow), var(--bg); background-repeat: no-repeat;
}
.view.full { padding-bottom: calc(var(--safe-bottom) + 24px); }
.view.with-cartbar { padding-bottom: calc(var(--safe-bottom) + 110px); }
.view.enter-push { animation: v-push-in var(--t-slow) var(--ease) both; z-index: 2; box-shadow: -20px 0 40px -20px rgba(0, 0, 0, .5); }
.view.leave-push { animation: v-push-out var(--t-slow) var(--ease) both; z-index: 1; }
.view.enter-pop { animation: v-pop-in var(--t-slow) var(--ease) both; z-index: 1; }
.view.leave-pop { animation: v-pop-out var(--t-slow) var(--ease) both; z-index: 2; }
.view.enter-fade { animation: v-fade-in var(--t-med) var(--ease) both; }
@keyframes v-push-in { from { transform: translateX(100%); } }
@keyframes v-push-out { to { transform: translateX(-26%); opacity: .5; } }
@keyframes v-pop-in { from { transform: translateX(-26%); opacity: .5; } }
@keyframes v-pop-out { to { transform: translateX(100%); } }
@keyframes v-fade-in { from { opacity: 0; transform: translateY(6px); } }

.vbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--appbar-h) + var(--safe-top)); padding: var(--safe-top) 8px 0 12px;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-glass); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid var(--line);
}
.vbar .back { margin-left: -6px; }
.vbar-title { flex: 1; min-width: 0; }
.vbar-title .t { font-family: var(--font-display); font-size: 18.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.vbar-title .s { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.vbar .brandmark { width: 34px; height: 34px; }
.vbar .brandmark .logo-mark { width: 34px; height: 34px; filter: none; }
.ctx-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 9px; max-width: 46vw;
  border-radius: 99px; border: 1px solid var(--line-gold); background: var(--gold-soft); color: var(--gold-ink);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; flex: none;
}
.ctx-pill span { overflow: hidden; text-overflow: ellipsis; }
.ctx-pill .ic { width: 16px; height: 16px; }
.vbar-sub { position: sticky; top: calc(var(--appbar-h) + var(--safe-top)); z-index: 15; padding: 10px 16px; background: linear-gradient(var(--bg) 75%, transparent); }

.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: flex; background: var(--surface-glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid var(--line); transition: transform var(--t-med) var(--ease);
}
.tabbar.hidden { transform: translateY(110%); }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--text-3); font: inherit; font-size: 11.5px; font-weight: 600;
  cursor: pointer; position: relative; transition: color var(--t-fast); touch-action: manipulation; min-width: 0;
}
.tab .ic { width: 24px; height: 24px; transition: transform var(--t-med) var(--ease-spring); }
.tab:active .ic { transform: scale(.86); }
.tab.active { color: var(--gold-ink); }
.tab.active::before { content: ''; position: absolute; top: -1px; width: 30px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold-grad); }
.tab-badge { position: absolute; top: 7px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.rail-brand { display: none; }

@media (min-width: 900px) {
  .app { flex-direction: row; }
  .tabbar {
    position: relative; order: -1; width: var(--rail-w); height: auto; flex-direction: column; justify-content: flex-start;
    padding: calc(16px + var(--safe-top)) 0 16px; border-top: 0; border-right: 1px solid var(--line); gap: 4px; background: var(--bg-2);
  }
  .tabbar.hidden { transform: none; }
  .tab { flex: none; height: 70px; font-size: 12px; }
  .tab.active::before { top: 15px; left: 0; width: 3px; height: 40px; border-radius: 0 3px 3px 0; }
  .tab-badge { top: 9px; }
  .rail-brand { display: grid; place-items: center; height: 64px; margin-bottom: 8px; }
  .rail-brand .logo-mark { width: 42px; height: 42px; }
  .view, .view.full { padding-bottom: 32px; }
  .view.with-cartbar { padding-bottom: 110px; }
}

/* ---- tables ---- */
.summary-strip { display: flex; gap: 10px; padding: 14px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.summary-strip::-webkit-scrollbar { display: none; }
.sum-card { flex: 1 0 auto; min-width: 104px; padding: 11px 14px; border-radius: var(--r-md); background: var(--card-sheen), var(--surface); border: 1px solid var(--line); }
.sum-card b { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.sum-card span { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.sum-card.gold b { color: var(--gold-ink); }

.summary-card { margin: 14px 16px 0; display: grid; grid-template-columns: 1fr 1fr 1fr 1.55fr; border-radius: var(--r-lg); background: var(--card-sheen), var(--surface); border: 1px solid var(--line); overflow: hidden; }
.summary-card > div { padding: 11px 8px 10px 13px; min-width: 0; border-left: 1px solid var(--line); }
.summary-card > div:first-child { border-left: 0; }
.summary-card b { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-card b.gold { color: var(--gold-ink); }
.summary-card span { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.summary-card .ic { width: 12px; height: 12px; }
@media (min-width: 700px) { .summary-card { max-width: 640px; } }
.zone-block { margin-top: 18px; }
.zone-title { display: flex; align-items: center; gap: 10px; padding: 0 16px 10px; font-size: 13px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; }
.zone-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 11px; padding: 0 16px; }
@media (max-width: 400px) { .table-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; } }
.tcard {
  position: relative; aspect-ratio: 1 / 1.04; border-radius: var(--r-lg); border: 1px solid var(--line-2);
  background: var(--card-sheen), var(--surface); padding: 11px; display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; text-align: left; color: inherit; font: inherit; overflow: hidden; min-width: 0;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast), box-shadow var(--t-fast); touch-action: manipulation;
}
.tcard:active { transform: scale(.95); }
.tcard .tname { font-family: var(--font-display); font-size: 23px; font-weight: 700; line-height: 1; color: var(--text-2); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard .tseat { font-size: 11.5px; color: var(--text-3); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard .tseat .ic { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.tcard .tfoot { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tcard .tamt { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard .tmeta { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.tcard .tmeta .ic { width: 12px; height: 12px; }
.tcard .tfree { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.tcard .tfree .dot { color: var(--success); width: 7px; height: 7px; opacity: .8; }
.tcard.busy { border-color: var(--line-gold); background: radial-gradient(130% 95% at 100% 0%, var(--gold-soft-2), transparent 62%), var(--card-sheen), var(--surface); box-shadow: 0 10px 26px -18px rgba(212, 178, 106, .8); }
.tcard.busy .tname { color: var(--gold-ink); }
.tcard.bill { border-color: rgba(237, 178, 90, .65); background: radial-gradient(130% 95% at 100% 0%, var(--warning-soft), transparent 62%), var(--surface); }
.tcard.bill .tname { color: var(--warning); }
.tcard .tflag { position: absolute; top: 9px; right: 9px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--warning); color: #1B1408; animation: pulse-ring 1.8s infinite; }
.tcard .tflag .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.tcard .tstaff { position: absolute; top: 9px; right: 9px; }

/* ---- menu ---- */
.menu-tools { position: sticky; top: calc(var(--appbar-h) + var(--safe-top)); z-index: 12; padding: 10px 0 10px; background: linear-gradient(var(--bg) 78%, transparent); }
[data-theme="dark"] .menu-tools { background: linear-gradient(#0D0B09 78%, transparent); }
.menu-tools .search { margin: 0 16px 10px; }
.menu-tools .input { height: 42px; border-radius: 13px; font-size: 15.5px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; padding: 2px 16px 16px; }
@media (max-width: 400px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } }
.pcard {
  position: relative; display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--line); overflow: hidden; cursor: pointer; text-align: left; color: inherit; font: inherit; padding: 0; min-width: 0;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast), box-shadow var(--t-fast); touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.pcard img { -webkit-user-drag: none; pointer-events: none; }
.product-grid > .span-all, .bar-grid > .span-all { grid-column: 1 / -1; }

/* order view: menu / bill panes (tabs on phones, side-by-side on large screens) */
.order-layout > [data-pane] { display: none; }
.order-layout > [data-pane].active { display: block; }
.order-view .menu-tools { top: calc(var(--appbar-h) + var(--safe-top) + 58px); }
.order-tabs .segmented { max-width: 520px; }
@media (min-width: 1100px) {
  .order-view .order-tabs { display: none; }
  .order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: start; }
  .order-layout > [data-pane] { display: block !important; }
  .order-view .menu-tools { top: calc(var(--appbar-h) + var(--safe-top)); }
  .order-bill { position: sticky; top: calc(var(--appbar-h) + var(--safe-top)); max-height: calc(100vh - var(--appbar-h)); overflow-y: auto; border-left: 1px solid var(--line); background: var(--bg-2); min-height: calc(100vh - var(--appbar-h)); }
  .order-bill .action-bar { background: linear-gradient(transparent, var(--bg-2) 34%); }
  .order-view .cartbar { right: 444px; }
}
.pcard:active { transform: scale(.95); }
.pimg {
  --c: #D4B26A;
  position: relative; aspect-ratio: 1 / .8; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-2);
  background: radial-gradient(90% 85% at 28% 18%, color-mix(in srgb, var(--c) 34%, transparent), transparent 72%), linear-gradient(160deg, color-mix(in srgb, var(--c) 16%, var(--surface-2)), var(--surface-2));
}
.pimg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .18)); pointer-events: none; }
[data-theme="light"] .pimg::after { background: none; }
.pimg .ic { width: 42px; height: 42px; stroke-width: 1.35; color: var(--c); filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .25)); }
.pimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pbody { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pname { font-size: 13.5px; font-weight: 600; line-height: 1.32; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.64em; }
.pprice { font-weight: 700; font-size: 14.5px; color: var(--gold-ink); font-variant-numeric: tabular-nums; margin-top: auto; }
.pset { font-size: 11.5px; line-height: 1.3; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pstock .badge.promo { background: var(--gold-grad); color: var(--on-gold); gap: 3px; }
.pstock .badge.promo .ic { width: 11px; height: 11px; stroke-width: 2; }
.pstock { position: absolute; left: 7px; top: 7px; z-index: 2; }
.pstock .badge { height: 20px; padding: 0 7px; font-size: 11px; background: rgba(12, 10, 8, .72); color: #F5EFE3; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pstock .badge.low { background: rgba(237, 178, 90, .92); color: #1B1408; }
.pqty { position: absolute; top: 7px; right: 7px; z-index: 2; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: var(--gold-grad); color: var(--on-gold); font-weight: 800; font-size: 13px; display: grid; place-items: center; box-shadow: var(--shadow-gold); animation: pop .3s var(--ease-spring); }
.pcard.in-cart { border-color: var(--line-gold); box-shadow: 0 0 0 1px var(--line-gold) inset; }
.pcard.out { opacity: .42; filter: grayscale(.7); cursor: not-allowed; }
.pcard.bump { animation: bump .28s var(--ease); }
@keyframes bump { 40% { transform: scale(.92); } }

.cartbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom)); z-index: 45;
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 8px 0 10px;
  border-radius: 20px; border: 0; background: var(--gold-grad); color: var(--on-gold);
  box-shadow: 0 18px 40px -14px rgba(212, 178, 106, .75), inset 0 1px 0 rgba(255, 255, 255, .4);
  cursor: pointer; font: inherit; text-align: left;
  /* hidden when the cart is empty: fully off-screen and untappable wherever the bar sits (above the tab bar or not) */
  transform: translateY(calc(100% + 160px)); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform var(--t-slow) var(--ease-spring), opacity var(--t-med) var(--ease), visibility 0s linear var(--t-slow);
}
.cartbar.show {
  transform: none; opacity: 1; visibility: visible; pointer-events: auto;
  transition: transform var(--t-slow) var(--ease-spring), opacity var(--t-fast) var(--ease), visibility 0s;
}
/* root screens keep the tab bar: float the cart bar above it */
.view:not(.full) .cartbar { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px); }
.view.with-cartbar:not(.full) { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 96px); }
.cartbar .cb-count { width: 44px; height: 44px; border-radius: 14px; background: rgba(27, 20, 8, .13); display: grid; place-items: center; font-weight: 800; font-size: 17px; position: relative; }
.cartbar .cb-count .ic { width: 22px; height: 22px; stroke-width: 2; }
.cartbar .cb-count b { position: absolute; top: -6px; right: -6px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; background: #1B1408; color: var(--gold-2); font-size: 11.5px; display: grid; place-items: center; }
.cartbar .cb-total { flex: 1; min-width: 0; line-height: 1.2; }
.cartbar .cb-total small { display: block; font-size: 12px; font-weight: 600; opacity: .72; }
.cartbar .cb-total b { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cartbar .cb-action { height: 48px; padding: 0 16px; border-radius: 15px; background: #17120A; color: var(--gold-2); display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.cartbar .cb-action .ic { width: 18px; height: 18px; }
@media (min-width: 900px) {
  .cartbar, .view:not(.full) .cartbar { left: auto; right: 24px; width: 420px; bottom: 24px; }
  .view.with-cartbar:not(.full) { padding-bottom: 110px; }
}

.cart-line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .cl-info { flex: 1; min-width: 0; }
.cart-line .cl-name { font-weight: 600; line-height: 1.35; }
.cart-line .cl-sub { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cart-line .cl-note { font-size: 12.5px; color: var(--gold-ink); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.cart-line .cl-note .ic { width: 13px; height: 13px; }
.cart-line .cl-total { font-weight: 700; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); overflow: hidden; flex: none; }
.stepper button { width: 36px; height: 36px; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.stepper button:active { background: var(--surface-3); }
.stepper button .ic { width: 17px; height: 17px; stroke-width: 2.2; }
.stepper .val { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper.lg button { width: 50px; height: 50px; }
.stepper.lg .val { min-width: 50px; font-size: 20px; }
.sum-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sum-total .lbl { color: var(--text-2); font-size: 14px; }
.sum-total .amt { font-family: var(--font-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- order / bill ---- */
.order-tabs { padding: 10px 16px 4px; position: sticky; top: calc(var(--appbar-h) + var(--safe-top)); z-index: 14; background: linear-gradient(var(--bg) 82%, transparent); }
[data-theme="dark"] .order-tabs { background: linear-gradient(#0D0B09 82%, transparent); }
.bill-wrap { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.batch-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); padding: 12px 16px 8px; border-bottom: 1px solid var(--line); }
.batch-head b { color: var(--text-2); font-weight: 600; }
.batch-head .badge { margin-left: auto; }
.bill-line { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.bill-line:last-child { border-bottom: 0; }
.bill-line .bl-qty { min-width: 30px; font-weight: 700; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.bill-line .bl-main { flex: 1; min-width: 0; }
.bill-line .bl-name { font-weight: 500; line-height: 1.35; }
.bill-line .bl-sub { font-size: 12px; color: var(--text-3); }
.bill-line .bl-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bill-line .icon-btn { margin: -8px -10px -8px 0; width: 36px; height: 36px; color: var(--text-3); }
.bill-line.void { opacity: .55; }
.bill-line.void .bl-name, .bill-line.void .bl-amt { text-decoration: line-through; text-decoration-color: var(--danger); }
.totals { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.totals .tr { display: flex; justify-content: space-between; gap: 10px; color: var(--text-2); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.totals .tr.disc { color: var(--success); }
.totals .tr.grand { color: var(--text); font-size: 15px; font-weight: 600; padding-top: 12px; border-top: 1px dashed var(--line-2); margin-top: 4px; align-items: baseline; }
.totals .tr.grand .amt { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--gold-ink); }
.action-bar {
  position: sticky; bottom: 0; z-index: 30; display: flex; gap: 10px;
  padding: 14px 16px calc(14px + var(--safe-bottom));
  background: linear-gradient(transparent, var(--bg) 34%);
}
.action-bar .btn { flex: 1; }
.info-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- pay ---- */
.pay-hero { text-align: center; padding: 18px 16px 6px; }
.pay-hero .label { font-size: 12px; color: var(--text-3); letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.pay-hero .amount { font-family: var(--font-display); font-size: 46px; font-weight: 700; line-height: 1.12; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.pay-hero .amount .cur { font-size: .55em; vertical-align: .55em; margin-right: 4px; opacity: .8; }
.pay-hero .breakdown { font-size: 13px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; }
.pay-section { padding: 12px 16px; }
.qr-card { background: #fff; color: #111; border-radius: 24px; padding: 14px 16px 14px; width: min(268px, 100%); margin: 0 auto; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(212, 178, 106, .35); text-align: center; position: relative; cursor: zoom-in; }
.qr-card .qr-head { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; }
.qr-card .qr-head .pp-logo { height: 26px; padding: 0 10px; border-radius: 6px; background: #0E3E6E; color: #fff; display: inline-flex; align-items: center; font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.qr-card .qr-head .tq { font-size: 11px; font-weight: 700; color: #0E3E6E; letter-spacing: .08em; }
.qr-card svg.qr { width: 100%; height: auto; display: block; }
.qr-card img.qr { width: 100%; height: auto; display: block; border-radius: 8px; }
.qr-card .qr-amt { font-size: 24px; font-weight: 800; margin-top: 8px; color: #111; font-variant-numeric: tabular-nums; font-family: var(--font-ui); }
.qr-card .qr-name { font-size: 13px; color: #555; line-height: 1.35; }
.qr-missing { text-align: center; padding: 22px 16px; border-radius: var(--r-lg); border: 1px dashed var(--line-2); color: var(--text-3); }
.qr-full { position: fixed; inset: 0; z-index: 1300; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; color: #111; text-align: center; animation: v-fade-in .2s; }
.qr-full .qr-box { width: min(86vw, 70vh, 520px); }
.qr-full svg.qr, .qr-full img.qr { width: 100%; height: auto; }
.qr-full .amt { font-size: 40px; font-weight: 800; margin-top: 12px; font-variant-numeric: tabular-nums; }
.qr-full .nm { font-size: 16px; color: #555; }
.qr-full .close { position: absolute; top: calc(16px + var(--safe-top)); right: 16px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: #f0ece4; color: #111; display: grid; place-items: center; }

.slip-box {
  border-radius: var(--r-lg); border: 1.5px dashed var(--line-gold); background: var(--gold-soft); padding: 18px 16px;
  text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--gold-ink); width: 100%; font: inherit;
}
.slip-box .ic { width: 34px; height: 34px; stroke-width: 1.5; }
.slip-box b { font-size: 16px; }
.slip-box small { color: var(--text-3); font-size: 12.5px; }
.slip-preview { position: relative; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line-gold); background: #000; }
.slip-preview img { display: block; width: 100%; max-height: 340px; object-fit: contain; }
.slip-preview .sp-tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 10px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); justify-content: flex-end; }
.slip-preview .sp-ok { position: absolute; top: 10px; left: 10px; }
.cash-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cash-quick .btn { --h: 44px; padding: 0 6px; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.change-box { margin-top: 12px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.change-box .amt { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }
.change-box.short .amt { color: var(--danger); }
.pay-done { text-align: center; padding: 36px 20px 10px; }
.pay-done .h1 { font-family: var(--font-display); }
.pay-done .amount { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--gold-ink); margin: 6px 0; font-variant-numeric: tabular-nums; }
.receipt-qr { background: #fff; border-radius: 16px; padding: 10px; width: 150px; margin: 14px auto 6px; }

/* ---- camera ---- */
.camera { position: fixed; inset: 0; z-index: 1400; background: #000; color: #fff; animation: v-fade-in .2s; }
.camera video, .camera .cam-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.camera .cam-shot { object-fit: contain; }
.camera .cam-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; padding: calc(var(--safe-top) + 12px) 14px 26px; display: flex; justify-content: space-between; align-items: center; background: linear-gradient(rgba(0, 0, 0, .65), transparent); }
.camera .cam-title { font-weight: 600; font-size: 15px; }
.camera .cam-frame { position: absolute; z-index: 2; left: 9%; right: 9%; top: 15%; bottom: 25%; border-radius: 20px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .38); pointer-events: none; }
.camera .cam-frame::before, .camera .cam-frame::after { content: ''; position: absolute; width: 34px; height: 34px; border: 3px solid var(--gold-2); }
.camera .cam-frame::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 20px 0 0 0; }
.camera .cam-frame::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 20px 0; }
.camera .cam-hint { position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(25% - 40px); text-align: center; font-size: 13.5px; color: rgba(255, 255, 255, .85); }
.camera .cam-bottom { position: absolute; z-index: 3; bottom: 0; left: 0; right: 0; padding: 26px 28px calc(28px + var(--safe-bottom)); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 5px; cursor: pointer; flex: none; }
.shutter::after { content: ''; display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--gold-grad); transition: transform .12s; }
.shutter:active::after { transform: scale(.86); }
.cam-btn { width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .16); border: 0; color: #fff; display: grid; place-items: center; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); flex: none; }
.cam-btn .ic { width: 24px; height: 24px; }
.cam-btn.ghost { background: transparent; }
.camera .cam-actions { position: absolute; z-index: 3; bottom: 0; left: 0; right: 0; display: flex; gap: 12px; padding: 20px 18px calc(22px + var(--safe-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .85)); }
.camera .cam-actions .btn { flex: 1; }
.flash { position: fixed; inset: 0; z-index: 1450; background: #fff; animation: flash .35s ease forwards; pointer-events: none; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }

/* ---- me / stats ---- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { padding: 14px 15px; border-radius: var(--r-lg); background: var(--card-sheen), var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; min-width: 0; }
.kpi .k-label { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-label .ic { width: 15px; height: 15px; color: var(--gold-ink); }
.kpi .k-value { font-family: var(--font-ui); font-size: 23px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-foot { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi.hero { grid-column: 1 / -1; border-color: var(--line-gold); background: radial-gradient(120% 120% at 100% 0%, var(--gold-soft-2), transparent 60%), var(--card-sheen), var(--surface); }
.kpi.hero .k-value { font-size: 34px; color: var(--gold-ink); }
.delta-up { color: var(--success); font-weight: 600; }
.delta-down { color: var(--danger); font-weight: 600; }
.profile-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.profile-card .pc-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-row .rk { width: 24px; text-align: center; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rank-row .rk.top { color: var(--gold-ink); }
.rank-row .rb { flex: 1; min-width: 0; }
.rank-row .bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 5px; overflow: hidden; }
.rank-row .bar i { display: block; height: 100%; background: var(--gold-grad); border-radius: 2px; }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 10px; }
.section-head h3 { font-family: var(--font-display); font-size: 17px; }

/* ---- bar display ---- */
.bar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 14px 16px; }
.ticket { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-2); overflow: hidden; display: flex; flex-direction: column; animation: fade-up .3s var(--ease); }
.ticket-head { padding: 12px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px dashed var(--line-2); }
.ticket-head .tt { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--gold-ink); }
.ticket-head .age { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.ticket.late { border-color: rgba(237, 178, 90, .7); }
.ticket.late .age { color: var(--warning); }
.ticket.very-late { border-color: rgba(238, 116, 104, .7); }
.ticket.very-late .age { color: var(--danger); }
.ticket-items { padding: 8px 14px; flex: 1; }
.ticket-items .ti { display: flex; gap: 10px; padding: 6px 0; font-size: 15.5px; }
.ticket-items .ti b { color: var(--gold-ink); min-width: 28px; }
.ticket-items .ti small { display: block; color: var(--warning); font-size: 12.5px; }
.ticket-foot { padding: 10px 14px 14px; }

.offline-bar { position: fixed; top: calc(var(--safe-top) + 8px); left: 50%; transform: translateX(-50%); z-index: 1600; display: none; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
body.offline .offline-bar { display: flex; }

.pull-hint { text-align: center; font-size: 12px; color: var(--text-3); padding: 18px 0 0; }
.fade-in { animation: fade-up .35s var(--ease) both; }

/* =====================================================================
   ADMIN
   ===================================================================== */
.admin-body { min-height: 100vh; }
.admin { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 18px 14px 18px; display: flex; flex-direction: column; gap: 2px; z-index: 60;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; text-decoration: none !important; }
.side-brand .logo-mark { width: 42px; height: 42px; }
.side-brand .brand-word { font-size: 19px; letter-spacing: .14em; }
.side-brand .brand-sub { font-size: 12px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-group { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding: 16px 12px 6px; font-weight: 600; }
.side-link {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; position: relative; text-decoration: none !important; transition: background var(--t-fast), color var(--t-fast);
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
.side-link.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-grad); }
.side-link .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.side-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50; height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: var(--surface-glass); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--line);
}
.topbar .crumb { flex: 1; min-width: 0; font-size: 14px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb b { color: var(--text); font-weight: 600; }
.topbar .menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); text-decoration: none !important; }
.user-chip .avatar { width: 32px; height: 32px; font-size: 13px; }
.user-chip .uc-name { font-size: 13.5px; font-weight: 600; line-height: 1.15; }
.user-chip .uc-role { font-size: 11.5px; color: var(--text-3); line-height: 1.15; }
.content { padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: 27px; font-weight: 600; line-height: 1.2; }
.page-sub { color: var(--text-3); font-size: 14px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nav-overlay { display: none; }
@media (max-width: 1080px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: 284px; transform: translateX(-104%); transition: transform var(--t-slow) var(--ease); box-shadow: var(--shadow-lg); padding-top: calc(18px + var(--safe-top)); }
  .admin.nav-open .sidebar { transform: none; }
  .admin.nav-open .nav-overlay { display: block; position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
  .topbar { padding: var(--safe-top) 12px 0; height: calc(60px + var(--safe-top)); }
  .topbar .menu-btn { display: inline-grid; }
  .content { padding: 16px 14px calc(28px + var(--safe-bottom)); }
  .page-title { font-size: 23px; }
  .user-chip .uc-text { display: none; }
  .user-chip { padding: 3px; }
}

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { height: 40px; font-size: 14.5px; border-radius: 12px; width: auto; }
.toolbar .input-wrap .input { padding-left: 38px; }
.toolbar .input-wrap > .ic { left: 12px; width: 18px; height: 18px; }
.toolbar .grow-input { flex: 1; min-width: 200px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.dtable th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--text-3); padding: 11px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--surface); }
.dtable td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable tbody tr { transition: background var(--t-fast); }
.dtable tbody tr:hover td { background: var(--surface-2); }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable .r { text-align: right; font-variant-numeric: tabular-nums; }
.dtable .c { text-align: center; }
.dtable .num { font-variant-numeric: tabular-nums; }
.dtable tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; background: var(--surface-2); }
.dtable .t-main { font-weight: 600; }
.dtable .t-sub { font-size: 12.5px; color: var(--text-3); }
.dtable .thumb { width: 42px; height: 42px; border-radius: 10px; overflow: hidden; flex: none; display: grid; place-items: center; }
.dtable .thumb.pimg { aspect-ratio: auto; }
.dtable .thumb .ic { width: 22px; height: 22px; }
.dtable .actions { display: flex; gap: 4px; justify-content: flex-end; }
.dtable tr.muted-row td { opacity: .55; }
.dtable.compact td, .dtable.compact th { padding: 8px 12px; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 16px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 10px; display: inline-grid; place-items: center; border: 1px solid var(--line-2); color: var(--text-2); font-size: 14px; text-decoration: none !important; }
.pager .current { background: var(--gold-soft-2); border-color: var(--line-gold); color: var(--gold-ink); font-weight: 700; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-grid .kpi { padding: 18px; }
.kpi-grid .kpi .k-value { font-size: 27px; }
.kpi .k-spark { position: absolute; right: 12px; bottom: 12px; opacity: .9; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.dash-grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1080px) { .dash-grid, .dash-grid.even { grid-template-columns: minmax(0, 1fr); } }

.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs-line::-webkit-scrollbar { display: none; }
.tabs-line a, .tabs-line button { padding: 11px 14px; color: var(--text-3); font-weight: 600; font-size: 14.5px; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.tabs-line a:hover, .tabs-line button:hover { color: var(--text); }
.tabs-line .active { color: var(--gold-ink); border-bottom-color: var(--gold); }

.form-card { max-width: 980px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid .span-2 { grid-column: auto; } }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.img-drop { display: flex; gap: 14px; align-items: center; }
.img-drop .preview { width: 96px; height: 96px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line-2); flex: none; display: grid; place-items: center; background: var(--surface-2); }
.img-drop .preview img { width: 100%; height: 100%; object-fit: cover; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.icon-picker label { cursor: pointer; }
.icon-picker input { display: none; }
.icon-picker .ip { height: 48px; border-radius: 12px; border: 1px solid var(--line-2); display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.icon-picker .ip .ic { width: 24px; height: 24px; }
.icon-picker input:checked + .ip { border-color: var(--gold); background: var(--gold-soft-2); color: var(--gold-ink); }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-picker label { cursor: pointer; }
.color-picker input { display: none; }
.color-picker .sw { width: 32px; height: 32px; border-radius: 50%; background: var(--c); display: block; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2); transition: transform var(--t-fast); }
.color-picker input:checked + .sw { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--gold); transform: scale(1.05); }
.lines-table td { padding: 8px 10px; }
.lines-table .input { height: 40px; font-size: 14.5px; }

.slip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.slip-card { border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; transition: transform var(--t-fast), border-color var(--t-fast); text-align: left; padding: 0; font: inherit; color: inherit; }
.slip-card:hover { border-color: var(--line-gold); transform: translateY(-2px); }
.slip-card .sc-img { aspect-ratio: 3 / 4; background: #0b0a08; display: grid; place-items: center; overflow: hidden; position: relative; }
.slip-card .sc-img img { width: 100%; height: 100%; object-fit: cover; }
.slip-card .sc-img .noimg { color: var(--text-3); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.slip-card .sc-status { position: absolute; top: 10px; left: 10px; }
.slip-card .sc-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.slip-card .sc-amt { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.viewer { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 0; min-height: 0; }
.viewer .v-img { background: #050403; display: grid; place-items: center; overflow: auto; max-height: 76vh; cursor: zoom-in; }
.viewer .v-img img { max-width: 100%; max-height: 76vh; object-fit: contain; transition: transform .2s; }
.viewer .v-img.zoom { cursor: zoom-out; place-items: start; }
.viewer .v-img.zoom img { max-width: none; max-height: none; width: 180%; }
.viewer .v-info { padding: 18px; overflow-y: auto; max-height: 76vh; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 760px) { .viewer { grid-template-columns: minmax(0, 1fr); } .viewer .v-img, .viewer .v-img img { max-height: 52vh; } .viewer .v-info { max-height: none; } }
.match-box { padding: 14px; border-radius: var(--r-md); display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.match-box .amt { font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* charts — series colors validated (dataviz validator) against the card surface of each theme */
:root, [data-theme="dark"] { --series-1: #B98832; --series-2: #3987e5; --chart-grid: rgba(236, 214, 170, .08); --chart-base: rgba(236, 214, 170, .22); --chart-band: rgba(212, 178, 106, .07); }
[data-theme="light"] { --series-1: #A57E2C; --series-2: #2a78d6; --chart-grid: #ECE6DA; --chart-base: #CFC6B5; --chart-band: rgba(184, 145, 63, .08); }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font-ui); fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .grid line.base { stroke: var(--chart-base); }
.chart .hover-bands rect { fill: var(--chart-band); }
.chart .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-dot { stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; outline: none; }
.legend i.k-line { height: 3px; width: 14px; border-radius: 2px; }
.chart-tip { position: fixed; z-index: 2000; pointer-events: none; padding: 9px 12px; border-radius: 12px; background: var(--surface-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-size: 13px; line-height: 1.45; opacity: 0; transition: opacity .12s; min-width: 120px; }
.chart-tip.show { opacity: 1; }
.chart-tip .tt-title { font-weight: 700; margin-bottom: 2px; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.chart-tip .tt-row i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--gold-grad); }
.meter.warn i { background: var(--warning); }
.meter.danger i { background: var(--danger); }

/* ---------------- Print ---------------- */
@media print {
  .no-print, .sidebar, .topbar, .tabbar, .toast-host { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .admin { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ddd; background: #fff !important; }
  .dtable th { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
