/* =====================================================================
   Sales System — "Aurora" theme
   Drifting colour glows, frosted glass bars, gradient brand, purposeful motion.
   All motion is disabled for people who ask their device to reduce motion.
   ===================================================================== */
:root {
  /* accent palette: three colours every gradient, glow and highlight is built from (set by the theme picker) */
  --a1: #14b8a6; --a2: #5b7cfa; --a3: #a855f7;
  --bg: #f3f5fa; --surface: #ffffff; --surface-2: #f4f6fb; --surface-3: #eceff7;
  --glass: rgba(255, 255, 255, .72); --glass-border: rgba(255, 255, 255, .7);
  --text: #121826; --muted: #5d6779; --border: #e3e7f0;
  --primary: color-mix(in srgb, var(--a1) 72%, #000);
  --primary-hover: color-mix(in srgb, var(--a1) 60%, #000);
  --primary-soft: color-mix(in srgb, var(--a1) 13%, #fff);
  --accent: color-mix(in srgb, var(--a2) 82%, #000);
  --accent-2: var(--a3);
  --success: #15803d; --success-soft: #e3f6e9; --warn: #b45309; --warn-soft: #fdf1dc;
  --danger: #c0262d; --danger-soft: #fde7e8; --info: #3b5bdb; --info-soft: #e7edff;
  --grad: linear-gradient(135deg, var(--a1) 0%, var(--a2) 55%, var(--a3) 100%);
  --grad-warm: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%);
  --grad-text: linear-gradient(100deg, color-mix(in srgb, var(--a1) 70%, #000) 0%, color-mix(in srgb, var(--a2) 78%, #000) 50%, color-mix(in srgb, var(--a3) 78%, #000) 100%);
  --aurora-1: color-mix(in srgb, var(--a1) 30%, transparent);
  --aurora-2: color-mix(in srgb, var(--a2) 24%, transparent);
  --aurora-3: color-mix(in srgb, var(--a3) 18%, transparent);
  --radius: 16px; --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(18, 24, 38, .04), 0 4px 14px rgba(18, 24, 38, .06);
  --shadow-lg: 0 2px 6px rgba(18, 24, 38, .06), 0 18px 40px rgba(18, 24, 38, .12);
  --glow: 0 6px 22px color-mix(in srgb, var(--a2) 35%, transparent);
  --font: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --c1: color-mix(in srgb, var(--a1) 75%, #000); --c2: #2563eb; --c3: #d97706; --c4: #dc2626; --c5: #7c3aed; --c6: #db2777; --c-prev: #94a3b8;
  --q-star: #16a34a; --q-workhorse: #2563eb; --q-puzzle: #d97706; --q-dog: #dc2626;
  color-scheme: light;
}

/* Dark mode: follows the device unless the user picked Light or Dark in the theme picker */
:root[data-theme="dark"] {
    --bg: #070b12; --surface: #111823; --surface-2: #172030; --surface-3: #1d283a;
    --glass: rgba(14, 20, 30, .66); --glass-border: rgba(255, 255, 255, .07);
    --text: #e8edf5; --muted: #95a1b5; --border: #232f42;
    --primary: color-mix(in srgb, var(--a1) 72%, #fff); --primary-hover: color-mix(in srgb, var(--a1) 55%, #fff);
    --primary-soft: color-mix(in srgb, var(--a1) 20%, #0b1018);
    --accent: color-mix(in srgb, var(--a2) 72%, #fff);
    --success: #4ade80; --success-soft: #11301f; --warn: #fbbf24; --warn-soft: #362a0d;
    --danger: #f87171; --danger-soft: #3a1618; --info: #93a8ff; --info-soft: #18244a;
    --grad-text: linear-gradient(100deg, color-mix(in srgb, var(--a1) 60%, #fff) 0%, color-mix(in srgb, var(--a2) 60%, #fff) 50%, color-mix(in srgb, var(--a3) 55%, #fff) 100%);
    --aurora-1: color-mix(in srgb, var(--a1) 16%, transparent); --aurora-2: color-mix(in srgb, var(--a2) 17%, transparent); --aurora-3: color-mix(in srgb, var(--a3) 11%, transparent);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
    --glow: 0 6px 26px color-mix(in srgb, var(--a2) 45%, transparent);
    --c1: color-mix(in srgb, var(--a1) 70%, #fff); --c2: #60a5fa; --c3: #fbbf24; --c4: #f87171; --c5: #a78bfa; --c6: #f472b6; --c-prev: #64748b;
    --q-star: #4ade80; --q-workhorse: #60a5fa; --q-puzzle: #fbbf24; --q-dog: #f87171;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b12; --surface: #111823; --surface-2: #172030; --surface-3: #1d283a;
    --glass: rgba(14, 20, 30, .66); --glass-border: rgba(255, 255, 255, .07);
    --text: #e8edf5; --muted: #95a1b5; --border: #232f42;
    --primary: color-mix(in srgb, var(--a1) 72%, #fff); --primary-hover: color-mix(in srgb, var(--a1) 55%, #fff);
    --primary-soft: color-mix(in srgb, var(--a1) 20%, #0b1018);
    --accent: color-mix(in srgb, var(--a2) 72%, #fff);
    --success: #4ade80; --success-soft: #11301f; --warn: #fbbf24; --warn-soft: #362a0d;
    --danger: #f87171; --danger-soft: #3a1618; --info: #93a8ff; --info-soft: #18244a;
    --grad-text: linear-gradient(100deg, color-mix(in srgb, var(--a1) 60%, #fff) 0%, color-mix(in srgb, var(--a2) 60%, #fff) 50%, color-mix(in srgb, var(--a3) 55%, #fff) 100%);
    --aurora-1: color-mix(in srgb, var(--a1) 16%, transparent); --aurora-2: color-mix(in srgb, var(--a2) 17%, transparent); --aurora-3: color-mix(in srgb, var(--a3) 11%, transparent);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
    --glow: 0 6px 26px color-mix(in srgb, var(--a2) 45%, transparent);
    --c1: color-mix(in srgb, var(--a1) 70%, #fff); --c2: #60a5fa; --c3: #fbbf24; --c4: #f87171; --c5: #a78bfa; --c6: #f472b6; --c-prev: #64748b;
    --q-star: #4ade80; --q-workhorse: #60a5fa; --q-puzzle: #fbbf24; --q-dog: #f87171;
    color-scheme: dark;
  }
}

/* Accent palettes */
:root[data-accent="sunset"] { --a1: #f97316; --a2: #ec4899; --a3: #8b5cf6; }
:root[data-accent="ocean"] { --a1: #06b6d4; --a2: #3b82f6; --a3: #6366f1; }
:root[data-accent="forest"] { --a1: #16a34a; --a2: #0d9488; --a3: #65a30d; }
:root[data-accent="royal"] { --a1: #7c3aed; --a2: #c026d3; --a3: #f59e0b; }
:root[data-accent="rose"] { --a1: #e11d48; --a2: #db2777; --a3: #fb923c; }
:root[data-accent="desert"] { --a1: #d97706; --a2: #ea580c; --a3: #be123c; }
:root[data-accent="graphite"] { --a1: #64748b; --a2: #475569; --a3: #94a3b8; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; min-height: 100vh;
  -webkit-font-smoothing: antialiased; }
/* drifting aurora behind everything */
body::before, body::after { content: ""; position: fixed; z-index: -1; pointer-events: none; border-radius: 50%; filter: blur(70px); }
body::before { width: 60vmax; height: 60vmax; top: -22vmax; inset-inline-start: -18vmax;
  background: radial-gradient(circle, var(--aurora-1), transparent 65%); animation: drift-a 26s ease-in-out infinite alternate; }
body::after { width: 55vmax; height: 55vmax; bottom: -25vmax; inset-inline-end: -15vmax;
  background: radial-gradient(circle, var(--aurora-2), transparent 65%), radial-gradient(circle at 20% 20%, var(--aurora-3), transparent 55%);
  animation: drift-b 32s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(12vmax, 8vmax) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-10vmax, -7vmax) scale(1.08); } }

[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 750; letter-spacing: -.01em; }
.page-head h1 { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; padding-block: 2px; }
code { font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1.5px dashed var(--border); border-radius: var(--radius-sm); }
.empty.small { padding: 12px; border: 0; }
.loading { padding: 24px; display: grid; gap: 12px; color: transparent; user-select: none; }
.loading::before, .loading::after { content: ""; display: block; height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%);
  background-size: 300% 100%; animation: shimmer 1.3s linear infinite; }
.loading::before { width: 60%; }
.loading::after { height: 120px; border-radius: var(--radius); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.stat-value, .order-no, .order-total, .product-price, .pay-total, .grand, .count, .price { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none;
  background: var(--surface-2); color: var(--text); min-height: 42px; white-space: nowrap;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background-color .2s, border-color .2s, color .2s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, .product:focus-visible, .menu-item:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tabs a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--grad); background-size: 140% 140%; color: #fff; box-shadow: 0 3px 12px color-mix(in srgb, var(--a2) 28%, transparent); }
.btn-primary:hover:not(:disabled) { box-shadow: var(--glow); background-position: 100% 50%; }
/* light sweep across primary buttons on hover */
.btn-primary::after, .btn-success::after { content: ""; position: absolute; inset: 0; z-index: -1; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transition: transform .7s var(--ease); }
.btn-primary:hover::after, .btn-success:hover::after { transform: translateX(120%); }
.btn-success { background: linear-gradient(135deg, #16a34a, #0d9488); color: #fff; box-shadow: 0 3px 12px rgba(22, 163, 74, .28); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #db2777); color: #fff; box-shadow: 0 3px 12px rgba(239, 68, 68, .25); }
.btn-ghost { background: color-mix(in srgb, var(--surface) 60%, transparent); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.btn-sm { padding: 5px 12px; min-height: 34px; font-size: .88rem; border-radius: 10px; }
.btn-lg { min-height: 54px; font-size: 1.08rem; border-radius: 14px; }
.btn-block { width: 100%; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .22; transform: scale(0);
  animation: ripple .6s var(--ease) forwards; z-index: 0; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ---------- Layout ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid var(--glass-border);
  position: sticky; top: 0; z-index: 20; }
.topbar::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: var(--grad); opacity: .85;
  background-size: 200% 100%; animation: flow 8s linear infinite; }
@keyframes flow { to { background-position: 200% 0; } }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.brand-mark, .auth-logo { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--grad);
  background-size: 200% 200%; animation: hue 10s ease-in-out infinite alternate; color: #fff; font-weight: 900; font-size: .78rem; letter-spacing: .6px;
  flex: none; box-shadow: var(--glow); }
@keyframes hue { to { background-position: 100% 100%; } }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.02rem; }
.brand-text small { color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.user-name { color: var(--muted); font-size: .9rem; display: inline-flex; align-items: center; gap: 8px; }
.user-name::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent);
  animation: live 2.4s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, #22c55e 0%, transparent); } }
.tabs { display: flex; gap: 6px; padding: 8px 14px; background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--glass-border); overflow-x: auto; scrollbar-width: none; position: sticky; top: 61px; z-index: 19; }
.tabs a { position: relative; padding: 8px 15px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 650; white-space: nowrap;
  transition: color .2s, background-color .2s, transform .2s var(--ease); }
.tabs a:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.tabs a.active { color: #fff; background: var(--grad); box-shadow: 0 4px 14px color-mix(in srgb, var(--a2) 30%, transparent); animation: pop .35s var(--spring); }
@keyframes pop { from { transform: scale(.9); } to { transform: scale(1); } }
.content { padding: 20px 18px 40px; max-width: 1400px; margin: 0 auto; animation: page-in .45s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-actions { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.page-actions .field { margin: 0; }
.card { position: relative; background: radial-gradient(520px circle at var(--mx, -999px) var(--my, -999px), color-mix(in srgb, var(--accent) 7%, transparent), transparent 45%), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow);
  animation: rise .5s var(--ease) both; transition: border-color .3s, box-shadow .3s; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.content > :nth-child(2) { animation-delay: .04s; } .content > :nth-child(3) { animation-delay: .08s; } .content > :nth-child(4) { animation-delay: .12s; }
.grid-2 > :nth-child(2) { animation-delay: .07s; } .grid-2 > :nth-child(3) { animation-delay: .12s; } .grid-2 > :nth-child(4) { animation-delay: .16s; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 18px; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.banner { padding: 11px 16px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text); margin-bottom: 14px; border: 1px solid color-mix(in srgb, var(--info) 20%, transparent); }
.banner-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.content > .banner, body > #app > .banner { margin: 12px 18px 0; }
.branch-bar { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 6px 6px 6px 14px; background: var(--glass);
  border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow); }
[dir="rtl"] .branch-bar { padding: 6px 14px 6px 6px; }
.branch-bar select { border-radius: 999px; min-height: 36px; padding-block: 5px; border-color: transparent; background-color: var(--surface-2); }
.branch-picker { max-width: 280px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); animation: rise .5s var(--ease) both; transition: transform .25s var(--ease), box-shadow .25s; }
.stat::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--grad); opacity: .9; }
.stat::after { content: ""; position: absolute; width: 120px; height: 120px; inset-inline-end: -40px; top: -50px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); pointer-events: none; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stats > :nth-child(2) { animation-delay: .05s; } .stats > :nth-child(3) { animation-delay: .1s; } .stats > :nth-child(4) { animation-delay: .15s; }
.stats > :nth-child(5) { animation-delay: .2s; } .stats > :nth-child(6) { animation-delay: .25s; } .stats > :nth-child(7) { animation-delay: .3s; } .stats > :nth-child(8) { animation-delay: .35s; }
.stat-value { font-family: var(--font-num); font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .86rem; font-weight: 550; }
.stat.ok .stat-value { color: var(--success); }
.stat.bad .stat-value { color: var(--danger); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field > label { font-weight: 650; font-size: .88rem; }
.hint { color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; min-height: 42px; width: 100%; transition: border-color .2s, box-shadow .2s, background-color .2s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); outline: none; }
textarea { resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
input[type="file"] { padding: 7px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.input-row { display: flex; gap: 8px; align-items: flex-end; }
.input-row .field { margin: 0; }
.search { max-width: 260px; }
.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 10px; font: inherit; font-weight: 650; color: var(--muted);
  cursor: pointer; min-height: 40px; transition: color .2s, background-color .2s, box-shadow .2s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(18, 24, 38, .1); animation: pop .3s var(--spring); }
.segmented button.active::after { content: ""; display: block; height: 3px; width: 22px; margin: 3px auto -4px; border-radius: 3px; background: var(--grad); }
.img-preview img { max-width: 140px; max-height: 110px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--border); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { text-align: start; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; color: var(--muted); font-weight: 700; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
[dir="rtl"] .table th { text-transform: none; letter-spacing: 0; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 750; background: var(--surface-2);
  color: var(--muted); white-space: nowrap; margin-inline-end: 4px; border: 1px solid transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 20%, transparent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.info small { color: var(--muted); }

@media (max-width: 720px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table td { border: 0; padding: 3px 4px; display: flex; gap: 10px; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; min-width: 96px; flex: none; }
  .table td[data-label=""]::before { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .user-name { display: none; }
  .content { padding: 16px 14px 32px; }
  h1 { font-size: 1.4rem; }
}

/* ---------- Modal & toasts ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(8, 12, 20, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 20px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: modal-in .35s var(--spring) both; overflow: hidden; }
.modal::before { content: ""; height: 4px; background: var(--grad); flex: none; }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
.modal-wide { width: min(760px, 100%); }
.modal-head { padding: 18px 20px 0; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.toasts { position: fixed; bottom: 18px; inset-inline: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: rgba(17, 24, 39, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff;
  padding: 12px 18px; border-radius: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); max-width: 520px; font-weight: 550;
  animation: toast-in .45s var(--spring) both; transition: opacity .4s, transform .4s var(--ease); }
.toast::before { content: "ℹ"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .16); font-size: .8rem; flex: none; }
.toast-success::before { content: "✓"; background: #22c55e; }
.toast-error::before { content: "!"; background: #ef4444; font-weight: 900; }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px) scale(.95); } }
.toast.hide { opacity: 0; transform: translateY(10px); }

/* ---------- Sign in ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; overflow: hidden; }
.auth-page::before, .auth-page::after { content: ""; position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(60px); z-index: -1; opacity: .9; }
.auth-page::before { background: radial-gradient(circle, color-mix(in srgb, var(--a1) 55%, transparent), transparent 65%); top: -12vmax; inset-inline-start: -10vmax; animation: drift-a 14s ease-in-out infinite alternate; }
.auth-page::after { background: radial-gradient(circle, color-mix(in srgb, var(--a3) 45%, transparent), transparent 65%); bottom: -14vmax; inset-inline-end: -10vmax; animation: drift-b 17s ease-in-out infinite alternate; }
.auth-card { width: min(410px, 100%); background: var(--glass); -webkit-backdrop-filter: saturate(170%) blur(22px); backdrop-filter: saturate(170%) blur(22px);
  padding: 32px 30px; border-radius: 24px; border: 1px solid var(--glass-border); box-shadow: var(--shadow-lg); animation: modal-in .6s var(--spring) both; }
.auth-card h1 { margin: 16px 0 20px; font-size: 1.7rem; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card .btn { margin-top: 8px; }
.auth-logo { width: 56px; height: 56px; border-radius: 17px; font-size: .95rem; }
.auth-logo::after { content: ""; position: absolute; inset: -5px; border-radius: 21px; border: 2px solid transparent;
  background: var(--grad) border-box; -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0); opacity: .5; animation: halo 2.8s ease-in-out infinite; }
@keyframes halo { 50% { inset: -9px; opacity: 0; } }
.lang-switch { position: absolute; top: 16px; inset-inline-end: 16px; }

/* ---------- POS (order entry) ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; align-items: start; }
.pos-cart { position: sticky; top: 128px; max-height: calc(100vh - 146px); overflow-y: auto; margin: 0; }
.pos-cart::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--grad); border-radius: var(--radius) var(--radius) 0 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; scrollbar-width: none; }
.chip { border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 650;
  cursor: pointer; white-space: nowrap; color: var(--text); transition: transform .2s var(--ease), border-color .2s, background-color .2s, box-shadow .2s; }
.chip:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.chip.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--a2) 30%, transparent); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.product { position: relative; isolation: isolate; display: flex; flex-direction: column; text-align: start; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0; overflow: hidden; cursor: pointer; font: inherit; color: var(--text); box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
.product:hover:not(:disabled) { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.product:active:not(:disabled) { transform: translateY(-1px) scale(.97); }
.product img, .product-noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); transition: transform .5s var(--ease); }
.product:hover:not(:disabled) img { transform: scale(1.07); }
.product-noimg { display: grid; place-items: center; font-size: 2.3rem; font-weight: 900; color: #fff; background: var(--grad); text-shadow: 0 2px 10px rgba(0, 0, 0, .2); }
.product:nth-child(4n+2) .product-noimg { background: linear-gradient(135deg, #f59e0b, #ec4899); }
.product:nth-child(4n+3) .product-noimg { background: linear-gradient(135deg, #06b6d4, #6366f1); }
.product:nth-child(4n+4) .product-noimg { background: linear-gradient(135deg, #22c55e, #0ea5a4); }
.product-name { padding: 9px 11px 0; font-weight: 650; line-height: 1.3; }
.product-price { padding: 3px 11px 11px; color: var(--primary); font-weight: 800; font-family: var(--font-num); }
.product.out { opacity: .5; filter: grayscale(.7); }
.product.out .product-price { color: var(--danger); }
.product-count { position: absolute; top: 8px; inset-inline-end: 8px; background: var(--grad-warm); color: #fff; border-radius: 999px; min-width: 30px;
  height: 30px; padding: 0 8px; display: grid; place-items: center; font-weight: 900; box-shadow: 0 4px 12px rgba(236, 72, 153, .4); border: 2px solid var(--surface); }
.product-count.enter { animation: bump .45s var(--spring); }
@keyframes bump { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.cart-lines { margin: 8px 0 12px; border-top: 1px solid var(--border); }
.cart-line { padding: 9px 0; border-bottom: 1px solid var(--border); animation: slide-in .3s var(--ease) both; }
@keyframes slide-in { from { opacity: 0; transform: translateX(12px); } }
[dir="rtl"] .cart-line { animation-name: slide-in-rtl; }
@keyframes slide-in-rtl { from { opacity: 0; transform: translateX(-12px); } }
.cart-line-top { display: flex; align-items: center; gap: 8px; }
.cart-name { flex: 1; font-weight: 650; }
.cart-price { min-width: 80px; text-align: end; font-weight: 700; font-family: var(--font-num); }
.line-note { margin-top: 6px; min-height: 34px; padding: 6px 10px; font-size: .9rem; }
.stepper { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.stepper button { width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--surface); font-size: 1.15rem; font-weight: 700;
  cursor: pointer; color: var(--text); box-shadow: 0 1px 3px rgba(18, 24, 38, .1); transition: transform .15s var(--ease); }
.stepper button:active { transform: scale(.88); }
.stepper span { min-width: 22px; text-align: center; font-weight: 800; }
.cart-totals { margin: 8px 0 14px; }
.cart-totals > div { display: flex; justify-content: space-between; padding: 3px 0; }
.cart-totals .discount { color: var(--success); }
.cart-totals .grand { font-size: 1.35rem; font-weight: 900; border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 6px; font-family: var(--font-num); }
.cart-totals .grand > :last-child { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; }
  .pos-cart { position: static; max-height: none; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
}

/* ---------- Orders ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.board-col { --col: var(--muted); position: relative; background: color-mix(in srgb, var(--surface-2) 75%, transparent); border: 1px solid var(--border);
  border-radius: 20px; padding: 12px; min-height: 220px; }
.board-col::before { content: ""; position: absolute; inset-inline: 18px; top: -1px; height: 3px; border-radius: 0 0 3px 3px; background: var(--col); }
.board-col h2 { display: flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--col); padding: 2px 4px; }
.board-col h2::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--col); box-shadow: 0 0 0 4px color-mix(in srgb, var(--col) 20%, transparent); }
.col-new { --col: var(--info); } .col-preparing { --col: var(--warn); } .col-ready { --col: var(--success); } .col-delivered { --col: var(--muted); }
.col-new h2::before { animation: live 1.8s ease-in-out infinite; }
.count { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 9px; font-size: .8rem; color: var(--text); margin-inline-start: auto; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .board { grid-template-columns: 1fr; } }
.order-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.order-card { --st: var(--border); position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 14px 12px; margin-bottom: 12px; box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s; }
.order-card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: var(--st); }
.order-card::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--st) 9%, transparent), transparent 40%); }
[dir="rtl"] .order-card::after { background: linear-gradient(270deg, color-mix(in srgb, var(--st) 9%, transparent), transparent 40%); }
.order-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.order-card > * { position: relative; z-index: 1; }
.order-list .order-card { margin: 0; }
.order-card.status-new { --st: var(--info); }
.order-card.status-preparing { --st: var(--warn); }
.order-card.status-ready { --st: var(--success); }
.order-card.status-delivered { --st: color-mix(in srgb, var(--muted) 50%, transparent); }
.order-card.status-cancelled { opacity: .62; --st: var(--danger); }
.order-card.enter { animation: card-in .5s var(--spring) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
/* a brand-new order glows for a few seconds so the teller notices it */
.order-card.fresh { animation: card-in .5s var(--spring) both, fresh 2.4s ease-out .2s 2; }
@keyframes fresh { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st) 55%, transparent), var(--shadow); } 100% { box-shadow: 0 0 0 14px transparent, var(--shadow); } }
.order-head { display: flex; justify-content: space-between; gap: 8px; }
.order-no { font-weight: 900; font-size: 1.15rem; font-family: var(--font-num); letter-spacing: -.01em; }
.order-loc { font-weight: 750; color: var(--primary); }
.order-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.order-sub { color: var(--muted); font-size: .84rem; margin: 6px 0; }
.order-items { list-style: none; padding: 8px 10px; margin: 8px 0; background: var(--surface-2); border-radius: 12px; }
.order-items li { display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 0; }
.order-items .qty { font-weight: 900; min-width: 28px; color: var(--accent); font-family: var(--font-num); }
.order-items .inote { color: var(--warn); font-size: .86rem; flex-basis: 100%; padding-inline-start: 34px; }
.order-notes { background: var(--warn-soft); padding: 7px 10px; border-radius: 10px; font-size: .9rem; margin: 6px 0; }
.order-notes.danger { background: var(--danger-soft); }
.order-offer { color: var(--success); font-size: .9rem; font-weight: 600; }
.order-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.order-total { font-size: 1.2rem; font-family: var(--font-num); font-weight: 900; }
.order-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pay-total { font-size: 2.4rem; font-weight: 900; text-align: center; margin-bottom: 12px; font-family: var(--font-num);
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.change { font-size: 1.25rem; font-weight: 800; color: var(--success); }

/* ---------- Owner menu ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.menu-item { display: flex; gap: 12px; text-align: start; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px; cursor: pointer; font: inherit; color: var(--text); box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.menu-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.menu-item img, .menu-item .product-noimg { width: 66px; height: 66px; aspect-ratio: auto; border-radius: 12px; object-fit: cover; flex: none; font-size: 1.5rem; }
.menu-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu-item .price { color: var(--primary); font-weight: 800; font-family: var(--font-num); }
.menu-item.inactive { opacity: .55; filter: grayscale(.6); }
.avail-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.avail-item { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); }

/* generic keyed entrance (motion.js adds .enter the first time an item appears) */
.enter { animation: rise .45s var(--ease) both; animation-delay: var(--d, 0s); }

/* ---------- Respect "reduce motion" ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  body::before, body::after, .auth-page::before, .auth-page::after { animation: none !important; }
}

/* ---------- Printing ---------- */
#print-area { display: none; }
@media print {
  @page { margin: 4mm; }
  body { background: #fff; color: #000; }
  body::before, body::after { display: none; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  .receipt { width: 72mm; font: 12px/1.35 var(--font); color: #000; text-align: center; }
  .receipt h2 { font-size: 15px; margin: 4px 0; }
  .receipt table { width: 100%; border-collapse: collapse; text-align: start; }
  .receipt td { padding: 1px 0; vertical-align: top; }
  .receipt .r { text-align: end; white-space: nowrap; }
  .receipt-big { font-size: 18px; font-weight: 800; }
  .receipt-total td { font-weight: 800; font-size: 14px; border-top: 1px dashed #000; padding-top: 3px; }
  .receipt-logo { max-width: 40mm; max-height: 20mm; }
  .receipt-pre { white-space: pre-line; }
  .receipt hr { border: 0; border-top: 1px dashed #000; }
}

/* ---------- Analytics ---------- */
.analytics .s1 { --sc: var(--c1); } .analytics .s2 { --sc: var(--c2); } .analytics .s3 { --sc: var(--c3); }
.analytics .s4 { --sc: var(--c4); } .analytics .s5 { --sc: var(--c5); } .analytics .s6 { --sc: var(--c6); }
.analytics .prev { --sc: var(--c-prev); }
.analytics .q-star { --sc: var(--q-star); } .analytics .q-workhorse { --sc: var(--q-workhorse); }
.analytics .q-puzzle { --sc: var(--q-puzzle); } .analytics .q-dog { --sc: var(--q-dog); }
.analytics .small, .analytics small { font-size: .85rem; }
.analytics h4 { margin: 12px 0 6px; font-size: .9rem; color: var(--muted); }
.analytics h3 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 6px; }
.period-note { margin: 0 0 10px; }
.section-title { margin: 28px 0 12px; }
.section-title h2 { margin: 0 0 2px; font-size: 1.25rem; }
.section-title p { margin: 0; }

.insights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 8px; }
.insight { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border-inline-start: 4px solid var(--border); line-height: 1.45; }
.insight.good { border-inline-start-color: var(--success); }
.insight.warn { border-inline-start-color: var(--warn); }
.insight.bad { border-inline-start-color: var(--danger); }
.insight-icon { font-size: 1.2rem; line-height: 1.2; }

.kpi .stat-value { margin: 4px 0; }
.kpi-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8rem; min-height: 1.2em; }
.delta { font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.delta-good { color: var(--success); }
.delta-bad { color: var(--danger); }
.delta-new { color: var(--info); }

.chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart-svg .grid-line { stroke: var(--border); stroke-width: 1; }
.chart-svg .axis-label { fill: var(--muted); font-size: 11px; }
.chart-svg .axis-title { fill: var(--muted); font-size: 12px; font-weight: 600; }
.chart-svg .line { fill: none; stroke: var(--sc); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.dashed { stroke-dasharray: 5 5; stroke-width: 1.8; }
.chart-svg .area { fill: var(--sc); opacity: .12; stroke: none; }
.chart-svg .dot { fill: var(--surface); stroke: var(--sc); stroke-width: 2; }
.chart-svg .guide { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; top: 4px; min-width: 150px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); font-size: .82rem; pointer-events: none; z-index: 2; }
.chart-tip strong { display: block; margin-bottom: 4px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .85rem; align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--sc, var(--muted)); flex: none; }
.swatch.dashed { height: 3px; width: 14px; border-radius: 0; background: repeating-linear-gradient(90deg, var(--sc) 0 4px, transparent 4px 7px); }

.bar { display: block; height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 5px; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--sc, var(--primary)); }
.cell-bar { min-width: 120px; }
.cell-bar > span:first-child { display: inline-flex; gap: 4px; align-items: center; }
.split-bar { display: flex; height: 16px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.split-seg { background: var(--sc); height: 100%; }
.split-seg + .split-seg { border-inline-start: 2px solid var(--surface); }
.empty-bar { opacity: .6; }

.rank-list, .pair-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pair-list { gap: 8px; }
.rank-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rank-row strong { flex: 1; min-width: 0; }
.rank-val { color: var(--muted); font-size: .85rem; display: inline-flex; gap: 4px; align-items: baseline; flex-wrap: wrap; }
.rank { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-size: .75rem; font-weight: 700; margin-inline-end: 6px; }
.bars { display: grid; gap: 12px; }
.leader { color: #d4a017; margin-inline-start: 4px; font-size: .95rem; }
.best-cell { font-weight: 700; color: var(--primary); }
.analytics .chips { flex-wrap: wrap; overflow: visible; }
.analytics .chip { font-weight: 400; cursor: default; padding: 6px 12px; }

.branch-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.branch-cards > .card { margin-bottom: 0; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.mini-stats div { display: flex; flex-direction: column; }
.mini-stats small { color: var(--muted); }
.spark-wrap { margin: 6px 0 10px; }
.spark { width: 100%; height: 44px; display: block; }
.spark .line { fill: none; stroke: var(--sc); stroke-width: 2; vector-effect: non-scaling-stroke; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col ol { margin: 0; padding-inline-start: 18px; }
.mini-split { margin-top: 6px; }

.quad { fill: var(--sc); opacity: .07; }
.threshold { stroke: var(--muted); stroke-dasharray: 4 4; }
.quad-label { fill: var(--muted); font-size: 12px; font-weight: 700; }
.pt { fill: var(--sc); fill-opacity: .85; stroke: var(--surface); stroke-width: 1.5; }
.pt-label { fill: var(--text); font-size: 11px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.quad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; margin-top: 12px; }
.quad-card { border: 1px solid var(--border); border-inline-start: 4px solid var(--sc); border-radius: 8px; padding: 10px 12px; }
.quad-card p { margin: 6px 0 0; }
.quad-head { display: flex; align-items: center; gap: 6px; }
.q-tag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.th-btn { background: none; border: 0; font: inherit; color: inherit; padding: 0; cursor: pointer; font-weight: 600; white-space: nowrap; }
.th-btn:hover { color: var(--text); }
.items-table td { white-space: nowrap; }
.analytics .card-head { flex-wrap: wrap; }
.analytics .card-head input[type=search] { width: 180px; padding: 6px 10px; }

.heatmap-wrap { overflow-x: auto; }
.heatmap { display: grid; gap: 3px; align-items: center; min-width: 420px; }
.hm-hour { font-size: .7rem; color: var(--muted); text-align: center; white-space: nowrap; }
.hm-day { font-size: .8rem; color: var(--muted); padding-inline-end: 6px; white-space: nowrap; }
.hm-cell { height: 22px; border-radius: 4px; background: var(--surface-2); }
.hm-cell.on { background: color-mix(in srgb, var(--c1) calc(var(--a) * 100%), var(--surface-2)); }
.hm-scale { width: 90px; height: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--c1)); }
.offer-list { margin: 10px 0 0; padding-inline-start: 18px; }
@media (max-width: 720px) {
  .analytics .card-head input[type=search] { width: 100%; }
  .two-col { grid-template-columns: 1fr; }
}
@media print { .chart-tip { display: none; } .analytics .card { break-inside: avoid; } }
.analytics .kpi .stat-value { font-size: clamp(1.05rem, 2.2vw, 1.3rem); overflow-wrap: anywhere; }
.analytics .segmented { flex: none; }
.analytics .segmented button { white-space: nowrap; padding: 7px 12px; }
.analytics .table td:first-child { white-space: nowrap; }
.analytics .table td:first-child .swatch { margin-inline-end: 6px; }
.page-actions .row-actions .btn.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.more-row { margin-top: 10px; text-align: center; }
.mix-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 4px 24px; }
.mix-grid h4 { margin-top: 6px; }

/* ---------- Analytics motion & polish (Aurora) ---------- */
.analytics .chart-svg .line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s var(--ease) .15s forwards; }
.analytics .chart-svg .line.dashed { stroke-dasharray: 5 5; stroke-dashoffset: 0; animation: fade .8s ease .9s both; }
.analytics .chart-svg .area { animation: area-in 1.2s var(--ease) .5s both; }
.analytics .chart-svg .dot { animation: dot-in .35s var(--spring) both; animation-delay: calc(.3s + var(--i, 0) * 30ms); transform-box: fill-box; transform-origin: center; }
.analytics .spark .line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s var(--ease) .3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes area-in { from { opacity: 0; } to { opacity: .14; } }
@keyframes dot-in { from { transform: scale(0); } }

.bar-fill, .split-seg { transform-origin: left center; animation: grow .9s var(--ease) both; animation-delay: var(--d, .1s); }
[dir="rtl"] .bar-fill, [dir="rtl"] .split-seg { transform-origin: right center; }
.chart .split-seg, [dir="ltr"] .split-seg { transform-origin: left center; }
@keyframes grow { from { transform: scaleX(0); } }
.hm-cell { animation: cell-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 6ms); }
@keyframes cell-in { from { opacity: 0; transform: scale(.4); } }
.hm-cell.on:hover { outline: 2px solid var(--text); outline-offset: 1px; position: relative; z-index: 1; transform: scale(1.15); transition: transform .15s; }
.pt { transform-box: fill-box; transform-origin: center; animation: dot-in .5s var(--spring) both; animation-delay: calc(.2s + var(--i, 0) * 40ms); transition: transform .2s var(--spring); }
.pt:hover { transform: scale(1.6); }
.quad { animation: fade 1s ease both; }
.insight { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); transition: transform .2s var(--ease), box-shadow .2s;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent); }
.insight:hover { transform: translateX(3px); box-shadow: var(--shadow); }
[dir="rtl"] .insight:hover { transform: translateX(-3px); }
.insight.good { background: linear-gradient(90deg, color-mix(in srgb, var(--success) 9%, var(--surface-2)), var(--surface-2) 60%); }
.insight.warn { background: linear-gradient(90deg, color-mix(in srgb, var(--warn) 10%, var(--surface-2)), var(--surface-2) 60%); }
.insight.bad { background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 10%, var(--surface-2)), var(--surface-2) 60%); }
[dir="rtl"] .insight.good { background: linear-gradient(270deg, color-mix(in srgb, var(--success) 9%, var(--surface-2)), var(--surface-2) 60%); }
[dir="rtl"] .insight.warn { background: linear-gradient(270deg, color-mix(in srgb, var(--warn) 10%, var(--surface-2)), var(--surface-2) 60%); }
[dir="rtl"] .insight.bad { background: linear-gradient(270deg, color-mix(in srgb, var(--danger) 10%, var(--surface-2)), var(--surface-2) 60%); }
.insight-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); flex: none; font-size: 1.1rem; }
.delta { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); }
.delta-good { background: var(--success-soft); }
.delta-bad { background: var(--danger-soft); }
.delta-new { background: var(--info-soft); }
.section-title h2 { font-size: 1.35rem; font-weight: 850; display: flex; align-items: center; gap: 10px; }
.section-title h2::before { content: ""; width: 6px; height: 1.1em; border-radius: 3px; background: var(--grad); }
.rank { background: var(--grad); color: #fff; }
.rank-list li:nth-child(n+4) .rank, .bars .rank { background: var(--surface-2); color: var(--text); }
.chart-tip { background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-radius: 12px; animation: fade .15s ease; }
.leader { display: inline-block; animation: pop .5s var(--spring) both, twinkle 3s ease-in-out 1s infinite; }
@keyframes twinkle { 50% { filter: drop-shadow(0 0 5px #fcd34d); } }
.analytics .split-bar { height: 18px; border-radius: 9px; }
.analytics .bar { height: 8px; }
.branch-cards > .card:nth-child(2) { animation-delay: .08s; } .branch-cards > .card:nth-child(3) { animation-delay: .16s; } .branch-cards > .card:nth-child(4) { animation-delay: .24s; }
.quad-card { transition: transform .2s var(--ease), box-shadow .2s; background: var(--surface); }
.quad-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.analytics .table td { white-space: nowrap; }

/* =====================================================================
   WOW layer: cinematic sign-in, odometer, tilt, celebrations, page morphs
   ===================================================================== */

/* ---------- Page morphing (View Transitions) ---------- */
.topbar { view-transition-name: topbar; }
.tabs { view-transition-name: tabs; }
.tabs a.active { view-transition-name: active-tab; }
.content { view-transition-name: page; }
::view-transition-group(active-tab) { animation-duration: .45s; animation-timing-function: var(--spring); }
::view-transition-old(page) { animation: vt-out .22s ease both; }
::view-transition-new(page) { animation: vt-in .4s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: scale(.985); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px) scale(.99); filter: blur(6px); } }

/* ---------- Odometer digits ---------- */
.odo-run { display: inline-flex; align-items: flex-start; unicode-bidi: isolate; direction: ltr; white-space: nowrap; }
.odo-digit { display: inline-block; height: 1.15em; overflow: hidden; line-height: 1.15em; vertical-align: bottom; }
.odo-strip { display: flex; flex-direction: column; transition: transform 1.1s cubic-bezier(.2, .9, .25, 1.05); }
.odo-strip > span { height: 1.15em; text-align: center; }
.odo-sep { display: inline-block; height: 1.15em; line-height: 1.15em; }

/* ---------- 3D tilt + glare ---------- */
.stat, .product, .menu-item, .quad-card, .fx-tilt { --rx: 0deg; --ry: 0deg; }
.stat.tilting, .product.tilting, .menu-item.tilting, .quad-card.tilting, .fx-tilt.tilting {
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-3px); transition: transform .08s linear, box-shadow .25s; }
.stat::after, .product::after, .menu-item::after { transition: opacity .3s; }
.product::after, .menu-item::after, .fx-tilt::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: 0;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .28), transparent 50%); mix-blend-mode: soft-light; z-index: 2; }
.product.tilting::after, .menu-item.tilting::after, .fx-tilt.tilting::after { opacity: 1; }
.menu-item { position: relative; overflow: hidden; }

/* ---------- Confetti, celebration, stamp, fly ---------- */
.fx-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 400; }
.fx-celebrate { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: rgba(8, 12, 22, .45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade .25s ease both; cursor: pointer; }
.fx-celebrate.quiet { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; }
.fx-celebrate.out { animation: fade .3s ease reverse both; }
.fx-celebrate-card { text-align: center; padding: 30px 44px 28px; border-radius: 28px; background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-lg), 0 0 80px color-mix(in srgb, var(--a2) 35%, transparent); animation: modal-in .55s var(--spring) both; min-width: 260px; }
.fx-check { width: 96px; height: 96px; display: block; margin: 0 auto 10px; overflow: visible; }
.fx-check-ring { fill: none; stroke: #22c55e; stroke-width: 6; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .6s var(--ease) .1s forwards;
  filter: drop-shadow(0 0 10px rgba(34, 197, 94, .6)); transform-origin: center; }
.fx-check-mark { fill: none; stroke: #22c55e; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw .45s var(--ease) .55s forwards; }
.fx-big { font-family: var(--font-num); font-size: 2.6rem; font-weight: 900; letter-spacing: -.02em; background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop .6s var(--spring) .5s both; }
.fx-title { font-size: 1.35rem; font-weight: 850; margin-top: 2px; }
.fx-sub { color: var(--muted); margin-top: 4px; }
.fx-stamp { position: fixed; left: 50%; top: 42%; z-index: 350; pointer-events: none; font: 900 3.4rem/1 var(--font); letter-spacing: .12em; padding: 10px 26px;
  color: #16a34a; border: 6px solid #16a34a; border-radius: 14px; text-transform: uppercase; background: rgba(255, 255, 255, .08);
  -webkit-mask: repeating-linear-gradient(45deg, #000 0 6px, rgba(0, 0, 0, .82) 6px 8px); mask: repeating-linear-gradient(45deg, #000 0 6px, rgba(0, 0, 0, .82) 6px 8px);
  animation: stamp 1.5s var(--ease) both; }
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(2.4); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(.92); }
  26% { transform: translate(-50%, -50%) rotate(-14deg) scale(1.04); }
  32%, 75% { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(1); } }
.fx-fly { position: fixed; z-index: 380; pointer-events: none; border-radius: 14px; object-fit: cover; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); margin: 0; }
.fx-catch { animation: catch .5s var(--spring); }
@keyframes catch { 30% { transform: scale(1.025); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow-lg); } }

/* ---------- Teller board: column flashes when a new order lands ---------- */
.board-col:has(.order-card.fresh) { animation: col-flash 1.2s ease-out 2; }
@keyframes col-flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--col) 50%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
.order-card.fresh { animation: drop-in .7s var(--spring) both, fresh 2.4s ease-out .3s 2; }
@keyframes drop-in { 0% { opacity: 0; transform: translateY(-40px) scale(.9) rotate(-2deg); } 60% { opacity: 1; transform: translateY(6px) scale(1.01) rotate(.5deg); } 100% { transform: none; } }

/* ---------- Charts glow ---------- */
.analytics .chart-svg .line:not(.dashed) { filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--sc) 55%, transparent)); }
.analytics .spark .line { filter: drop-shadow(0 3px 6px color-mix(in srgb, var(--sc) 50%, transparent)); }

/* ---------- Analytics hero banner ---------- */
.hero-banner { position: relative; overflow: hidden; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
  padding: 28px 30px; margin-bottom: 18px; border-radius: 24px; color: #fff; box-shadow: var(--shadow-lg), 0 20px 60px color-mix(in srgb, var(--a2) 25%, transparent);
  background: linear-gradient(125deg, color-mix(in srgb, var(--a1) 38%, #050814) 0%, color-mix(in srgb, var(--a2) 42%, #050814) 45%, color-mix(in srgb, var(--a3) 48%, #050814) 100%); animation: rise .6s var(--ease) both; }
.hero-glow { position: absolute; inset: -40%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side at 30% 40%, color-mix(in srgb, var(--a1) 55%, transparent), transparent), radial-gradient(closest-side at 70% 60%, color-mix(in srgb, var(--a3) 45%, transparent), transparent),
  radial-gradient(closest-side at 55% 20%, color-mix(in srgb, var(--a2) 50%, transparent), transparent); filter: blur(30px); animation: spin 22s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.hero-banner::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .18;
  background-image: radial-gradient(rgba(255, 255, 255, .8) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask: linear-gradient(110deg, #000, transparent 70%); mask: linear-gradient(110deg, #000, transparent 70%); }
.hero-greet { font-size: 1.05rem; font-weight: 650; opacity: .9; }
.hero-label { font-size: .85rem; opacity: .7; margin-top: 2px; text-transform: uppercase; letter-spacing: .08em; }
[dir="rtl"] .hero-label { text-transform: none; letter-spacing: 0; }
.hero-num { font-family: var(--font-num); font-size: clamp(2.2rem, 5.5vw, 3.6rem); font-weight: 900; letter-spacing: -.03em; line-height: 1.1; margin: 6px 0 14px;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .25); }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 650;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: rise .5s var(--ease) both; }
.hero-chip:nth-child(2) { animation-delay: .1s; } .hero-chip:nth-child(3) { animation-delay: .2s; } .hero-chip:nth-child(4) { animation-delay: .3s; }
.hero-chip.up { background: rgba(34, 197, 94, .25); border-color: rgba(74, 222, 128, .5); }
.hero-chip.down { background: rgba(239, 68, 68, .25); border-color: rgba(248, 113, 113, .5); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, .7); animation: livepulse 1.6s ease-out infinite; }
@keyframes livepulse { to { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); } }
.hero-gauge { position: relative; width: 170px; text-align: center; }
.gauge { width: 170px; height: 170px; transform: rotate(-90deg); overflow: visible; }
.gauge-track { fill: none; stroke: rgba(255, 255, 255, .14); stroke-width: 12; }
.gauge-val { fill: none; stroke: url(#gaugeGrad); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1.6s cubic-bezier(.2, .8, .2, 1) .3s;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--a2) 70%, transparent)); }
.gauge.beat .gauge-val { animation: gauge-glow 2.2s ease-in-out 2s infinite; }
@keyframes gauge-glow { 50% { filter: drop-shadow(0 0 16px color-mix(in srgb, var(--a3) 100%, transparent)); } }
.gauge-center { position: absolute; inset: 0 0 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-center strong { font-family: var(--font-num); font-size: 1.7rem; font-weight: 900; }
.gauge-center small { opacity: .75; font-size: .75rem; max-width: 100px; }
.gauge-caption { font-size: .75rem; opacity: .7; margin-top: 4px; }
@media (max-width: 640px) {
  .hero-banner { grid-template-columns: 1fr; padding: 22px; }
  .hero-gauge { margin: 0 auto; }
}

/* ---------- Cinematic sign-in ---------- */
.auth-page { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: center; gap: 40px; padding: 40px clamp(20px, 5vw, 80px); }
.auth-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.auth-side { display: grid; place-items: center; }
.auth-hero { position: relative; max-width: 640px; animation: rise .8s var(--ease) both; }
.hero-brand { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; margin-bottom: 28px; }
.hero-title { font-size: clamp(2.3rem, 5.2vw, 4.4rem); line-height: 1.02; letter-spacing: -.035em; font-weight: 900; margin: 0 0 18px; }
.hero-title span { display: block; animation: rise .8s var(--ease) both; }
.hero-title span:nth-child(2) { animation-delay: .12s; } .hero-title span:nth-child(3) { animation-delay: .24s; }
.hero-title .grad { background: linear-gradient(100deg, var(--a1), var(--a2), var(--a3), var(--a2), var(--a1)); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: rise .8s var(--ease) .24s both, flow 6s linear infinite; padding-bottom: 4px; }
.hero-sub { font-size: 1.25rem; font-weight: 650; margin: 0 0 10px; }
.hero-word { display: inline-block; color: var(--accent); transition: opacity .35s, transform .35s var(--ease), filter .35s; }
.hero-word.out { opacity: 0; transform: translateY(-12px); filter: blur(4px); }
.hero-copy { color: var(--muted); font-size: 1.02rem; max-width: 520px; margin: 0; }
.hero-previews { position: relative; height: 230px; margin-top: 34px; perspective: 1000px; }
.hp { position: absolute; padding: 14px 16px; border-radius: 18px; background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); animation: float 6s ease-in-out infinite; font-size: .9rem; }
.hp-1 { width: 250px; inset-inline-start: 0; top: 10px; transform: rotateY(12deg) rotateX(4deg); }
.hp-2 { width: 240px; inset-inline-start: 230px; top: 0; animation-delay: -2s; transform: rotateY(-8deg); }
.hp-3 { display: flex; gap: 12px; align-items: center; inset-inline-start: 200px; top: 140px; animation-delay: -4s; border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
@keyframes float { 50% { translate: 0 -12px; } }
.hp-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.hp-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; animation: livepulse 1.6s ease-out infinite; }
.hp-up { color: var(--success); font-weight: 800; font-size: .8rem; }
.hp-big { font: 900 1.8rem/1.1 var(--font-num); margin: 6px 0 8px; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hp-bars { display: flex; align-items: flex-end; gap: 6px; height: 46px; }
.hp-bars i { flex: 1; height: var(--v); border-radius: 5px 5px 2px 2px; background: var(--grad); opacity: .85; transform-origin: bottom; animation: bar-up 1.2s var(--spring) both; }
.hp-bars i:nth-child(2) { animation-delay: .08s; } .hp-bars i:nth-child(3) { animation-delay: .16s; } .hp-bars i:nth-child(4) { animation-delay: .24s; }
.hp-bars i:nth-child(5) { animation-delay: .32s; } .hp-bars i:nth-child(6) { animation-delay: .4s; } .hp-bars i:nth-child(7) { animation-delay: .48s; }
@keyframes bar-up { from { transform: scaleY(0); } }
.hp-pill { font-size: .75rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.hp-pill.ok { background: var(--success-soft); color: var(--success); }
.hp-muted { color: var(--muted); font-size: .82rem; margin-top: 6px; }
.hp-bell { font-size: 1.4rem; display: inline-block; animation: ring 2.6s ease-in-out infinite; transform-origin: top center; }
@keyframes ring { 0%, 60%, 100% { transform: rotate(0); } 64% { transform: rotate(18deg); } 70% { transform: rotate(-16deg); } 76% { transform: rotate(10deg); } 82% { transform: rotate(-6deg); } }
.auth-card { position: relative; }
.auth-lead { margin: -12px 0 20px; }
.auth-secure { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 14px; }
.auth-page::before, .auth-page::after { z-index: -2; }
@media (max-width: 960px) {
  .auth-page { grid-template-columns: 1fr; gap: 24px; padding: 70px 18px 30px; }
  .auth-hero { text-align: center; margin: 0 auto; }
  .hero-brand { justify-content: center; margin-bottom: 16px; }
  .hero-title { font-size: clamp(2rem, 9vw, 2.8rem); }
  .hero-title span { display: inline; }
  .hero-title span + span::before { content: " "; }
  .hero-copy, .hero-previews { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-glow, .hp, .hp-bell, .hero-title .grad { animation: none !important; }
  .odo-strip { transition: none; }
}

.gauge stop:nth-child(1) { stop-color: var(--a1); } .gauge stop:nth-child(2) { stop-color: var(--a2); } .gauge stop:nth-child(3) { stop-color: var(--a3); }

/* =====================================================================
   App shell: theme picker, icons, live background, beams, reveals
   ===================================================================== */

/* ---------- Circular reveal when the theme changes ---------- */
.vt-theme .topbar, .vt-theme .tabs, .vt-theme .tabs a.active, .vt-theme .content { view-transition-name: none; }
.vt-theme::view-transition-old(root) { animation: none; }
.vt-theme::view-transition-new(root) { animation: theme-reveal .75s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); } to { clip-path: circle(150vmax at var(--vt-x, 50%) var(--vt-y, 0)); } }

/* ---------- Icons ---------- */
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn-icon { width: 40px; min-width: 40px; padding: 0; border-radius: 12px; }
.btn-icon .icon { width: 19px; height: 19px; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; }
.tabs a .icon { width: 17px; height: 17px; transition: transform .3s var(--spring); }
.tabs a:hover .icon { transform: translateY(-1px) rotate(-6deg) scale(1.1); }
.tabs a.active .icon { animation: icon-pop .5s var(--spring); }
@keyframes icon-pop { 0% { transform: scale(.6) rotate(-20deg); } 100% { transform: none; } }

/* light/dark toggle: sun and moon swap with a spin */
.mode-toggle { position: relative; overflow: hidden; }
.mode-toggle > span { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .5s var(--spring), opacity .3s; }
.mt-sun { color: #f59e0b; }
.mt-moon { color: #a5b4fc; transform: translateY(120%) rotate(-90deg); opacity: 0; }
:root[data-theme="dark"] .mt-sun { transform: translateY(-120%) rotate(90deg); opacity: 0; }
:root[data-theme="dark"] .mt-moon { transform: none; opacity: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mt-sun { transform: translateY(-120%) rotate(90deg); opacity: 0; }
  :root:not([data-theme="light"]) .mt-moon { transform: none; opacity: 1; }
}
.theme-btn .icon { color: var(--a2); transition: transform .5s var(--spring); }
.theme-btn:hover .icon { transform: rotate(-25deg) scale(1.1); }

/* ---------- Theme panel ---------- */
.theme-panel { position: fixed; z-index: 250; width: min(340px, calc(100vw - 20px)); padding: 16px; border-radius: 20px; background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg); animation: panel-in .35s var(--spring) both; transform-origin: top right; }
[dir="rtl"] .theme-panel { transform-origin: top left; }
.theme-panel.out { animation: panel-in .2s ease reverse both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(-8px) scale(.94); } }
.tp-head { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin-bottom: 12px; }
.tp-head .icon { color: var(--a2); }
.tp-label { font-size: .75rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 12px 0 8px; }
[dir="rtl"] .tp-label { text-transform: none; letter-spacing: 0; }
.tp-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tp-mode { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: .85rem; cursor: pointer; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.tp-mode .icon { width: 22px; height: 22px; }
.tp-mode:hover { transform: translateY(-2px); }
.tp-mode.active { border-color: var(--a2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a2) 22%, transparent); }
.tp-swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tp-swatch { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px; border-radius: 14px; border: 1.5px solid transparent;
  background: transparent; color: var(--text); font: inherit; cursor: pointer; transition: transform .2s var(--spring), background-color .2s; }
.tp-swatch:hover { transform: translateY(-2px); background: var(--surface-2); }
.tp-swatch small { font-size: .75rem; font-weight: 600; color: var(--muted); }
.tp-dot { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), 0 4px 12px rgba(0, 0, 0, .18);
  transition: transform .3s var(--spring); }
.tp-swatch.active { border-color: var(--border); background: var(--surface); }
.tp-swatch.active .tp-dot { transform: scale(1.08); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--a2), 0 6px 16px rgba(0, 0, 0, .2); }
.tp-swatch.active small { color: var(--text); }
.tp-dot.rainbow { background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #f43f5e); color: #fff; }
.tp-dot.rainbow .icon { width: 18px; height: 18px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.tp-color { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; min-height: 0; }
.tp-switch { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--surface-2); cursor: pointer; position: relative; }
.tp-switch > span { flex: 1; display: flex; flex-direction: column; }
.tp-switch small { color: var(--muted); font-size: .78rem; }
.tp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tp-switch i { width: 44px; height: 26px; border-radius: 99px; background: var(--border); position: relative; transition: background-color .25s; flex: none; }
.tp-switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: inset-inline-start .3s var(--spring); }
.tp-switch input:checked + i { background: var(--grad); }
.tp-switch input:checked + i::after { inset-inline-start: 21px; }
.tp-switch input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.tp-note { margin: 10px 0 0; font-size: .75rem; color: var(--muted); text-align: center; }

/* ---------- Live clock ---------- */
.live-clock { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.live-clock .icon { width: 15px; height: 15px; color: var(--a1); }
.live-clock b { font-family: var(--font-num); font-size: .95rem; }
.live-clock small { color: var(--muted); font-size: .78rem; }
@media (max-width: 900px) { .live-clock small { display: none; } }
@media (max-width: 720px) { .live-clock { display: none; } }

/* ---------- Page titles with an icon tile ---------- */
.page-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-icon { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--grad); color: #fff; flex: none;
  box-shadow: var(--glow); animation: icon-pop .6s var(--spring) both; }
.page-icon .icon { width: 23px; height: 23px; stroke-width: 2.2; }
.page-icon::after { content: ""; position: absolute; inset: -4px; border-radius: 19px; border: 1.5px solid color-mix(in srgb, var(--a2) 45%, transparent);
  animation: halo 3s ease-in-out infinite; }

/* ---------- Ambient live background ---------- */
.app-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; opacity: .9; animation: fade 1.2s ease both; }
.cursor-glow { position: fixed; left: 0; top: 0; width: 600px; height: 600px; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--a2) 14%, transparent), transparent 62%); transition: transform .25s ease-out; will-change: transform; }
:root[data-fx="off"] body::before, :root[data-fx="off"] body::after { animation: none; }

/* ---------- Light beam running around cards on hover ---------- */
@property --beam { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.card::after, .hero-banner .beam { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none; opacity: 0;
  background: conic-gradient(from var(--beam), transparent 0deg, var(--a1) 40deg, var(--a2) 80deg, var(--a3) 120deg, transparent 160deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); transition: opacity .4s; }
.card:hover::after { opacity: 1; animation: beam 2.6s linear infinite; }
@keyframes beam { to { --beam: 360deg; } }
.pos-cart::after { display: none; }

/* ---------- Scroll reveal: cards wait until they come into view ---------- */
.card:not(.in-view), .stat:not(.in-view), .order-card.enter:not(.in-view) { animation-play-state: paused; }

/* ---------- Sign-in tools ---------- */
.auth-tools { position: absolute; top: 16px; inset-inline-end: 16px; display: flex; gap: 8px; z-index: 5; }
.auth-tools .btn { background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* ---------- Topbar on small screens ---------- */
@media (max-width: 560px) {
  .topbar { padding: 8px 10px; gap: 6px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .btn-sm { padding: 5px 9px; }
  .brand-text small { display: none; }
  .tabs a span { font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .card:hover::after { animation: none; }
  .app-canvas, .cursor-glow { display: none; }
}
@media (max-width: 480px) { .brand-text { display: none; } }

/* =====================================================================
   MAAL brand — "ink on parchment, with oxblood" (default theme)
   Parchment for most of the screen, ink for text, oxblood for the one thing that matters,
   gold for thin rules and ornament. Fonts: Outfit, Marcellus, Noto Naskh Arabic, Aref Ruqaa.
   ===================================================================== */

/* ---------- Brand typography (all themes) ---------- */
:root {
  --font: "Outfit", "Noto Naskh Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-head: "Marcellus", "Aref Ruqaa", Georgia, serif;
  --font-num: "Outfit", system-ui, sans-serif;
}
h1, h2, .modal-head h2, .fx-title, .hero-title, .auth-card h1, .section-title h2 { font-family: var(--font-head); font-weight: 400; letter-spacing: 0; }
[dir="rtl"] h1, [dir="rtl"] .hero-title, [dir="rtl"] .auth-card h1, [dir="rtl"] .section-title h2, [dir="rtl"] .modal-head h2 { font-weight: 700; }
.page-head h1 { font-size: 1.75rem; }
.board-col h2, .tp-head strong { font-family: var(--font); font-weight: 650; }
.card h2 { font-size: 1.15rem; }
.stat-value, .hero-num, .fx-big, .order-no, .order-total, .pay-total, .live-clock b, .gauge-center strong, .hp-big { letter-spacing: -.01em; }

/* ---------- Maal palette: light ---------- */
:root[data-accent="maal"] {
  --a1: #7A2E1F; --a2: #B8892E; --a3: #5E2317;
  --oxblood: #7A2E1F; --ink: #1F1A14; --parchment: #F2E8D5; --gold: #B8892E; --paper: #FBF6EA; --palm: #2F4A3A; --gold-light: #D2A64A;
  --rule: var(--gold);
  --bg: #F2E8D5; --surface: #FBF6EA; --surface-2: #F5EDDC; --surface-3: #ECE1CB;
  --glass: rgba(251, 246, 234, .82); --glass-border: rgba(184, 137, 46, .22);
  --text: #1F1A14; --muted: #6B5E4C; --border: #E3D6BC;
  --primary: #7A2E1F; --primary-hover: #62241A; --primary-soft: #F1E0D6;
  --accent: #7A2E1F; --accent-2: #B8892E;
  --success: #2F4A3A; --success-soft: #E2EBE3; --warn: #94650F; --warn-soft: #F6E9C9;
  --danger: #A12A1C; --danger-soft: #F6DDD6; --info: #3C4F6B; --info-soft: #E3E8EF;
  --grad: linear-gradient(135deg, #8C3624 0%, #7A2E1F 55%, #66261A 100%);
  --grad-text: linear-gradient(#7A2E1F, #7A2E1F);
  --aurora-1: rgba(184, 137, 46, .16); --aurora-2: rgba(122, 46, 31, .10); --aurora-3: rgba(47, 74, 58, .08);
  --shadow: 0 1px 2px rgba(31, 26, 20, .05), 0 4px 14px rgba(31, 26, 20, .06);
  --shadow-lg: 0 2px 6px rgba(31, 26, 20, .06), 0 18px 40px rgba(31, 26, 20, .14);
  --glow: 0 6px 20px rgba(122, 46, 31, .25);
  --c1: #7A2E1F; --c2: #3C4F6B; --c3: #B8892E; --c4: #A12A1C; --c5: #2F4A3A; --c6: #8A5A44; --c-prev: #A89A84;
  --q-star: #2F4A3A; --q-workhorse: #3C4F6B; --q-puzzle: #B8892E; --q-dog: #A12A1C;
}
/* ---------- Maal palette: dark (ink background, parchment text, gold-light accents) ---------- */
:root[data-accent="maal"][data-theme="dark"] {
  --bg: #16120E; --surface: #211B15; --surface-2: #2A231B; --surface-3: #332A20;
  --glass: rgba(26, 21, 16, .82); --glass-border: rgba(210, 166, 74, .14);
  --text: #F2E8D5; --muted: #B5A68D; --border: #3B3127;
  --primary: #D2A64A; --primary-hover: #E0BA68; --primary-soft: #3A2E18;
  --accent: #D2A64A; --rule: var(--gold-light);
  --success: #8DB79B; --success-soft: #1F2E25; --warn: #E0BA68; --warn-soft: #3A2E18;
  --danger: #E58A76; --danger-soft: #3A1E17; --info: #A9B8CF; --info-soft: #222A36;
  --grad: linear-gradient(135deg, #8C3624 0%, #7A2E1F 55%, #66261A 100%);
  --grad-text: linear-gradient(#E9D9BB, #E9D9BB);
  --aurora-1: rgba(210, 166, 74, .10); --aurora-2: rgba(122, 46, 31, .16); --aurora-3: rgba(47, 74, 58, .10);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .3);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
  --glow: 0 6px 22px rgba(122, 46, 31, .45);
  --c1: #D2A64A; --c2: #A9B8CF; --c3: #E58A76; --c4: #C0503A; --c5: #8DB79B; --c6: #C9A27E; --c-prev: #6E6252;
  --q-star: #8DB79B; --q-workhorse: #A9B8CF; --q-puzzle: #D2A64A; --q-dog: #E58A76;
}
@media (prefers-color-scheme: dark) {
  :root[data-accent="maal"]:not([data-theme="light"]) {
    --bg: #16120E; --surface: #211B15; --surface-2: #2A231B; --surface-3: #332A20;
    --glass: rgba(26, 21, 16, .82); --glass-border: rgba(210, 166, 74, .14);
    --text: #F2E8D5; --muted: #B5A68D; --border: #3B3127;
    --primary: #D2A64A; --primary-hover: #E0BA68; --primary-soft: #3A2E18;
    --accent: #D2A64A; --rule: var(--gold-light);
    --success: #8DB79B; --success-soft: #1F2E25; --warn: #E0BA68; --warn-soft: #3A2E18;
    --danger: #E58A76; --danger-soft: #3A1E17; --info: #A9B8CF; --info-soft: #222A36;
    --grad-text: linear-gradient(#E9D9BB, #E9D9BB);
    --aurora-1: rgba(210, 166, 74, .10); --aurora-2: rgba(122, 46, 31, .16); --aurora-3: rgba(47, 74, 58, .10);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .3);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
    --glow: 0 6px 22px rgba(122, 46, 31, .45);
    --c1: #D2A64A; --c2: #A9B8CF; --c3: #E58A76; --c4: #C0503A; --c5: #8DB79B; --c6: #C9A27E; --c-prev: #6E6252;
    --q-star: #8DB79B; --q-workhorse: #A9B8CF; --q-puzzle: #D2A64A; --q-dog: #E58A76;
  }
}

/* ---------- Maal details: gold rules, oxblood action, parchment text on oxblood ---------- */
:root[data-accent="maal"] .btn-primary, :root[data-accent="maal"] .tabs a.active, :root[data-accent="maal"] .chip.active { color: #FBF6EA; }
:root[data-accent="maal"] .topbar::after { background: linear-gradient(90deg, transparent, var(--rule) 15%, var(--rule) 85%, transparent); height: 1px; animation: none; opacity: .8; }
:root[data-accent="maal"] .stat::before { background: var(--rule); height: 2px; }
:root[data-accent="maal"] .modal::before { background: var(--rule); height: 3px; }
:root[data-accent="maal"] .section-title h2::before { width: 9px; height: 9px; border-radius: 1px; transform: rotate(45deg); background: var(--primary); }
:root[data-accent="maal"] .card:hover::after { background: conic-gradient(from var(--beam), transparent 0deg, var(--rule) 50deg, var(--a1) 100deg, transparent 150deg, transparent 360deg); }
:root[data-accent="maal"] .page-icon::after { border-color: color-mix(in srgb, var(--rule) 55%, transparent); }
:root[data-accent="maal"] .product-noimg, :root[data-accent="maal"] .menu-item .product-noimg { background: #7A2E1F; color: #F2E8D5; font-family: "Aref Ruqaa", "Marcellus", serif; text-shadow: none; }
:root[data-accent="maal"] .product:nth-child(4n+2) .product-noimg { background: #1F1A14; }
:root[data-accent="maal"] .product:nth-child(4n+3) .product-noimg { background: #2F4A3A; }
:root[data-accent="maal"] .product:nth-child(4n+4) .product-noimg { background: #8A6420; }
:root[data-accent="maal"] .product-count { background: var(--rule); color: #1F1A14; box-shadow: 0 4px 12px rgba(184, 137, 46, .45); }
:root[data-accent="maal"] .order-items .qty { color: var(--primary); }
:root[data-accent="maal"] .hero-word { color: var(--primary); }
:root[data-accent="maal"] .theme-btn .icon { color: var(--rule); }
:root[data-accent="maal"] .live-clock .icon { color: var(--rule); }
:root[data-accent="maal"] .rank { background: var(--primary); color: var(--surface); }
/* analytics hero: ink to oxblood, gold gauge */
:root[data-accent="maal"] .hero-banner { background: linear-gradient(125deg, #1F1A14 0%, #3A1A12 50%, #7A2E1F 100%); color: #F2E8D5; box-shadow: var(--shadow-lg); }
:root[data-accent="maal"] .hero-glow { background: radial-gradient(closest-side at 25% 35%, rgba(210, 166, 74, .28), transparent), radial-gradient(closest-side at 75% 65%, rgba(122, 46, 31, .55), transparent); }
:root[data-accent="maal"] .gauge stop:nth-child(1) { stop-color: #B8892E; } :root[data-accent="maal"] .gauge stop:nth-child(2) { stop-color: #D2A64A; } :root[data-accent="maal"] .gauge stop:nth-child(3) { stop-color: #F2E8D5; }
:root[data-accent="maal"] .gauge-val { filter: drop-shadow(0 0 8px rgba(210, 166, 74, .55)); }
:root[data-accent="maal"] .hero-chip.up { background: rgba(47, 74, 58, .55); border-color: rgba(141, 183, 155, .5); }
/* celebrations in brand colours */
:root[data-accent="maal"] .fx-check-ring, :root[data-accent="maal"] .fx-check-mark { stroke: #2F4A3A; filter: none; }
:root[data-accent="maal"][data-theme="dark"] .fx-check-ring, :root[data-accent="maal"][data-theme="dark"] .fx-check-mark { stroke: #8DB79B; }
:root[data-accent="maal"] .fx-celebrate-card { box-shadow: var(--shadow-lg); border-color: var(--border); background: var(--surface); }
:root[data-accent="maal"] .fx-stamp { color: #2F4A3A; border-color: #2F4A3A; font-family: "Marcellus", "Aref Ruqaa", serif; }

/* ---------- Diamond rule (— ◆ —), the brand's ornament ---------- */
.maal-rule { display: flex; align-items: center; gap: 10px; width: min(260px, 70%); margin: 4px 0 18px; }
.maal-rule i { flex: 1; height: 2px; background: var(--rule, var(--a2)); border-radius: 2px; transform-origin: center; animation: rule-in .9s var(--ease) .35s both; }
.maal-rule b { width: 10px; height: 10px; background: var(--primary); transform: rotate(45deg); flex: none; animation: pop .6s var(--spring) .9s both; }
@keyframes rule-in { from { transform: scaleX(0); } }
@media (max-width: 960px) { .maal-rule { margin-inline: auto; } }

/* ---------- Logo (supplied versions only; no shadows, effects or stretching) ---------- */
.maal-logo { display: inline-block; line-height: 0; flex: none; }
.maal-logo img { height: 100%; width: auto; display: block; filter: none; }
.maal-logo .logo-on-dark { display: none; }
:root[data-theme="dark"] .maal-logo .logo-on-light { display: none; }
:root[data-theme="dark"] .maal-logo .logo-on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .maal-logo .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .maal-logo .logo-on-dark { display: block; }
}
.topbar-logo { height: 46px; } /* ≈130 px wide, above the 120 px minimum for the horizontal logo */
.maal-icon { display: block; width: 40px; height: 40px; border-radius: 11px; flex: none; }
.brand-mark.maal-icon { background: none; animation: none; box-shadow: none; }

/* ---------- Sign-in in brand ---------- */
.auth-card { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--border); }
.auth-brand { display: grid; place-items: center; padding: 6px 0 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.auth-logo-maal { height: 128px; } /* stacked logo ≈ 140 px wide (minimum 96 px) */
.auth-card h1 { text-align: center; margin: 16px 0 6px; font-size: 1.55rem; }
.auth-lead { text-align: center; margin: 0 0 20px; }
:root[data-accent="maal"] .auth-card h1 { background: none; color: var(--primary); -webkit-background-clip: border-box; background-clip: border-box; }
.hero-brand { gap: 14px; }
.hero-icon { width: 52px; height: 52px; border-radius: 14px; display: block; }
.hero-maal { font-family: "Marcellus", serif; letter-spacing: .5em; font-size: 1.05rem; color: var(--muted); }
:root[data-accent="maal"] .hero-title .grad { background: none; color: var(--primary); -webkit-background-clip: border-box; background-clip: border-box; animation: rise .8s var(--ease) .12s both; }
.hero-title { font-size: clamp(2.4rem, 5.4vw, 4.6rem); line-height: 1.05; }
[dir="rtl"] .hero-title { font-family: "Aref Ruqaa", serif; line-height: 1.35; }
:root[data-accent="maal"] .hp { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-accent="maal"] .hp-bars i { background: var(--primary); }
:root[data-accent="maal"] .hp-bars i:nth-child(odd) { background: var(--rule); }
:root[data-accent="maal"] .hp-big { background: none; color: var(--primary); -webkit-background-clip: border-box; background-clip: border-box; }
:root[data-accent="maal"] .page-head h1 { background: none; color: var(--primary); -webkit-background-clip: border-box; background-clip: border-box; }
:root[data-accent="maal"] .pay-total, :root[data-accent="maal"] .fx-big, :root[data-accent="maal"] .cart-totals .grand > :last-child { background: none; color: var(--primary); -webkit-background-clip: border-box; background-clip: border-box; }

/* ---------- Receipt: one-colour wordmark ---------- */
.receipt-brand { display: none; }
@media print {
  .receipt-brand { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; font: 10px/1 "Marcellus", serif; letter-spacing: .3em; }
  .receipt-brand img { height: 6mm; width: auto; }
}
:root[data-accent="maal"][data-theme="dark"] .product:nth-child(4n+2) .product-noimg { background: #F2E8D5; color: #1F1A14; }
@media (prefers-color-scheme: dark) { :root[data-accent="maal"]:not([data-theme="light"]) .product:nth-child(4n+2) .product-noimg { background: #F2E8D5; color: #1F1A14; } }

/* ---------- Two-step sign-in ---------- */
.mfa-shield { font-size: 2rem; text-align: center; margin: 14px 0 -6px; animation: pop .6s var(--spring) both; }
.mfa-code { font-family: var(--font-num); font-size: 1.9rem; letter-spacing: .5em; text-align: center; padding: 12px 8px 12px calc(8px + .5em); font-weight: 600; direction: ltr; }
.mfa-code.recovery { font-size: 1.3rem; letter-spacing: .12em; text-transform: uppercase; }
.mfa-card { width: min(520px, 100%); }
.mfa-steps { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 16px; }
.mfa-steps > li { counter-increment: step; position: relative; padding-inline-start: 40px; display: flex; flex-direction: column; gap: 6px; }
.mfa-steps > li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--surface); font-weight: 750; font-size: .85rem; }
.mfa-steps .field { margin: 4px 0 0; }
.mfa-qr-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.mfa-qr { width: 180px; height: 180px; border-radius: 12px; background: #fff; padding: 6px; border: 1px solid var(--border); flex: none; }
.mfa-key { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.mfa-key-text { font-size: 1rem; letter-spacing: .08em; word-break: normal; overflow-wrap: normal; word-spacing: .2em; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--border); }
.mfa-open-app { display: none; }
@media (hover: none) and (pointer: coarse) { .mfa-open-app { display: inline-flex; } }
.mfa-done { text-align: center; margin-bottom: 8px; }
.mfa-done h3 { margin: 8px 0 4px; font-size: 1.2rem; }
.mfa-tick { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--success-soft); color: var(--success);
  font-size: 1.8rem; font-weight: 800; animation: pop .6s var(--spring) both; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; margin: 12px 0; padding: 14px 14px 14px 34px; background: var(--surface-2);
  border: 1px dashed var(--rule, var(--border)); border-radius: 12px; }
.recovery-codes code { font-size: 1rem; letter-spacing: .06em; background: none; padding: 0; }
.mfa-saved { margin: 14px 0 10px; font-weight: 600; }
.mfa-recovery .row-actions { justify-content: flex-start; }
.mfa-settings .row-actions { margin-top: 4px; }

/* ---------- Password rules checklist ---------- */
.pw-rules { list-style: none; margin: -4px 0 14px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; display: grid; gap: 5px; font-size: .86rem; color: var(--muted); }
.pw-rule { display: flex; align-items: center; gap: 8px; transition: color .2s; }
.pw-dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border); flex: none; display: grid; place-items: center; transition: background-color .2s, border-color .2s; }
.pw-rule.ok { color: var(--success); }
.pw-rule.ok .pw-dot { background: var(--success); border-color: var(--success); }
.pw-rule.ok .pw-dot::after { content: "✓"; color: var(--surface); font-size: .65rem; font-weight: 900; }

/* ---------- Offline mode ---------- */
.conn-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text); font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer; white-space: nowrap; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); flex: none; }
.conn-pill.on .conn-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent); }
.conn-pill.off { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.conn-pill.off .conn-dot { background: var(--warn); animation: live 1.6s ease-in-out infinite; }
.conn-pill.sync .conn-dot { background: var(--info); animation: live 1s ease-in-out infinite; }
.conn-pill.problem { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.conn-pill.problem .conn-dot { background: var(--danger); }
@media (max-width: 560px) { .conn-pill.on .conn-text { display: none; } .conn-pill { padding: 6px 9px; } }
.offline-banner { display: flex; gap: 8px; align-items: flex-start; }
.offline-empty { display: grid; justify-items: center; gap: 6px; padding: 40px 20px; }
.offline-empty p { margin: 0; max-width: 420px; }
.offline-icon { font-size: 2.2rem; }
.order-card.is-local { border-style: dashed; border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.order-notes.review { background: var(--warn-soft); border-inline-start: 3px solid var(--warn); }
.queue-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.queue-item { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.queue-item.problem { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.queue-error { margin-top: 6px; color: var(--danger); font-size: .88rem; display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* ---------- Payments: split and mixed ---------- */
.billpay { display: grid; gap: 14px; }
.bill-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bill-summary > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; }
.bill-summary small { color: var(--muted); font-weight: 650; }
.bill-summary strong { font: 800 1.15rem var(--font-num); }
.bill-summary .left { background: color-mix(in srgb, var(--a2) 12%, var(--surface)); outline: 1.5px solid color-mix(in srgb, var(--a2) 35%, transparent); }
.bill-items summary { cursor: pointer; font-weight: 650; color: var(--muted); }
.bill-items ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.bill-items li { display: flex; justify-content: space-between; gap: 10px; }
.bill-items li.paid { color: var(--muted); text-decoration: line-through; }
.split-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-pick { display: grid; gap: 6px; max-height: 240px; overflow: auto; padding: 2px; }
.item-pick-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.big-input { font: 800 1.4rem var(--font-num) !important; min-height: 52px; }
.change-box:empty { display: none; }
.change-hint { color: var(--muted); font-weight: 650; }
.change-ok, .change-bad { display: flex; justify-content: space-between; align-items: center; border-radius: var(--radius-sm); padding: 12px 16px; }
.change-ok { background: var(--success-soft); color: var(--success); }
.change-bad { background: var(--danger-soft); color: var(--danger); }
.change-ok strong, .change-bad strong { font: 850 1.6rem var(--font-num); }
.pay-parts { display: grid; gap: 4px; border-top: 1px dashed var(--border); padding-top: 8px; }
.pay-part { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .92rem; }
.bill-done { text-align: center; display: grid; gap: 12px; justify-items: center; }
.bill-done .change-ok { width: 100%; }
.bill-done-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; color: #fff; background: var(--grad); animation: pop .4s var(--spring); }
.bill-orders { display: grid; gap: 10px; margin: 10px 0; }
.bill-order { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.bill-order-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bill-order-head .r { margin-inline-start: auto; font-weight: 750; }
.bill-order ul { margin: 6px 0 0; padding-inline-start: 18px; }
.bill-total { display: flex; justify-content: space-between; font-size: 1.15rem; padding: 6px 2px 10px; }

/* ---------- Floor plan ---------- */
.area-tabs { margin-bottom: 10px; }
.chip-add { border-style: dashed; color: var(--muted); }
.floor { position: relative; width: 100%; aspect-ratio: 1000 / 640; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; user-select: none; touch-action: none;
  background: var(--surface) radial-gradient(color-mix(in srgb, var(--muted) 22%, transparent) 1px, transparent 1.4px) 0 0 / 2.5% 3.9%; }
.floor-live { touch-action: manipulation; }
.ftable { position: absolute; display: grid; place-content: center; text-align: center; gap: 0; padding: 2px; border-radius: 12px; font: inherit; cursor: pointer; overflow: hidden;
  background: var(--success-soft); border: 2px solid color-mix(in srgb, var(--success) 45%, transparent); color: var(--text); line-height: 1.15;
  transition: transform .15s var(--spring), box-shadow .15s; container-type: size; }
.ftable.shape-round { border-radius: 50%; }
.ftable strong { font-size: clamp(.7rem, 22cqmin, 1.25rem); }
.ftable small { font-size: clamp(.55rem, 13cqmin, .8rem); color: var(--muted); white-space: nowrap; }
.ftable .ftotal { color: var(--text); font-weight: 750; }
.ftable.state-busy { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.ftable.state-ready { background: var(--info-soft); border-color: var(--info); animation: ready-pulse 1.6s ease-in-out infinite; }
.fready { position: absolute; top: 3px; inset-inline-end: 3px; font-size: .6rem; font-weight: 800; background: var(--info); color: #fff; border-radius: 6px; padding: 0 4px; }
@keyframes ready-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--info) 25%, transparent); } }
.floor-live .ftable:hover { transform: scale(1.04); box-shadow: var(--shadow-lg); }
.floor-edit .ftable { cursor: grab; background: var(--surface-2); border-color: var(--border); }
.floor-edit .ftable.state-busy { border-color: var(--warn); }
.floor-edit .ftable.selected { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); z-index: 2; }
.floor-edit .ftable:active { cursor: grabbing; }
.floor-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 10px; font-size: .88rem; }
.floor-legend .lg::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-inline-end: 6px; vertical-align: -1px; border: 2px solid; }
.lg.free::before { background: var(--success-soft); border-color: var(--success); }
.lg.busy::before { background: var(--warn-soft); border-color: var(--warn); }
.lg.ready::before { background: var(--info-soft); border-color: var(--info); }
.floor-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.floor-toolbar .spacer { flex: 1; }
.floor-design { display: grid; grid-template-columns: 1fr 260px; gap: 14px; align-items: start; }
.floor-side { position: sticky; top: 12px; }
.inspector h3 { margin-top: 0; }
@media (max-width: 860px) { .floor-design { grid-template-columns: 1fr; } .floor-side { position: static; } }

/* ---------- Stock ---------- */
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.stock-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.stock-card.state-low { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); }
.stock-card.state-out { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); background: color-mix(in srgb, var(--danger-soft) 50%, var(--surface)); }
.stock-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stock-qty b { font: 850 1.8rem var(--font-num); margin-inline-end: 6px; }
.small { font-size: .85rem; }
.neg { color: var(--danger); font-weight: 750; } .pos { color: var(--success); font-weight: 750; }
.link-list { display: grid; gap: 6px; max-height: 340px; overflow: auto; }
.link-row { display: grid; grid-template-columns: 1fr auto 90px; gap: 10px; align-items: center; padding: 4px 8px; border-radius: 10px; }
.link-row:hover { background: var(--surface-2); }
.qty-input { width: 90px; }
.product-short { display: block; font-size: .7rem; font-weight: 700; color: var(--warn); line-height: 1.2; margin-top: 2px; }

/* ---------- Shifts ---------- */
.shift-open { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.dot-live { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--success); margin-inline-end: 8px; animation: ready-pulse 1.6s infinite; }
code.ref { font: 800 .95rem var(--font-num); letter-spacing: .04em; background: var(--surface-2); padding: 3px 8px; border-radius: 8px; }
code.ref.big { font-size: 1.3rem; }
.report-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 14px; }
.report-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.report-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.report-table .r { text-align: end; font-family: var(--font-num); font-weight: 650; white-space: nowrap; }
.report-table tr.strong td { font-weight: 800; }
.report-table tr.bad td { color: var(--danger); font-weight: 800; }
.report-table tr.good td { color: var(--success); font-weight: 800; }
.shift-report h3 { margin: 18px 0 6px; }

/* ---------- Notifications ---------- */
.bell { position: relative; }
.bell-count:empty { display: none; }
.bell-count { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }
.bell.has-new .icon { animation: ring 1.2s ease-in-out 2; transform-origin: 50% 10%; }
@keyframes ring { 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } 50% { transform: none; } }
.notif-list { display: grid; gap: 8px; }
.notif { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.notif.unread { background: color-mix(in srgb, var(--a2) 7%, var(--surface)); border-color: color-mix(in srgb, var(--a2) 30%, var(--border)); }
.notif-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.kind-order_cancelled .notif-icon { background: var(--danger-soft); color: var(--danger); }
.kind-stock_low .notif-icon { background: var(--warn-soft); color: var(--warn); }
.kind-stock_out .notif-icon { background: var(--danger-soft); }
.alert-pop { text-align: center; }
.alert-icon { font-size: 2.6rem; animation: pop .4s var(--spring); }

@media print {
  .receipt-wide { width: auto; text-align: start; }
  .receipt-wide .stats { display: flex; gap: 12px; }
  .receipt-wide .stat::before { display: none; }
}
.report-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 6px; }
.report-tile { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; border-top: 3px solid var(--a2); }
.report-tile strong { font: 800 1.15rem var(--font-num); }
.report-tile small { color: var(--muted); font-weight: 650; }
@media print { .report-tiles { display: flex; } .report-tile { border: 1px solid #000; } }
