/* ==========================================================================
   Brands Planets POS — design system
   Depth comes from layered shadows and edge highlights. Glass blur is used
   only on the chrome (sidebar, topbar, modals) so low-end tablets stay fast.
   ========================================================================== */

:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #eef2f7;
  --bg-glow-1: rgba(244, 123, 32, 0.10);
  --bg-glow-2: rgba(13, 43, 79, 0.10);
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eef2f8;
  --surface-glass: rgba(255, 255, 255, 0.74);
  --border: rgba(16, 34, 64, 0.08);
  --border-strong: rgba(16, 34, 64, 0.16);
  --text: #0e1a2b;
  --muted: #5f6b7d;
  --faint: #98a2b3;
  --brand: #0d2b4f;
  --brand-2: #1a4a80;
  --primary: linear-gradient(180deg, #1a4478 0%, #0d2b4f 100%);
  --primary-solid: #0d2b4f;
  --primary-ink: #ffffff;
  --accent: #f47b20;
  --accent-2: #ff9a4d;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e6;
  --accent-text: #c55a0b;
  --good: #0e9f59; --good-soft: #e6f7ee;
  --warn: #c98200; --warn-soft: #fff4dc;
  --bad: #dc3d36; --bad-soft: #fdecea;
  --info: #2f6fed; --info-soft: #e9f0ff;
  --focus-ring: 0 0 0 3px rgba(244, 123, 32, 0.35);
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -10px rgba(13, 43, 79, 0.22);
  --shadow-lg: 0 2px 6px rgba(16, 24, 40, 0.05), 0 24px 48px -18px rgba(13, 43, 79, 0.35);
  --shadow-xl: 0 40px 80px -24px rgba(8, 20, 40, 0.45);
  --sidebar-bg: linear-gradient(180deg, #0f2f56 0%, #0a2342 60%, #081b33 100%);
  --sidebar-text: rgba(255, 255, 255, 0.72);
  --sidebar-active: rgba(255, 255, 255, 0.10);
  --chart-1: #0d2b4f; --chart-2: #f47b20; --chart-3: #14a38b; --chart-4: #7a5af8; --chart-5: #e2a400; --chart-6: #e25574;
  --chart-grid: rgba(16, 34, 64, 0.07);
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --sidebar-w: 248px;
  --topbar-h: 68px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #080d17;
    --bg-glow-1: rgba(244, 123, 32, 0.08);
    --bg-glow-2: rgba(70, 120, 200, 0.10);
    --surface: #111a2a;
    --surface-2: #162134;
    --surface-3: #1b283e;
    --surface-glass: rgba(15, 23, 38, 0.74);
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #e8edf5;
    --muted: #9aa6ba;
    --faint: #66728a;
    --brand: #8db4e8;
    --brand-2: #b5cff2;
    --primary: linear-gradient(180deg, #2b5f9e 0%, #1d4679 100%);
    --primary-solid: #24548e;
    --accent-soft: rgba(244, 123, 32, 0.14);
    --accent-text: #ffab6b;
    --good-soft: rgba(14, 159, 89, 0.16); --good: #35c985;
    --warn-soft: rgba(226, 164, 0, 0.16); --warn: #f0b93b;
    --bad-soft: rgba(220, 61, 54, 0.16); --bad: #ff6b63;
    --info-soft: rgba(47, 111, 237, 0.18); --info: #7aa5ff;
    --edge: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px -12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.3), 0 26px 50px -18px rgba(0, 0, 0, 0.8);
    --sidebar-bg: linear-gradient(180deg, #0c1628 0%, #09111f 100%);
    --chart-1: #6f9bd6; --chart-grid: rgba(255, 255, 255, 0.06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d17;
  --bg-glow-1: rgba(244, 123, 32, 0.08);
  --bg-glow-2: rgba(70, 120, 200, 0.10);
  --surface: #111a2a;
  --surface-2: #162134;
  --surface-3: #1b283e;
  --surface-glass: rgba(15, 23, 38, 0.74);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8edf5;
  --muted: #9aa6ba;
  --faint: #66728a;
  --brand: #8db4e8;
  --brand-2: #b5cff2;
  --primary: linear-gradient(180deg, #2b5f9e 0%, #1d4679 100%);
  --primary-solid: #24548e;
  --accent-soft: rgba(244, 123, 32, 0.14);
  --accent-text: #ffab6b;
  --good-soft: rgba(14, 159, 89, 0.16); --good: #35c985;
  --warn-soft: rgba(226, 164, 0, 0.16); --warn: #f0b93b;
  --bad-soft: rgba(220, 61, 54, 0.16); --bad: #ff6b63;
  --info-soft: rgba(47, 111, 237, 0.18); --info: #7aa5ff;
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.3), 0 26px 50px -18px rgba(0, 0, 0, 0.8);
  --sidebar-bg: linear-gradient(180deg, #0c1628 0%, #09111f 100%);
  --chart-1: #6f9bd6; --chart-grid: rgba(255, 255, 255, 0.06);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--bg-glow-2), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num, .money { font-variant-numeric: tabular-nums; }
.ic { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
::selection { background: rgba(244, 123, 32, 0.25); }

/* -------------------------------------------------------------- controls */
.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--btn-bg); color: var(--btn-ink);
  font-weight: 650; font-size: 14.5px; white-space: nowrap;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm), var(--edge);
  transition: transform 0.12s var(--ease), box-shadow 0.2s var(--ease), background 0.2s, border-color 0.2s, opacity 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { box-shadow: var(--shadow-md), var(--edge); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); box-shadow: var(--shadow-sm); }
.btn[disabled], .btn.disabled { opacity: 0.45; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; box-shadow: 0 6px 16px -6px rgba(13, 43, 79, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-accent { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 20px -8px rgba(244, 123, 32, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-danger { background: linear-gradient(180deg, #f0544d, #d8352e); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -6px rgba(220, 61, 54, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn-soft { background: var(--surface-2); border-color: var(--border); box-shadow: none; }
.btn-whatsapp { background: linear-gradient(180deg, #2fd46b, #1fb257); color: #fff; border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: var(--radius-xs); }
.btn-lg { min-height: 54px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn-xl { min-height: 64px; padding: 0 26px; font-size: 18px; border-radius: 16px; font-weight: 750; }
.btn-block { width: 100%; }
.btn kbd, .kbd {
  font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.18); color: inherit; opacity: 0.85;
}
.btn-soft kbd, .btn:not(.btn-primary):not(.btn-accent):not(.btn-danger) kbd { background: var(--surface-3); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-grid; place-items: center; color: var(--muted);
  transition: background 0.15s, color 0.15s, transform 0.12s;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 650; color: var(--muted); letter-spacing: 0.01em; }
.field .hint { font-size: 12px; color: var(--faint); }
.input, .field input, .field select, .field textarea, .select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.04);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .select:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring);
}
.field input.invalid, .input.invalid, .field select.invalid, #confirmInput.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(220, 61, 54, 0.2); }
.field input[readonly] { background: var(--surface-2); }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon > input { padding-left: 44px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: 0.2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.2s var(--ease); }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section { display: grid; gap: 14px; }
.form-section + .form-section { margin-top: 22px; padding-top: 22px; border-top: 1px dashed var(--border-strong); }
.form-section-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.form-section-title .ic { color: var(--accent); }
.form-error { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-weight: 600; font-size: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong);
  font-weight: 650; font-size: 13.5px; color: var(--muted); white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip:active { transform: scale(0.96); }
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: transparent; box-shadow: 0 6px 14px -8px rgba(13, 43, 79, 0.6); }
.chip.sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chip-row::-webkit-scrollbar { display: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.promo-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 8px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em;
  color: #fff; background: linear-gradient(135deg, #ff8a3d, #f0561e);
  box-shadow: 0 4px 10px -4px rgba(240, 86, 30, 0.7);
}

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--edge);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; font-weight: 750; }
.card-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }
.lift { transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), var(--edge); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 12px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
.table th:first-child { border-top-left-radius: 12px; }
.table th:last-child { border-top-right-radius: 12px; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.clickable { cursor: pointer; }
.table .right, .right { text-align: right; }
.table .num, .table .right { white-space: nowrap; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.cell-main { font-weight: 650; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Data tables fit the frame: no sideways scrolling on any screen. */
.table.fit { table-layout: fixed; width: 100%; }
.table.fit td, .table.fit th { overflow: hidden; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.product-cell { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.thumb {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  object-fit: cover; background: var(--surface-3);
  display: grid; place-items: center;
  font-weight: 800; color: var(--muted); font-size: 14px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.thumb.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 12px; }
.thumb.lg { width: 64px; height: 64px; border-radius: 16px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; color: var(--muted); font-size: 13px; }

/* ----------------------------------------------------------------- login */
.login-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 600px at 15% 10%, rgba(244, 123, 32, 0.22), transparent 60%),
    radial-gradient(1000px 700px at 90% 90%, rgba(26, 74, 128, 0.35), transparent 60%),
    linear-gradient(160deg, #0b2240 0%, #0d2b4f 45%, #091a31 100%);
  perspective: 1400px;
}
.login-scene { position: absolute; inset: 0; pointer-events: none; transform-style: preserve-3d; transition: transform 0.4s var(--ease); }
.login-orb { position: absolute; border-radius: 50%; filter: blur(0.5px); opacity: 0.9; }
.login-orb.o1 { width: 340px; height: 340px; left: -80px; top: 12%; background: radial-gradient(circle at 30% 30%, #ffb070, #f47b20 45%, #b24a06 100%); box-shadow: 0 40px 90px -20px rgba(244, 123, 32, 0.6); transform: translateZ(40px); }
.login-orb.o2 { width: 220px; height: 220px; right: 8%; top: 8%; background: radial-gradient(circle at 30% 30%, #6c9bd8, #1d4b85 55%, #0b2240 100%); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6); transform: translateZ(80px); }
.login-orb.o3 { width: 120px; height: 120px; right: 22%; bottom: 10%; background: radial-gradient(circle at 30% 30%, #ffd2a8, #ff8a3d 60%, #c85a12 100%); transform: translateZ(120px); }
.login-ring { position: absolute; width: 760px; height: 760px; left: 50%; top: 50%; margin: -380px 0 0 -380px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.07); transform: rotateX(70deg); }
.login-ring.r2 { width: 1040px; height: 1040px; margin: -520px 0 0 -520px; border-color: rgba(244, 123, 32, 0.12); }
.login-card {
  position: relative; width: min(440px, 100%);
  padding: 34px 32px 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 50px 100px -30px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  color: #fff;
  transition: transform 0.4s var(--ease);
  transform-style: preserve-3d;
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; text-align: center; }
.login-logo { width: 96px; height: 96px; border-radius: 26px; background: #fff; padding: 6px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.55); transform: translateZ(30px); }
.login-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 20px; }
.login-brand h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.login-brand p { color: rgba(255, 255, 255, 0.7); font-size: 14px; }
.login-card .field > label { color: rgba(255, 255, 255, 0.78); }
.login-card .field input {
  background: rgba(255, 255, 255, 0.92); color: #0e1a2b; border-color: transparent; min-height: 52px; font-size: 16px;
}
.login-form { display: grid; gap: 16px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-wrap .icon-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); color: #5f6b7d; }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: rgba(255, 255, 255, 0.8); }
.login-row .check input { accent-color: var(--accent); }
.login-error { padding: 10px 14px; border-radius: 12px; background: rgba(220, 61, 54, 0.22); border: 1px solid rgba(255, 120, 110, 0.35); color: #ffe1de; font-size: 14px; font-weight: 600; }
.login-foot { margin-top: 20px; text-align: center; font-size: 12.5px; color: rgba(255, 255, 255, 0.5); }
.login-submit { min-height: 54px; font-size: 16px; }

/* ------------------------------------------------------------ app shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--sidebar-bg);
  color: #fff;
  box-shadow: 10px 0 40px -20px rgba(8, 20, 40, 0.5);
  transition: width 0.25s var(--ease), transform 0.25s var(--ease);
}
.side-head { display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 16px; flex: none; }
.side-logo { width: 42px; height: 42px; border-radius: 13px; background: #fff; padding: 3px; flex: none; box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.6); }
.side-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.side-brand { display: grid; line-height: 1.15; min-width: 0; }
.side-brand strong { font-size: 15.5px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.side-brand span { font-size: 11.5px; color: rgba(255, 255, 255, 0.55); white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 12px 12px; display: grid; align-content: start; gap: 2px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(255, 255, 255, 0.35); font-weight: 700; padding: 14px 12px 6px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 0 12px; border-radius: 12px;
  color: var(--sidebar-text); font-weight: 600; font-size: 14.5px;
  position: relative; white-space: nowrap; text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-item.active .ic { color: var(--accent-2); }
.nav-item .nav-badge { margin-left: auto; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: var(--accent); color: #fff; }
.nav-item.pos-link { background: linear-gradient(135deg, rgba(244, 123, 32, 0.22), rgba(244, 123, 32, 0.08)); color: #fff; }
.nav-item.pos-link .ic { color: var(--accent-2); }
.side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.07); display: grid; gap: 4px; }
.collapse-btn { color: rgba(255, 255, 255, 0.6); }
.collapse-btn .ic { transition: transform 0.25s var(--ease); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left 0.25s var(--ease); display: flex; flex-direction: column; min-height: 100vh; }
.app.collapsed { --sidebar-w: 78px; }
.app.collapsed .side-brand, .app.collapsed .nav-item span, .app.collapsed .nav-label, .app.collapsed .nav-badge { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 0; }
.app.collapsed .nav-item .nav-dot { position: absolute; top: 8px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.app.collapsed .side-head { justify-content: center; padding: 0; }
.app.collapsed .collapse-btn .ic { transform: rotate(180deg); }
.nav-dot { display: none; }
.app.collapsed .nav-dot { display: block; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid var(--border);
}
.topbar .mobile-menu { display: none; }
.top-title { display: none; font-weight: 800; }
.global-search { position: relative; flex: 1; max-width: 460px; }
.global-search input { width: 100%; min-height: 44px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 70px 0 42px; transition: 0.15s; }
.global-search input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: var(--focus-ring); }
.global-search > .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.global-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--faint); border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px 6px; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 8px; max-height: 420px; overflow-y: auto; z-index: 50;
}
.search-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 8px 10px 4px; }
.search-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; }
.search-item:hover, .search-item.active { background: var(--surface-2); }
.search-item small { display: block; color: var(--muted); font-size: 12px; }
.top-spacer { flex: 1; }
.top-meta { display: flex; align-items: center; gap: 8px; }
.top-pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.top-pill select { border: 0; background: transparent; font-weight: 650; color: var(--text); max-width: 150px; cursor: pointer; }
.top-pill select:focus { outline: none; }
.top-pill strong { color: var(--text); font-weight: 650; }
.sync-pill { cursor: pointer; transition: 0.15s; }
.sync-pill:hover { border-color: var(--border-strong); }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.sync-pill[data-status="syncing"] .sync-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); animation: blink 1s infinite; }
.sync-pill[data-status="offline"] .sync-dot, .sync-pill[data-status="auth"] .sync-dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
@keyframes blink { 50% { opacity: 0.35; } }
.notify-count { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 14px; transition: background 0.15s; }
.profile-btn:hover { background: var(--surface-2); }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 6px 14px -6px rgba(244, 123, 32, 0.7); flex: none; }
.avatar.navy { background: linear-gradient(135deg, #2b5f9e, #0d2b4f); box-shadow: 0 6px 14px -6px rgba(13, 43, 79, 0.7); }
.profile-copy { display: grid; line-height: 1.15; text-align: left; }
.profile-copy strong { font-size: 13.5px; }
.profile-copy small { font-size: 11.5px; color: var(--muted); }
.dropdown {
  position: absolute; right: 16px; top: calc(var(--topbar-h) - 6px); z-index: 60;
  width: 300px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px;
  animation: pop 0.18s var(--ease);
}
.dropdown-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 11px; font-weight: 600; font-size: 14px; text-align: left; }
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--bad); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin: 4px; }
.theme-switch button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 9px; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.theme-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.notif-panel { width: 380px; max-height: 70vh; overflow-y: auto; right: 120px; }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 12px; }
.notif-item + .notif-item { border-top: 1px solid var(--border); }
.notif-item:hover { background: var(--surface-2); }
.notif-body { flex: 1; min-width: 0; text-align: left; }
.notif-item .icon-btn { flex: none; }
.notif-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.notif-item strong { display: block; font-size: 14px; }
.notif-item p { font-size: 13px; color: var(--muted); }
.notif-item small { font-size: 11.5px; color: var(--faint); }

.offline-banner {
  display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap;
  padding: 10px 16px; font-size: 14px; font-weight: 650;
  background: linear-gradient(90deg, #c7372f, #e0513f); color: #fff;
}
.offline-banner.auth { background: linear-gradient(90deg, #b36200, #d98200); }
.offline-banner .btn { min-height: 32px; font-size: 13px; background: rgba(255, 255, 255, 0.2); color: #fff; border-color: rgba(255, 255, 255, 0.3); box-shadow: none; }

.content { flex: 1; padding: 24px; min-width: 0; }
.view { animation: viewIn 0.32s var(--ease); }
/* Fade only: a transform here would re-anchor the POS's pinned cart bar. */
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 14px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 20px; }
.toolbar .input-icon { flex: 1; min-width: 220px; }
.toolbar select, .toolbar input[type=date] { width: auto; min-width: 150px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { min-height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; transition: 0.15s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), var(--edge); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.segmented button { min-height: 34px; padding: 0 12px; border-radius: 9px; font-weight: 650; font-size: 13px; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }

/* ----------------------------------------------------------- KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.kpi {
  position: relative; overflow: hidden;
  padding: 18px 18px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md), var(--edge);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  animation: rise 0.45s var(--ease) both;
}
.kpi:hover { transform: translateY(-3px) rotateX(2deg); box-shadow: var(--shadow-lg), var(--edge); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--kpi-tint, var(--surface-3)); opacity: 0.55; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; z-index: 1; }
.kpi-label { font-size: 13px; font-weight: 650; color: var(--muted); }
.kpi-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--kpi-tint, var(--surface-3)); color: var(--kpi-ink, var(--text)); }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; margin-top: 12px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; position: relative; z-index: 1; }
.kpi.t-accent { --kpi-tint: var(--accent-soft); --kpi-ink: var(--accent-text); }
.kpi.t-good { --kpi-tint: var(--good-soft); --kpi-ink: var(--good); }
.kpi.t-warn { --kpi-tint: var(--warn-soft); --kpi-ink: var(--warn); }
.kpi.t-bad { --kpi-tint: var(--bad-soft); --kpi-ink: var(--bad); }
.kpi.t-info { --kpi-tint: var(--info-soft); --kpi-ink: var(--info); }
.kpi.hero { background: linear-gradient(145deg, #173f6e 0%, #0d2b4f 55%, #0a2140 100%); color: #fff; border-color: transparent; box-shadow: 0 24px 50px -22px rgba(13, 43, 79, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.kpi.hero .kpi-label, .kpi.hero .kpi-sub { color: rgba(255, 255, 255, 0.7); }
.kpi.hero .kpi-icon { background: rgba(255, 255, 255, 0.12); color: #ffb070; }
.kpi.hero::after { background: radial-gradient(circle, rgba(244, 123, 32, 0.45), transparent 70%); opacity: 1; width: 160px; height: 160px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.kpi-grid .kpi:nth-child(2) { animation-delay: 0.03s; }
.kpi-grid .kpi:nth-child(3) { animation-delay: 0.06s; }
.kpi-grid .kpi:nth-child(4) { animation-delay: 0.09s; }
.kpi-grid .kpi:nth-child(5) { animation-delay: 0.12s; }
.kpi-grid .kpi:nth-child(n+6) { animation-delay: 0.15s; }

.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 220px; }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow strong { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .grow small { font-size: 12.5px; color: var(--muted); }
.rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-3); color: var(--muted); flex: none; }
.rank.r1 { background: linear-gradient(135deg, #ffcf70, #f2a007); color: #5a3a00; }
.rank.r2 { background: linear-gradient(135deg, #e4e9f1, #b8c2d1); color: #3b4556; }
.rank.r3 { background: linear-gradient(135deg, #f1c6a2, #cf8a54); color: #4d2a0c; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.meter.bad > span { background: var(--bad); }
.meter.warn > span { background: var(--warn); }

.empty-state { display: grid; justify-items: center; gap: 8px; padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-state .ic { color: var(--faint); margin-bottom: 4px; }
.empty-state strong { color: var(--text); font-size: 15px; }
.empty-state p { font-size: 13.5px; max-width: 360px; }

.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton-list { display: grid; gap: 14px; padding: 8px 0; }
.skeleton-row { display: flex; align-items: center; gap: 12px; }
.sk-circle { width: 40px; height: 40px; border-radius: 12px; }
.sk-line { height: 12px; flex: 1; }
.sk-line.short { flex: 0 0 25%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ POS */
.content.pos-mode { padding: 16px; }
.pos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 32px);
  min-height: 560px;
}
.pos-left, .pos-right { min-height: 0; display: flex; flex-direction: column; }
.pos-left { gap: 12px; }
.pos-search { display: flex; gap: 10px; align-items: center; }
.pos-search .scan-box { position: relative; flex: 1; }
.pos-search .scan-box input {
  width: 100%; min-height: 58px; padding: 0 130px 0 54px;
  border-radius: 18px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 17px; font-weight: 550;
  box-shadow: var(--shadow-md), var(--edge);
  transition: 0.15s;
}
.pos-search .scan-box input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring), var(--shadow-md); }
.pos-search .scan-box > .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--accent); }
.scan-hint { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--faint); pointer-events: none; }
.scan-live { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.product-grid {
  flex: 1; overflow-y: auto; min-height: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  grid-auto-rows: max-content;
  gap: 12px; align-content: start; padding: 2px 4px 12px 2px;
  scrollbar-width: thin;
}
.p-card {
  position: relative; display: flex; flex-direction: column; text-align: left;
  border-radius: 18px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm), var(--edge);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s;
  content-visibility: auto; contain-intrinsic-size: 250px;
}
.p-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), var(--edge); border-color: var(--border-strong); }
.p-card:active { transform: translateY(0) scale(0.97); box-shadow: var(--shadow-sm); }
.p-card.out { opacity: 0.55; }
.p-card.flash { animation: flash 0.45s var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(244, 123, 32, 0.6); } 100% { box-shadow: 0 0 0 14px rgba(244, 123, 32, 0); } }
.p-media { position: relative; flex: none; aspect-ratio: 4 / 3; background: linear-gradient(145deg, var(--surface-3), var(--surface-2)); display: grid; place-items: center; overflow: hidden; }
.p-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.p-card:hover .p-media img { transform: scale(1.05); }
.p-initial { font-size: 30px; font-weight: 800; color: var(--faint); letter-spacing: -0.02em; }
.p-media .promo-badge { position: absolute; left: 8px; top: 8px; }
.p-stock { position: absolute; right: 8px; bottom: 8px; }
.p-info { padding: 10px 12px 12px; display: grid; gap: 3px; }
.p-name { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-variants { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-price { font-weight: 800; font-size: 16px; color: var(--text); margin-top: 4px; font-variant-numeric: tabular-nums; }
.show-more { grid-column: 1 / -1; justify-self: center; }

.cart-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg), var(--edge); overflow: hidden; }
.cart-customer { padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.customer-chip { display: flex; align-items: center; gap: 12px; }
.customer-chip .grow { flex: 1; min-width: 0; }
.customer-chip strong { display: block; font-size: 14.5px; }
.customer-chip small { font-size: 12px; color: var(--muted); }
.customer-search { position: relative; margin-top: 10px; }
.customer-search input { min-height: 44px; }
.customer-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 280px; overflow-y: auto; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
.cart-head h3 { font-size: 15px; font-weight: 750; display: flex; align-items: center; gap: 8px; }
.cart-count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
.cart-lines { flex: 1; overflow-y: auto; min-height: 0; padding: 4px 12px 8px; }
.cart-line {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 6px 10px;
  grid-template-areas: "thumb info total" "thumb controls controls";
  padding: 10px; border-radius: 16px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--border);
  animation: slideIn 0.22s var(--ease);
  transition: border-color 0.2s, background 0.2s;
}
.cart-line.has-free { border-color: rgba(244, 123, 32, 0.45); background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.cart-line .thumb { width: 48px; height: 48px; }
.cl-thumb { grid-area: thumb; }
.cl-info { grid-area: info; min-width: 0; }
.cl-controls { grid-area: controls; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cart-line .cl-total { grid-area: total; }
.cl-name { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cl-sub { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-variants { display: flex; gap: 6px; flex-wrap: wrap; }
.cl-variants select { min-height: 34px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 13px; font-weight: 600; max-width: 110px; }
.cl-right { display: grid; justify-items: end; align-content: space-between; gap: 8px; }
.cl-total { font-weight: 800; font-size: 14.5px; font-variant-numeric: tabular-nums; text-align: right; }
.cl-total s { display: block; font-size: 11.5px; color: var(--faint); font-weight: 600; }
.free-tag { font-size: 10.5px; font-weight: 800; color: var(--accent-text); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; letter-spacing: 0.03em; }
.qty { display: inline-flex; align-items: center; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.qty button { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--text); transition: background 0.12s, transform 0.1s; }
.qty button:hover { background: var(--surface-3); }
.qty button:active { transform: scale(0.9); }
.qty strong { min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.cart-empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 40px 16px; color: var(--muted); }
.cart-empty .ic { color: var(--faint); }

.promo-banner {
  margin: 0 12px 8px; padding: 12px 14px; border-radius: 16px;
  display: flex; align-items: center; gap: 12px; font-size: 13.5px; font-weight: 650;
  background: var(--accent-soft); color: var(--accent-text);
  border: 1px dashed rgba(244, 123, 32, 0.5);
}
.promo-banner.unlocked {
  background: linear-gradient(135deg, #ff9448, #f0561e); color: #fff; border: 0;
  box-shadow: 0 14px 28px -12px rgba(240, 86, 30, 0.7);
  animation: unlock 0.5s var(--ease);
}
.promo-banner .pb-icon { font-size: 22px; line-height: 1; }
.promo-banner strong { display: block; font-size: 14px; letter-spacing: 0.02em; }
.promo-banner small { display: block; font-weight: 600; opacity: 0.9; font-size: 12.5px; }
@keyframes unlock { 0% { transform: scale(0.94); opacity: 0; } 60% { transform: scale(1.02); opacity: 1; } 100% { transform: none; } }

.cart-summary { padding: 12px 16px 16px; border-top: 1px solid var(--border); background: var(--surface-2); display: grid; gap: 10px; }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sum-row strong { color: var(--text); font-weight: 700; }
.sum-row.promo { color: var(--accent-text); font-weight: 650; }
.sum-row.promo strong { color: var(--accent-text); }
.sum-row.total { font-size: 15px; color: var(--text); font-weight: 700; padding-top: 8px; border-top: 1px dashed var(--border-strong); }
.sum-row.total strong { font-size: 26px; font-weight: 850; letter-spacing: -0.02em; }
.cart-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cart-actions .btn { min-height: 48px; padding: 0 8px; font-size: 13.5px; min-width: 0; overflow: hidden; }
.cart-lines { min-height: 90px; }
.checkout-btn { min-height: 64px; font-size: 18px; justify-content: space-between; padding: 0 22px; }
.checkout-btn .amt { font-variant-numeric: tabular-nums; font-weight: 850; }
.mobile-cart-bar { display: none; }

/* checkout modal */
.checkout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; }
.due-card { border-radius: 20px; padding: 20px; background: linear-gradient(145deg, #173f6e, #0d2b4f 60%, #0a2140); color: #fff; box-shadow: 0 20px 40px -20px rgba(13, 43, 79, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.due-card small { color: rgba(255, 255, 255, 0.65); font-weight: 650; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.due-card .due-amount { font-size: 40px; font-weight: 850; letter-spacing: -0.03em; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.due-lines { display: grid; gap: 6px; font-size: 13.5px; color: rgba(255, 255, 255, 0.8); padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.due-lines div { display: flex; justify-content: space-between; }
.due-lines .promo { color: #ffb070; font-weight: 700; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pay-method {
  display: grid; justify-items: center; gap: 6px; padding: 14px 8px; border-radius: 16px;
  background: var(--surface); border: 1.5px solid var(--border-strong);
  font-weight: 700; font-size: 13.5px; color: var(--muted);
  transition: 0.15s var(--ease); min-height: 84px; align-content: center;
}
.pay-method:hover { border-color: var(--faint); color: var(--text); transform: translateY(-2px); }
.pay-method.active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); box-shadow: 0 10px 22px -14px rgba(244, 123, 32, 0.9); }
.cash-input input { font-size: 28px; font-weight: 800; min-height: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.quick-cash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-cash .btn { min-height: 44px; padding: 0 6px; font-size: 13.5px; }
.change-box { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-radius: 16px; background: var(--good-soft); color: var(--good); font-weight: 700; }
.change-box strong { font-size: 30px; font-weight: 850; font-variant-numeric: tabular-nums; }
.change-box.short { background: var(--bad-soft); color: var(--bad); }
.split-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.success-view { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 10px 0 4px; }
.success-check { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #3ddc84, #0e9f59); color: #fff; box-shadow: 0 20px 40px -14px rgba(14, 159, 89, 0.7); animation: popIn 0.5s var(--ease); }
.success-check .ic { stroke-width: 3; }
.success-check path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 0.45s 0.2s var(--ease) forwards; }
@keyframes popIn { 0% { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success-view h2 { font-size: 24px; font-weight: 850; }
.success-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 14px; }
.success-actions .btn { min-height: 60px; flex-direction: column; gap: 4px; font-size: 13.5px; }

.held-list { display: grid; gap: 10px; }
.held-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); }
.held-item strong { display: block; }
.held-item small { color: var(--muted); font-size: 12.5px; }

.variant-pick { display: grid; gap: 14px; }
.variant-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-btn { min-width: 64px; min-height: 52px; padding: 6px 12px; border-radius: 14px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; justify-items: center; font-weight: 750; transition: 0.15s; }
.variant-btn small { font-size: 11px; font-weight: 600; color: var(--muted); }
.variant-btn:hover { border-color: var(--accent); }
.variant-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ---------------------------------------------------------------- modals */
#modalRoot { position: relative; z-index: 100; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: rgba(8, 16, 30, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.18s var(--ease);
}
.modal-backdrop.open { opacity: 1; }
.modal-backdrop.closing { opacity: 0; }
.modal {
  width: 100%; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow-xl), var(--edge);
  transform: translateY(14px) scale(0.98); transition: transform 0.24s var(--ease);
  overflow: hidden;
}
.modal-backdrop.open .modal { transform: none; }
.modal-sm { max-width: 440px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 880px; }
.modal-xl { max-width: 1120px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { font-size: 19px; font-weight: 800; }
.modal-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.confirm-body { display: grid; justify-items: center; text-align: center; gap: 10px; padding-top: 8px; }
.confirm-body h3 { font-size: 19px; font-weight: 800; }
.confirm-body p { color: var(--muted); font-size: 14.5px; }
.confirm-body .field { width: 100%; text-align: left; margin-top: 6px; }
.confirm-icon { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; }
.confirm-icon.tone-danger { background: var(--bad-soft); color: var(--bad); }
.confirm-icon.tone-primary { background: var(--info-soft); color: var(--info); }
.confirm-modal .modal-foot .btn { flex: 1; }

/* ---------------------------------------------------------------- toasts */
/* Top-centre, below the top bar: never covers the cart or the Checkout button. */
.toasts { position: fixed; z-index: 200; left: 50%; top: calc(var(--topbar-h) + 12px); transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast {
  pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  min-width: 260px; max-width: 420px; padding: 12px 16px 12px 12px;
  border-radius: 16px; background: rgba(17, 26, 42, 0.94); color: #fff;
  box-shadow: 0 20px 40px -14px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  font-weight: 600; font-size: 14px;
  animation: toastIn 0.3s var(--ease);
}
.toast.leaving { animation: toastOut 0.22s var(--ease) forwards; }
.toast-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; background: rgba(53, 201, 133, 0.2); color: #4be39a; }
.toast-error .toast-icon { background: rgba(255, 107, 99, 0.2); color: #ff8a84; }
.toast-warn .toast-icon { background: rgba(240, 185, 59, 0.2); color: #ffd27a; }
.toast-info .toast-icon { background: rgba(122, 165, 255, 0.2); color: #9dbdff; }
.toast-promo { background: linear-gradient(135deg, #ff8a3d, #e5501a); }
.toast-promo .toast-icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

.confetti-layer { position: fixed; z-index: 300; width: 0; height: 0; pointer-events: none; }
.confetti-layer i { position: absolute; width: 8px; height: 12px; border-radius: 2px; animation: confetti 0.9s var(--ease) forwards; }
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), calc(var(--dy) + 60px)) rotate(320deg); opacity: 0; } }
.pulse { animation: pulseAnim 0.4s var(--ease); }
@keyframes pulseAnim { 50% { transform: scale(1.06); } }

/* ------------------------------------------- full-width info cards (products / inventory) */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.info-grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.info-card {
  display: grid; gap: 14px; align-content: start; padding: 16px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm), var(--edge); cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s;
}
.info-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg), var(--edge); border-color: var(--border-strong); }
.info-card { position: relative; }
.info-card.picked, .table tr.picked { border-color: var(--accent); background: var(--accent-soft); }
.pick-box { position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border-strong); cursor: pointer; }
.pick-box input, .table td input[type="checkbox"], .table th input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.select-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 16px 12px; padding: 10px 14px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 14px;
  border: 1px dashed rgba(244, 123, 32, 0.45);
}
.info-card-head { display: flex; align-items: flex-start; gap: 12px; padding-right: 34px; }
.info-card-head .grow { flex: 1; min-width: 0; }
.info-title { font-weight: 750; font-size: 15.5px; line-height: 1.3; }
.info-price { font-weight: 850; font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.info-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.info-fields > div { padding: 8px 10px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.info-fields small { display: block; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.info-fields strong { display: block; font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }
.info-actions { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 12px; }
.variant-list { display: grid; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.variant-line { display: grid; grid-template-columns: 0.7fr 1fr 1.4fr 0.7fr 1.2fr auto; gap: 8px; align-items: center; padding: 9px 12px; font-size: 13.5px; border-top: 1px solid var(--border); }
.variant-line:first-child { border-top: 0; }
.variant-line-head { background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.info-card .variant-list, .info-grid.wide .info-card { cursor: default; }
@media (max-width: 560px) {
  .variant-line { grid-template-columns: 1fr 1fr auto; }
  .variant-line > :nth-child(3), .variant-line > :nth-child(5) { display: none; }
}

/* ------------------------------------------------------------ misc views */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.detail { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.detail small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.detail strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.variant-matrix { display: grid; gap: 8px; }
.variant-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 150px 110px 40px; gap: 8px; align-items: center; }
.variant-row input { min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); width: 100%; }
.variant-row .vr-label { font-weight: 700; font-size: 14px; }
.variant-head { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.size-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.size-picker label { position: relative; }
.size-picker input { position: absolute; opacity: 0; }
.size-picker span { display: grid; place-items: center; min-width: 52px; min-height: 42px; padding: 0 10px; border-radius: 12px; border: 1.5px solid var(--border-strong); font-weight: 750; cursor: pointer; transition: 0.12s; }
.size-picker input:checked + span { background: var(--primary); color: #fff; border-color: transparent; }
.size-picker input:focus-visible + span { box-shadow: var(--focus-ring); }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; min-height: 46px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); align-items: center; }
.tag-input input { border: 0; min-height: 32px; padding: 0 6px; flex: 1; min-width: 120px; background: transparent; box-shadow: none; }
.tag-input input:focus { outline: none; box-shadow: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 8px; background: var(--surface-3); font-weight: 650; font-size: 13px; }
.tag button { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.tag button:hover { background: var(--bad-soft); color: var(--bad); }
.image-drop { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; border: 1.5px dashed var(--border-strong); background: var(--surface-2); }
.image-drop .thumb { width: 72px; height: 72px; border-radius: 14px; }
.promo-card { position: relative; padding: 20px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md), var(--edge); display: grid; gap: 12px; overflow: hidden; transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.promo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), var(--edge); }
.promo-card::before { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(244, 123, 32, 0.22), transparent 70%); }
.promo-card.live { border-color: rgba(244, 123, 32, 0.4); }
.promo-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.promo-title h3 { font-size: 17px; font-weight: 800; }
.promo-rule { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; background: linear-gradient(135deg, #ff8a3d, #e5501a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.promo-meta { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.promo-meta span { display: flex; gap: 8px; align-items: center; }
.promo-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.promo-stats div { padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.promo-stats small { display: block; font-size: 11px; color: var(--muted); font-weight: 650; }
.promo-stats strong { font-size: 14px; }
.return-line { display: grid; grid-template-columns: auto 48px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.return-line.selected { border-color: var(--accent); background: var(--accent-soft); }
.return-line.disabled { opacity: 0.5; }
.summary-box { display: grid; gap: 8px; padding: 16px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); }
.big-amount { font-size: 28px; font-weight: 850; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.perm-grid label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.perm-grid input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.role-card { display: flex; align-items: center; gap: 14px; }
.audit-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.audit-item:last-child { border-bottom: 0; }
.shortcut-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.shortcut-grid div { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; font-weight: 600; }
.shortcut-grid kbd { font: 700 12px var(--font); padding: 4px 8px; border-radius: 7px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 2px 0 var(--border-strong); }
.invoice-preview { background: #fff; color: #111; border-radius: 16px; padding: 8px; max-width: 360px; margin: 0 auto; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.attendance-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: end; }

/* --------------------------------------------------------------- receipt */
#printArea { display: none; }
.receipt { width: 72mm; margin: 0 auto; padding: 4mm 2mm; font-family: "Inter", Arial, sans-serif; font-size: 11.5px; line-height: 1.35; color: #000; }
.receipt .r-center { text-align: center; }
.receipt .r-logo { width: 26mm; margin: 0 auto 2mm; }
.receipt h1 { font-size: 18px; font-weight: 900; letter-spacing: 0.08em; margin: 0; text-align: center; }
.receipt .r-sub { text-align: center; font-size: 10.5px; }
.receipt .r-copy { display: inline-block; margin-top: 2mm; padding: 1px 8px; border: 1px solid #000; border-radius: 99px; font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; }
.receipt .r-line { border-top: 1px dashed #000; margin: 2.5mm 0; }
.receipt .r-meta { display: grid; gap: 1px; }
.receipt .r-meta div, .receipt .r-tot div { display: flex; justify-content: space-between; gap: 8px; }
.receipt .r-item { margin-bottom: 1.8mm; }
.receipt .r-item-top { display: flex; justify-content: space-between; gap: 6px; font-weight: 700; }
.receipt .r-item-sub { display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; }
.receipt .r-free { font-weight: 800; font-size: 10px; }
.receipt .r-tot { display: grid; gap: 1px; }
.receipt .r-grand { font-size: 15px; font-weight: 900; padding: 1.5mm 0; border-top: 1px solid #000; border-bottom: 1px solid #000; margin: 1mm 0; }
.receipt .r-promo { border: 1.5px solid #000; border-radius: 3mm; padding: 2mm; text-align: center; margin: 2mm 0; }
.receipt .r-promo strong { display: block; font-size: 13px; letter-spacing: 0.06em; }
.receipt .r-thanks { text-align: center; font-weight: 700; margin-top: 2mm; }
.receipt .r-foot { font-size: 10px; }
.receipt .r-barcode { text-align: center; font-family: monospace; font-size: 10px; letter-spacing: 0.1em; margin-top: 2mm; }

@media print {
  @page { size: 80mm auto; margin: 0; }
  body.receipt-printing { background: #fff !important; }
  body.receipt-printing > *:not(#printArea) { display: none !important; }
  body.receipt-printing #printArea { display: block !important; }
  .receipt-page { page-break-after: always; }
  .receipt-page:last-child { page-break-after: auto; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1440px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pos { grid-template-columns: minmax(0, 1fr) 400px; }
  .top-pill.hide-lg { display: none; }
}
@media (max-width: 1280px) {
  .scan-hint { display: none; }
  .pos-search .scan-box input { padding-right: 16px; font-size: 16px; }
  .cart-actions kbd { display: none; }
}
/* Short screens (small laptops): the cart grows with its items and the page scrolls. */
@media (max-height: 760px) and (min-width: 961px) {
  .pos { height: auto; min-height: 0; align-items: start; }
  .pos-left { position: sticky; top: calc(var(--topbar-h) + 16px); height: calc(100vh - var(--topbar-h) - 32px); }
  .pos-right { position: sticky; top: calc(var(--topbar-h) + 16px); }
  .cart-panel { flex: none; }
  .cart-lines { max-height: 38vh; }
  .customer-chip small { display: none; }
  .cart-customer { padding: 10px 14px; }
  .customer-search { margin-top: 8px; }
  .checkout-btn { min-height: 56px; }
}
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split-main { grid-template-columns: 1fr; }
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .profile-copy { display: none; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-pill.hide-md { display: none; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-105%); width: 272px; }
  .app.menu-open .sidebar { transform: none; }
  .app.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 35; background: rgba(8, 16, 30, 0.45); }
  .app.collapsed { --sidebar-w: 248px; }
  .app.collapsed .side-brand, .app.collapsed .nav-item span, .app.collapsed .nav-label { display: initial; }
  .app.collapsed .nav-item { justify-content: flex-start; padding: 0 12px; }
  .main { margin-left: 0; }
  .collapse-btn { display: none; }
  .topbar .mobile-menu { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 16px; }
  /* Phone/tablet: the cart sits under the products — customer, items,
     discount and totals are all on the page, nothing hidden in a drawer. */
  .pos { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .pos-left { min-width: 0; padding-bottom: 0; }
  .pos-right { position: static; height: auto; transform: none; padding: 0; }
  .pos-right .cart-panel { border-radius: 22px; }
  .cart-lines { max-height: none; overflow: visible; }
  /* Show a couple of rows of products, then the cart — the grid scrolls inside. */
  .product-grid {
    max-height: 37vh; overflow-y: auto; padding-right: 4px;
    border-radius: 18px;
    scrollbar-width: thin;
  }
  .content.pos-mode { padding-bottom: 92px; }
  .mobile-cart-bar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 44;
    min-height: 62px; border-radius: 20px; padding: 0 10px 0 16px;
    align-items: center; justify-content: space-between; gap: 10px;
    background: var(--primary); color: #fff; font-weight: 750;
    box-shadow: 0 20px 40px -16px rgba(13, 43, 79, 0.8);
  }
  .mobile-cart-bar .btn { min-height: 44px; white-space: nowrap; }
  .mobile-cart-bar .bar-total { display: grid; line-height: 1.2; text-align: left; }
  .mobile-cart-bar .bar-total small { font-size: 11.5px; opacity: 0.75; font-weight: 600; }
  .checkout { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .dropdown { right: 8px; left: 8px; width: auto; }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .content.pos-mode { padding: 12px; }
  /* Everything fits the screen width: no sideways scrolling anywhere. */
  .chip-row { flex-wrap: wrap; overflow: visible; }
  .chip { min-height: 34px; padding: 0 11px; font-size: 12.5px; }
  .tabs, .segmented { flex-wrap: wrap; overflow: visible; }
  .tab { min-height: 36px; padding: 0 11px; font-size: 13px; }
  .table-wrap { overflow: visible; }
  /* Tables become one card per row, with the column name beside each value. */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
    margin-bottom: 10px; padding: 4px 0; box-shadow: var(--shadow-sm);
  }
  .table tbody tr:hover { background: var(--surface); }
  .table td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    text-align: right; border: 0; padding: 7px 14px; min-width: 0;
  }
  .table td::before {
    content: attr(data-label); flex: none; text-align: left;
    font-size: 11.5px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.04em;
  }
  .table td:not([data-label]) { justify-content: flex-start; text-align: left; }
  .table td.right, .table td .right { text-align: right; }
  .table td .product-cell, .table td .actions, .table td .cell-sub, .table td > div { min-width: 0; }
  .table td .actions { justify-content: flex-end; flex-wrap: wrap; }
  .table td[data-label=""]::before { display: none; }
  /* Desktop column widths/clipping must not cut values short on a phone. */
  .table td { max-width: none !important; }
  .table td > div, .table td .cell-sub { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
  .pager { flex-wrap: wrap; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-fields { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 20px; }
  .kpi-icon { width: 32px; height: 32px; }
  .global-search { display: none; }
  .top-title { display: block; }
  .top-pill { display: none; }
  .top-pill.sync-pill { display: inline-flex; padding: 0 10px; }
  .top-pill.sync-pill .sync-label { display: none; }
  .page-head h1 { font-size: 22px; }
  .form-grid, .form-grid-3, .grid-3 { grid-template-columns: 1fr; }
  .pay-methods { grid-template-columns: repeat(2, 1fr); }
  .quick-cash { grid-template-columns: repeat(2, 1fr); }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 94vh; border-radius: 24px 24px 0 0; }
  .variant-row { grid-template-columns: minmax(0, 1fr) 90px 40px; }
  .variant-row .vr-barcode, .variant-row .vr-sku { display: none; }
  .split-row { grid-template-columns: 1fr 1fr auto; }
  .split-row .split-ref { grid-column: 1 / -1; }
  .return-line { grid-template-columns: auto 40px minmax(0, 1fr); }
  .return-line > :nth-child(n+4) { grid-column: 3; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .toast { min-width: 0; }
  .table td, .table th { padding: 10px; }
  .success-actions { grid-template-columns: 1fr; }
  .attendance-hero { grid-template-columns: 1fr; }
}
.cart-sheet-close { display: none !important; }

/* ------------------------------------------------ motion / low-end mode */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
html.lite *, html.lite *::before, html.lite *::after { animation: none !important; transition: none !important; }
html.lite .topbar, html.lite .modal-backdrop, html.lite .login-card, html.lite .toast { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
html.lite .topbar { background: var(--surface); }
html.lite .p-card:hover, html.lite .kpi:hover, html.lite .lift:hover, html.lite .btn:hover { transform: none; }
