:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f1eee6;
  --text: #1d1b16;
  --muted: #6b665c;
  --line: #e4dfd3;
  --primary: #e11d48;
  --primary-ink: #ffffff;
  --primary-soft: #ffe4e6;
  --amber: #a15c07;
  --amber-soft: #fcefd6;
  --green: #15803d;
  --green-soft: #dcf4e3;
  --red: #b91c1c;
  --red-soft: #fde2e2;
  /* Solid fills behind white text. In dark mode the text colours above get lighter, these do not. */
  --primary-fill: linear-gradient(160deg, #f53d64, #e11d48 55%, #c5143e); /* the logo's tile */
  --primary-glow: 0 6px 18px -6px rgb(225 29 72 / 0.55);
  --green-fill: #15803d;
  --red-fill: #b91c1c;
  --star-off: #e4dfd3;
  --switch-off: #dcd6ca;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 10px 30px rgb(0 0 0 / 0.06);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.06), 0 14px 34px rgb(0 0 0 / 0.1);

  /* Motion: short and soft. prefers-reduced-motion switches it off (end of this file). */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --fast: 0.2s;
  --mid: 0.3s;
  --slow: 0.4s;
  color-scheme: light;
}

/* Dark mode: chosen with the 🌙 button (theme.js) and remembered; light stays the default.
   A warm, deep plum-black, so the rose still feels like Nadini at night. */
:root[data-theme='dark'] {
  --bg: #120c0f;
  --surface: #1c1418;
  --surface-2: #281d22;
  --text: #f8eef1;
  --muted: #b5a2a9;
  --line: #3a2a31;
  --primary: #fb7185;
  --primary-ink: #ffffff;
  --primary-soft: #3d1522;
  --primary-glow: 0 6px 22px -6px rgb(244 63 94 / 0.6);
  --amber: #fbbf24;
  --amber-soft: #36270c;
  --green: #4ade80;
  --green-soft: #0f2b1b;
  --red: #f87171;
  --red-soft: #3b1518;
  --red-fill: #dc2626;
  --star-off: #4b3a41;
  --switch-off: #4a3940;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 12px 32px rgb(0 0 0 / 0.45);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.5), 0 18px 40px rgb(0 0 0 / 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
/* Arabic uses Tajawal and Hebrew uses Heebo; each falls back to the other for mixed text. */
[lang='ar'] { font-family: 'Tajawal', 'Heebo', 'Segoe UI', Tahoma, sans-serif; }
[lang='he'] { font-family: 'Heebo', 'Tajawal', 'Segoe UI', Tahoma, sans-serif; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0; }

/* --- Building blocks --- */

.shell { width: min(100%, 520px); margin: 0 auto; padding: 20px 16px 40px; }
.shell.wide { width: min(100%, 1200px); }

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
/* The name is set in Lalezar, the logo's font, in both languages. */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Lalezar', 'Tajawal', sans-serif; font-weight: 400; font-size: 1.7rem; line-height: 1;
  color: var(--primary);
}
.logo img { width: 40px; height: 40px; }

/* A restaurant's own logo beside its name (`logo` on restaurants/{slug}). */
.restaurant { display: flex; align-items: center; gap: 12px; }
.restaurant-logo { flex: none; width: 56px; height: 56px; border-radius: 14px; object-fit: cover; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--fast) var(--ease-spring), box-shadow var(--mid) var(--ease-out),
    background-color var(--fast) ease, border-color var(--fast) ease, color var(--fast) ease;
}
@media (hover: hover) {
  .btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: var(--shadow); }
  .btn-ghost:not(:disabled):hover, .btn-danger:not(:disabled):hover {
    transform: none; box-shadow: none; background: var(--surface-2);
  }
  .btn-link:not(:disabled):hover { transform: none; box-shadow: none; color: var(--text); }
}
.btn:not(:disabled):active { transform: scale(0.97); transition-duration: 0.08s; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary {
  background: var(--primary-fill); color: var(--primary-ink); border-color: transparent;
  box-shadow: var(--primary-glow);
}
@media (hover: hover) {
  .btn-primary:not(:disabled):hover { box-shadow: var(--primary-glow), 0 12px 28px -12px rgb(225 29 72 / 0.65); }
}
.btn-ready { background: var(--green-fill); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); background: transparent; }
.btn-big { width: 100%; min-height: 58px; font-size: 1.15rem; border-radius: 14px; }
.btn-link { background: none; border: 0; color: var(--muted); text-decoration: underline; min-height: 40px; }

/* Keyboard focus: a soft rose ring everywhere. */
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* The corner tools on every page: the 🌙/☀️ button, then the language switch. */
.tools { display: flex; align-items: center; gap: 8px; flex: none; }

/* Language switch: top corner of every page, opposite the logo. Shows the other language's name. */
.lang-toggle {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 40px; padding: 6px 14px 6px 12px; border-radius: 99px;
  border: 1.5px solid var(--primary); background: var(--surface); color: var(--primary);
  font-weight: 800; font-size: 0.95rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--fast) ease, transform var(--fast) var(--ease-spring);
}
.lang-toggle:hover { background: var(--primary-soft); }
.lang-toggle:active { transform: scale(0.95); }
.lang-toggle svg { width: 18px; height: 18px; flex: none; }

/* Dark mode switch (theme.js draws it): a moon with two twinkling stars in light mode, a sun in dark mode.
   On a tap the moon turns away and the sun spins in. */
.theme-toggle {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--primary); background: var(--surface); color: var(--primary);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--fast) ease, transform var(--fast) var(--ease-spring);
}
.theme-toggle:hover { background: var(--primary-soft); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle svg { width: 22px; height: 22px; overflow: visible; }
.theme-toggle .moon, .theme-toggle .sun {
  transform-box: view-box; transform-origin: center;
  transition: transform 0.5s var(--ease-spring), opacity var(--mid) ease;
}
.theme-toggle .moon { fill: currentColor; }
/* The sparkles twinkle twice when the page opens and again on hover, then rest: a tablet that shows
   the dashboard all day should not repaint anything when nothing happens. */
.theme-toggle .twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 1.6s ease-in-out 0.6s 2; }
.theme-toggle .twinkle + .twinkle { animation-delay: 1.4s; }
.theme-toggle:hover .twinkle { animation: twinkle-hover 1.2s ease-in-out infinite; }
.theme-toggle:hover .twinkle + .twinkle { animation-delay: 0.4s; }
.theme-toggle .sun { opacity: 0; transform: rotate(-120deg) scale(0.3); }
.theme-toggle .sun circle { fill: currentColor; }
.theme-toggle .sun path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
:root[data-theme='dark'] .theme-toggle .moon { opacity: 0; transform: rotate(100deg) scale(0.3); }
:root[data-theme='dark'] .theme-toggle .sun { opacity: 1; transform: none; }
@keyframes twinkle { 50% { transform: scale(0.35); opacity: 0.25; } }
@keyframes twinkle-hover { 50% { transform: scale(0.35); opacity: 0.25; } }

/* Without a view transition, the colours fade into the new theme instead of jumping (theme.js). */
:root.theme-fade, :root.theme-fade *, :root.theme-fade *::before, :root.theme-fade *::after {
  transition: background-color var(--slow) ease, border-color var(--slow) ease, color var(--slow) ease !important;
}
/* With one (Chrome, Safari 18+), the new theme opens as a circle from the button (theme.js). */
:root.theme-reveal::view-transition-old(root), :root.theme-reveal::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

label { display: block; font-weight: 700; margin-bottom: 8px; }
input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 1rem;
  transition: border-color var(--fast) ease, background-color var(--fast) ease, box-shadow var(--mid) var(--ease-out);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}
.field { margin-bottom: 14px; }
.number-input {
  text-align: center; font-size: 2.4rem; font-weight: 800; letter-spacing: 0.08em;
  min-height: 76px; margin-bottom: 14px; direction: ltr;
}

.error { color: var(--red); font-weight: 700; margin: 12px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.toast {
  position: fixed; inset-inline: 16px; bottom: 20px; margin: 0 auto; max-width: 420px;
  padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-weight: 700; text-align: center; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(14px) scale(0.96); pointer-events: none;
  transition: opacity var(--fast) ease, transform var(--mid) var(--ease-spring); z-index: 50;
}
.toast.show { opacity: 1; transform: none; }
.toast[data-kind='ok'] { background: var(--green-fill); color: #fff; }

/* --- Customer page --- */

.customer h1 { font-size: 1.5rem; }
.order-label { margin: 0; text-align: center; color: var(--muted); font-weight: 700; }
.order-number {
  margin: 4px 0 18px; text-align: center; direction: ltr;
  font-size: clamp(3.5rem, 22vw, 6rem); font-weight: 800; line-height: 1;
}

/* The wait (phase 2): a ring around the number fills as the promised time passes, rose → amber → green,
   and closes with a ✓ and a small burst when the order is ready. Under it, the stages tick by. */
.ring {
  --ring: #e11d48;
  position: relative; display: grid; place-content: center; justify-items: center; gap: 4px;
  width: min(240px, 72vw); aspect-ratio: 1; margin: 18px auto 14px;
}
.ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 6; }
.ring-fill {
  fill: none; stroke: var(--ring); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--ring) 45%, transparent));
  transition: stroke-dashoffset 5s linear, stroke 1.2s ease, opacity var(--mid) ease;
}
/* Without a promised time the ring only frames the number, until it closes on "ready". */
.ring:not(.timed):not([data-state='ready']):not([data-state='collected']) .ring-fill { opacity: 0; }
.ring[data-state='ready'] .ring-fill, .ring[data-state='collected'] .ring-fill { transition: stroke-dashoffset 0.9s var(--ease-out), stroke 0.5s ease; }
.ring.late .ring-fill { animation: ring-breathe 2.4s ease-in-out infinite; }
.ring .order-number { margin: 0; font-size: clamp(3.2rem, 18vw, 5.2rem); }
.ring-time { margin: 0; color: var(--muted); font-size: 1.1rem; font-weight: 800; }
.ring.timed .ring-time { color: var(--text); }
.ring-check {
  position: absolute; top: -4px; left: 50%; display: grid; place-items: center; width: 42px; height: 42px; margin-left: -21px;
  border-radius: 50%; background: var(--green-fill); color: #fff; box-shadow: 0 0 0 5px var(--surface), 0 8px 18px -6px rgb(21 128 61 / 0.6);
  transform: scale(0); transition: transform 0.5s var(--ease-spring) 0.35s;
}
.ring-check svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ring[data-state='ready'] .ring-check, .ring[data-state='collected'] .ring-check { transform: scale(1); }
.confetti {
  position: absolute; top: 50%; left: 50%; width: 8px; height: 13px; border-radius: 2px; pointer-events: none; opacity: 0;
  animation: burst 1.2s cubic-bezier(0.2, 0.8, 0.3, 1) var(--delay, 0ms) forwards;
}
.confetti:nth-child(3n) { width: 10px; height: 10px; border-radius: 50%; }
@keyframes burst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--r)) scale(1); }
}
@keyframes ring-breathe { 50% { opacity: 0.5; } }

.stages { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 16px; padding: 0; list-style: none; }
.stages li { position: relative; display: grid; justify-items: center; gap: 6px; color: var(--muted); font-size: 0.88rem; font-weight: 700; text-align: center; }
.stages li + li::before {
  content: ''; position: absolute; top: 10px; inset-inline-end: 50%; width: 100%; height: 3px; border-radius: 99px;
  background: var(--line); transition: background-color var(--slow) ease;
}
.stages li[data-state='done'] + li::before, .stages li[data-state='done'] + li[data-state]::before { background: var(--green); }
.stage-dot {
  position: relative; z-index: 1; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--line); color: #fff;
  transition: background-color var(--mid) ease, border-color var(--mid) ease, transform var(--mid) var(--ease-spring);
}
.stage-dot svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity var(--mid) ease; }
.stages li[data-state='done'] .stage-dot { background: var(--green-fill); border-color: transparent; }
.stages li[data-state='done'] .stage-dot svg { opacity: 1; }
.stages li[data-state='now'] { color: var(--text); }
.stages li[data-state='now'] .stage-dot { border-color: var(--primary); transform: scale(1.1); animation: stage-now 1.8s ease-out infinite; }
.stages li[data-state='now']:last-child .stage-dot { border-color: var(--green); }
@keyframes stage-now { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 50%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } }

.status {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px; border-radius: 14px; margin-bottom: 16px;
  font-size: 1.2rem; font-weight: 800; text-align: center;
  background: var(--surface-2); color: var(--muted);
  transition: background-color var(--mid) ease, color var(--mid) ease;
}
.status .dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: none; }
.status[data-status='preparing'] { background: var(--amber-soft); color: var(--amber); }
.status[data-status='preparing'] .dot { animation: pulse 1.4s ease-in-out infinite; }
.status[data-status='ready'] { background: var(--green-soft); color: var(--green); font-size: 1.4rem; }
.status[data-status='collected'] { background: var(--primary-soft); color: var(--primary); }
.status[data-status='removed'] { background: var(--red-soft); color: var(--red); }

.channels { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.channels li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 0.95rem;
}
.channels li::before {
  content: ''; width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted);
}
.channels li[data-state='on']::before { background: var(--green); }
.channels li[data-state='off']::before { background: var(--amber); }
.channels li button { margin-inline-start: auto; min-height: 36px; padding: 6px 12px; }

.hint { margin: 0 0 8px; color: var(--muted); text-align: center; font-size: 0.95rem; }
.offline { color: var(--red); text-align: center; font-weight: 700; margin: 0 0 10px; }

body.alerting { animation: flash 1s steps(2, jump-none) infinite; }
@keyframes flash { 50% { background: var(--green-soft); } }
@keyframes pulse { 50% { opacity: 0.25; } }

/* --- Dashboard --- */

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-bottom: 18px;
}
.topbar h1 { font-size: 1.35rem; margin-inline-end: auto; }
.topbar .restaurant-logo { width: 38px; height: 38px; border-radius: 10px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 8px; }
.topbar nav .btn { min-height: 38px; padding: 6px 12px; font-size: 0.92rem; }

.entry { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: end; margin-bottom: 14px; }
.entry input { font-size: 1.6rem; font-weight: 800; text-align: center; direction: ltr; min-height: 58px; }
.entry .btn { min-height: 58px; padding-inline: 22px; font-size: 1.05rem; }

.stats { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 0.95rem; margin-bottom: 18px; }
.stats strong { color: var(--text); }

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.column h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin-bottom: 10px; }
.count {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 0.9rem;
}
.list { display: grid; gap: 10px; }
.empty { padding: 18px; border: 1.5px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }

.order {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center;
  padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.order .num { font-size: 2rem; font-weight: 800; direction: ltr; min-width: 70px; text-align: center; grid-row: span 2; }
.order .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 0.88rem; color: var(--muted); }
.order .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.order .actions .btn { min-height: 40px; padding: 6px 14px; }
.order.ready { border-color: var(--green); background: var(--green-soft); }
/* Late orders (phase 3): amber from the expected time, red once late, nudged once when they turn red.
   Nothing here moves forever: a tablet shows the board all day. */
.order.due { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); background: color-mix(in srgb, var(--amber-soft) 70%, var(--surface)); }
.order.late { border-color: var(--red); background: color-mix(in srgb, var(--red-soft) 80%, var(--surface)); box-shadow: inset -4px 0 0 var(--red); }
.order.late .num { color: var(--red); }
.order .due.red { color: var(--red); }
.order.nudge { animation: nudge 0.7s var(--ease-out), glow-red 1.4s var(--ease-out); }
@keyframes nudge { 15%, 45% { transform: translateX(-5px); } 30%, 60% { transform: translateX(5px); } 75% { transform: none; } }
@keyframes glow-red { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.late-badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; background: var(--red-fill); color: #fff;
  font-size: 0.85rem; font-weight: 800; animation: pop-in var(--mid) var(--ease-spring);
}

/* The sound and full-screen buttons beside the theme and language buttons. */
.tool-toggle {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--primary); background: var(--surface); color: var(--primary); cursor: pointer;
  transition: background-color var(--fast) ease, transform var(--fast) var(--ease-spring);
}
.tool-toggle:hover { background: var(--primary-soft); }
.tool-toggle:active { transform: scale(0.92); }
.tool-toggle .i { width: 19px; height: 19px; }
.tool-toggle[aria-pressed='false'] { color: var(--muted); border-color: var(--line); }

/* Tablet mode: one tap after a reload. */
.tablet-card { display: grid; justify-items: center; gap: 6px; max-width: 400px; text-align: center; }
.tablet-card h2 { margin: 6px 0 0; }
.tablet-art {
  display: grid; place-items: center; width: 92px; height: 92px; border-radius: 28px; margin-bottom: 4px;
  background: var(--primary-fill); box-shadow: var(--primary-glow), 0 18px 34px -18px rgb(190 18 60 / 0.6);
  animation: pop-in var(--slow) var(--ease-spring) both;
}
.tablet-art img { width: 64px; height: 64px; filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.2)); }
.tablet-card .btn-big { width: 100%; }

/* Signing in on the display screen itself. */
.display-login { display: grid; gap: 4px; margin-top: 8px; }
.display-login .btn-big { margin-top: 6px; }
/* The time left of the wait promised to the customer, and "+5 min" (phase 2). */
.order .due { color: var(--text); font-weight: 700; }
.order .due.late { color: var(--amber); }
.btn-extend { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); color: var(--primary); font-weight: 800; }
@media (hover: hover) { .btn-extend:not(:disabled):hover { background: var(--primary-soft); } }
.badge { padding: 1px 8px; border-radius: 99px; font-weight: 700; background: var(--surface-2); }
.badge.on { background: var(--green-soft); color: var(--green); }
.badge.off { background: var(--amber-soft); color: var(--amber); }
.badge.seen { background: var(--green); color: var(--surface); }

.note-warn { margin: 0 0 12px; padding: 8px 14px; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 0.92rem; font-weight: 700; }
details.collected { margin-top: 18px; }
details.collected summary { cursor: pointer; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.collected .order { opacity: 0.7; }

.login { max-width: 420px; margin: 8vh auto 0; }
.login h1 { font-size: 1.4rem; margin-bottom: 4px; }
.login p { margin: 0 0 18px; }

@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; }
  .entry { grid-template-columns: 1fr 1fr; }
  .entry .field { grid-column: 1 / -1; margin: 0; }
}

/* --- Admin --- */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab {
  min-height: 42px; padding: 8px 18px; border-radius: 99px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 800; cursor: pointer;
}
.tab { transition: background-color var(--fast) ease, border-color var(--fast) ease, transform var(--fast) var(--ease-spring); }
.tab:active { transform: scale(0.96); }
.tab[aria-selected='true'] { background: var(--primary-fill); border-color: transparent; color: var(--primary-ink); box-shadow: var(--primary-glow); }
.section-head { margin-bottom: 14px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.admin-restaurant { padding: 18px; }
.admin-restaurant h3 { font-size: 1.15rem; }
.admin-restaurant p { margin: 10px 0; }
.admin-restaurant .actions, dialog .actions, .member .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-restaurant .btn, .member .btn { min-height: 38px; padding: 6px 12px; font-size: 0.92rem; }
#tab-admins { max-width: 760px; }
#tab-admins h2 { font-size: 1.2rem; margin-bottom: 4px; }
.members { margin: 10px 0; }
.member { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.who { display: grid; margin-inline-end: auto; min-width: 0; }
.who .email { font-weight: 700; word-break: break-all; }
.who strong + .email { font-weight: 500; color: var(--muted); font-size: 0.9rem; }
.badge.pending { background: var(--amber-soft); color: var(--amber); }
.invite-form { margin-top: 16px; }
.invite-form h3 { font-size: 1.05rem; margin-bottom: 10px; }
.invite-fields { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 10px; align-items: end; }
select {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 1rem;
}
.share-status { color: var(--green); font-weight: 800; margin: 0 0 6px; }
.invite-fields .field { margin: 0; }
.invite-fields .btn { min-height: 48px; }
.archived-box { margin-top: 24px; }
.archived-box summary { cursor: pointer; color: var(--muted); font-weight: 700; margin-bottom: 12px; }
.admin-restaurant.archived { border-style: dashed; opacity: 0.85; }
.btn-danger-solid { background: var(--red-fill); color: #fff; border-color: transparent; }
.btn-whatsapp { background: #25d366; color: #fff; border-color: transparent; }

/* A confirmation. Red, with a warning sign, when the action cannot be undone. */
#confirm-dialog { width: min(100% - 32px, 460px); }
.confirm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.confirm-head h2 { margin: 0; }
.confirm-icon {
  display: none; flex: none; width: 42px; height: 42px; border-radius: 50%; place-items: center;
  background: var(--red-soft); color: var(--red); font-size: 1.4rem; font-weight: 800;
}
#confirm-dialog.danger { border: 2px solid var(--red); }
#confirm-dialog.danger .confirm-icon { display: grid; }
#confirm-dialog.danger h2 { color: var(--red); }

/* The invitation, ready to send */
#share-dialog { width: min(100% - 32px, 480px); text-align: center; }
.share-icon, .join-icon {
  width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 1.6rem;
}
#share-link { margin: 6px 0 14px; text-align: center; font-size: 0.9rem; }
.share-buttons { display: grid; gap: 8px; margin-bottom: 12px; }

/* The invitation page (/join) */
.join { text-align: center; }
.join h1 { font-size: 1.5rem; margin-bottom: 8px; }
.join form { text-align: start; margin-top: 18px; }
.join-logo { display: block; width: 80px; height: 80px; margin: 0 auto 12px; border-radius: 20px; }
.join input[readonly] { opacity: 0.8; }

dialog {
  width: min(100% - 32px, 600px); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 22px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(0 0 0 / 0.55); }
dialog h2 { font-size: 1.3rem; margin-bottom: 16px; }
dialog h3 { font-size: 1.1rem; margin-bottom: 4px; }
dialog section { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
dialog p { margin: 0 0 10px; }
.hint-line { margin: 6px 0 0; }
.logo-field { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.logo-field input[type='file'] { flex: 1; min-width: 200px; }
input[type='file']::file-selector-button {
  margin-inline-end: 10px; padding: 6px 14px; border: 0; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary); font: inherit; font-weight: 700; cursor: pointer;
  transition: filter var(--fast) ease;
}
input[type='file']::file-selector-button:hover { filter: brightness(0.96); }

@media (max-width: 760px) {
  .invite-fields { grid-template-columns: 1fr; }
}

/* --- In-store display --- */

.display { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; padding: 2vw; gap: 2vw; }
.display header { display: flex; align-items: center; gap: 2vw; }
.display header h1 { font-size: clamp(1.4rem, 3vw, 3rem); margin-inline-end: auto; }
.display header .restaurant { margin-inline-end: auto; gap: 1.2vw; }
.display .restaurant-logo { width: clamp(48px, 6vw, 110px); height: clamp(48px, 6vw, 110px); border-radius: 1.2vw; }
.display .qr { display: flex; align-items: center; gap: 1vw; color: var(--muted); font-weight: 700; font-size: clamp(0.8rem, 1.2vw, 1.2rem); }
.display .qr span { max-width: 20ch; }
.display .qr svg, .display .qr img { width: clamp(70px, 8vw, 140px); height: auto; background: #fff; padding: 6px; border-radius: 10px; }
.board { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2vw; }
.board section { background: var(--surface); border-radius: 2vw; padding: 2vw; border: 1px solid var(--line); }
.board h2 { font-size: clamp(1.2rem, 2.6vw, 2.6rem); margin-bottom: 1.5vw; }
.board .ready-col { background: var(--green-soft); border-color: var(--green); }
.board .ready-col h2 { color: var(--green); }
.tiles { display: flex; flex-wrap: wrap; gap: 1vw; align-content: flex-start; }
.tile {
  font-weight: 800; direction: ltr; border-radius: 1.2vw; padding: 0.4em 0.6em; min-width: 3.2em; text-align: center;
  background: var(--surface-2); font-size: clamp(1.6rem, 3.6vw, 4rem); line-height: 1.1;
}
.ready-col .tile { background: var(--surface); color: var(--green); font-size: clamp(2rem, 5.5vw, 6rem); }
.tile.fresh { animation: pop 0.9s ease-in-out 6; }
/* Only the ready column (the restaurant's settings), with bigger numbers. */
.board.ready-only { grid-template-columns: 1fr; }
.board.ready-only > section:not(.ready-col) { display: none; }
.board.ready-only .ready-col .tile { font-size: clamp(2.6rem, 7.5vw, 8rem); }
@keyframes pop { 50% { transform: scale(1.12); box-shadow: 0 0 0 0.25em var(--green); } }

.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgb(0 0 0 / 0.55);
}
.overlay .card { max-width: 440px; text-align: center; }
.overlay h2 { margin-bottom: 8px; }
.overlay p { margin: 0 0 16px; }

/* --- The poster studio (poster.js): three designs, each a real A4 sheet in millimetres --- */

.studio-page { background: var(--bg); }
.studio-bar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.studio-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.studio-seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.studio-seg-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 9px; background: none;
  color: var(--muted); font: inherit; font-size: 0.9rem; font-weight: 800; white-space: nowrap; cursor: pointer;
  transition: background-color var(--mid) ease, color var(--mid) ease;
}
.studio-seg-btn[aria-checked='true'] { background: var(--surface); color: var(--primary); box-shadow: 0 2px 8px rgb(0 0 0 / 0.08); }
.studio-seg-btn .i { width: 16px; height: 16px; }
.studio-colors { display: inline-flex; gap: 8px; }
.studio-color {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface); background: var(--swatch); cursor: pointer;
  box-shadow: 0 0 0 1.5px var(--line); transition: transform var(--fast) var(--ease-spring), box-shadow var(--fast) ease;
}
.studio-color[aria-checked='true'] { box-shadow: 0 0 0 2.5px var(--swatch); transform: scale(1.08); }
#print .i { width: 18px; height: 18px; }
.studio-hint { margin: 14px auto 0; padding: 0 16px; max-width: 760px; text-align: center; color: var(--muted); font-weight: 700; }
.studio-stage { display: grid; justify-items: center; padding: 18px 12px 40px; }
.paper-holder { position: relative; }
.paper-holder > .paper {
  position: absolute; top: 0; right: 0; transform: scale(var(--scale, 1)); transform-origin: top right;
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.45), 0 0 0 1px rgb(0 0 0 / 0.06);
}

/* A sheet: A4 at its printed size. Its colours come from the chosen theme. */
.paper {
  --c1: #f53d64; --c2: #c5143e; --ink: #fff; --paper: #fff; --text: #1d1b16; --soft: #ffe4e6; --muted-ink: #6b665c;
  width: 210mm; height: 297mm; overflow: hidden; background: var(--paper); color: var(--text);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.paper.theme-brand {
  --c1: color-mix(in srgb, var(--brand) 82%, #fff); --c2: color-mix(in srgb, var(--brand) 82%, #000);
  --soft: color-mix(in srgb, var(--brand) 14%, #fff);
}
.paper.theme-dark { --c1: #2c1d24; --c2: #0f0a0c; --ink: #fda4af; --paper: #1c1418; --text: #f8eef1; --soft: #3d1522; --muted-ink: #c9b4bc; }
.paper.missing { display: grid; place-items: center; height: 80mm; font-size: 6mm; font-weight: 800; }
.paper p, .paper h1, .paper ol { margin: 0; }
.qr-box { position: relative; background: #fff; border-radius: 4mm; padding: 3mm; }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-box .qr-logo { position: absolute; top: 50%; left: 50%; width: 22%; transform: translate(-50%, -50%); background: #fff; padding: 2.5%; border-radius: 22%; }
.paper-avatar { --size: 20mm; width: var(--size); height: var(--size); border-radius: 28%; font-size: calc(var(--size) * 0.5); box-shadow: 0 2mm 5mm rgb(0 0 0 / 0.18); }
.paper-avatar.monogram { font-family: 'Lalezar', 'Tajawal', sans-serif; }
.paper-nadini { display: inline-flex; align-items: center; gap: 2mm; color: var(--c2); font-family: 'Lalezar', 'Tajawal', sans-serif; font-size: 6mm; line-height: 1; }
.paper-nadini img { width: 7mm; height: 7mm; }
.theme-dark .paper-nadini { color: #fb7185; }

/* The wall poster: a curved band in the chosen colour, the QR on a card over it, three steps, the address. */
.paper.wall { display: grid; grid-template-rows: auto auto 1fr auto; text-align: center; }
.w-head {
  display: grid; justify-items: center; gap: 4mm; padding: 16mm 14mm 34mm; color: var(--ink);
  background: radial-gradient(120% 90% at 80% 0%, rgb(255 255 255 / 0.22), transparent 55%), linear-gradient(160deg, var(--c1), var(--c2));
  border-radius: 0 0 50% 50% / 0 0 16mm 16mm;
}
.theme-dark .w-head { color: var(--text); }
.w-name { font-size: 13mm; line-height: 1.1; font-weight: 800; }
.w-headline { font-size: 7mm; font-weight: 800; opacity: 0.92; }
.w-card {
  justify-self: center; display: grid; justify-items: center; gap: 4mm; width: 132mm; margin-top: -26mm; padding: 7mm;
  background: var(--paper); border-radius: 8mm; box-shadow: 0 6mm 16mm -6mm rgb(0 0 0 / 0.3); border: 0.4mm solid color-mix(in srgb, var(--c2) 20%, transparent);
}
.w-qr { width: 104mm; }
.w-scan { font-size: 5.6mm; font-weight: 800; color: var(--c2); }
.theme-dark .w-scan { color: #fda4af; }
.w-steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; align-content: center; padding: 8mm 12mm 0; }
.w-steps li { position: relative; display: grid; justify-items: center; gap: 2.5mm; font-size: 4.6mm; font-weight: 700; line-height: 1.35; }
.w-step-icon { display: grid; place-items: center; width: 15mm; height: 15mm; border-radius: 5mm; background: var(--soft); color: var(--c2); }
.theme-dark .w-step-icon { color: #fda4af; }
.w-step-icon .i { width: 8mm; height: 8mm; }
.w-steps b {
  position: absolute; top: -2mm; inset-inline-end: calc(50% - 10mm); display: grid; place-items: center; width: 6mm; height: 6mm;
  border-radius: 50%; background: linear-gradient(160deg, var(--c1), var(--c2)); color: #fff; font-size: 3.4mm;
}
.w-foot { display: flex; align-items: center; justify-content: space-between; gap: 6mm; padding: 6mm 12mm 9mm; border-top: 0.3mm dashed color-mix(in srgb, var(--text) 18%, transparent); margin: 0 10mm; }
.w-url { color: var(--muted-ink); font-size: 3.6mm; font-weight: 700; }

/* The table tent: two faces on one sheet. The top one is upside down, so once folded both stand upright. */
.paper.stand { display: grid; grid-template-rows: 1fr 0 1fr; }
.s-face {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9mm; padding: 12mm 14mm; color: var(--ink);
  background: radial-gradient(90% 120% at 100% 0%, rgb(255 255 255 / 0.2), transparent 60%), linear-gradient(150deg, var(--c1), var(--c2));
}
.theme-dark .s-face { color: var(--text); }
.s-face.top { transform: rotate(180deg); }
.s-text { display: grid; gap: 4mm; }
.s-brand { display: flex; align-items: center; gap: 4mm; font-size: 8mm; font-weight: 800; line-height: 1.1; }
.s-headline { font-size: 7.5mm; font-weight: 800; line-height: 1.2; }
.s-sub { font-size: 4.6mm; font-weight: 700; line-height: 1.45; opacity: 0.95; }
.s-text .paper-nadini { color: var(--ink); font-size: 5mm; }
.theme-dark .s-text .paper-nadini { color: #fb7185; }
.s-qr { width: 64mm; box-shadow: 0 4mm 10mm -4mm rgb(0 0 0 / 0.35); }
.s-fold { position: relative; z-index: 1; border-top: 0.35mm dashed rgb(0 0 0 / 0.35); }
.s-fold span {
  position: absolute; top: -2.6mm; left: 50%; translate: -50% 0; padding: 0.6mm 3mm; border-radius: 99px;
  background: #fff; color: #6b665c; font-size: 3mm; font-weight: 700;
}

/* Round stickers: six on a sheet, each with its cutting line. */
.paper.stickers { display: grid; grid-template-columns: repeat(2, 86mm); grid-template-rows: repeat(3, 86mm); place-content: center; gap: 8mm 10mm; }
.k-sticker {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 2mm; border-radius: 50%; color: var(--ink);
  background: radial-gradient(80% 80% at 30% 15%, rgb(255 255 255 / 0.25), transparent 60%), linear-gradient(155deg, var(--c1), var(--c2));
  outline: 0.3mm dashed rgb(0 0 0 / 0.3); outline-offset: 1.4mm;
}
.theme-dark .k-sticker { color: var(--text); }
.k-top, .k-bottom { font-size: 4.6mm; font-weight: 800; line-height: 1.1; text-align: center; max-width: 64mm; }
.k-qr { width: 44mm; border-radius: 3mm; padding: 2mm; }

/* A named page, so only the studio prints edge to edge. */
.studio-page { page: poster; }
@page poster { size: A4 portrait; margin: 0; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .studio-page { margin: 0; background: #fff; }
  .studio-stage { display: block; padding: 0; }
  .paper-holder { width: auto !important; height: auto !important; }
  .paper-holder > .paper { position: static; transform: none; box-shadow: none; }
}

/* --- Landing --- */

.hero { padding: 8vh 0 4vh; }
.hero h1 { font-size: clamp(2rem, 7vw, 3.2rem); margin: 10px 0 12px; white-space: pre-line; }
.hero p { font-size: 1.15rem; color: var(--muted); margin: 0 0 22px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 10px; }
.steps .card { padding: 18px; }
.steps h3 { font-size: 1.05rem; margin-bottom: 6px; }
.steps p { margin: 0; color: var(--muted); }

/* --- Text pages (privacy, support) and the footer --- */

.shell.doc { width: min(100%, 760px); }
a.logo { text-decoration: none; }
.doc h1 { font-size: clamp(1.6rem, 5vw, 2.1rem); margin-bottom: 8px; }
.doc h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.doc h3 { font-size: 1.02rem; margin: 18px 0 4px; }
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 12px; padding-inline-start: 22px; }
.doc li { margin-bottom: 8px; }
.contact { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin-top: 32px; }
.footer a { color: var(--muted); text-decoration: none; font-weight: 500; }
.footer a:hover { color: var(--primary); text-decoration: underline; }

/* --- Ratings: the customer's stars, the summary under the restaurant's name, the dashboard section --- */

.rating-summary { margin: -8px 0 14px; color: var(--muted); font-weight: 700; }
.rate { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.rate h2 { font-size: 1.15rem; }
.stars { display: flex; justify-content: center; gap: 6px; direction: ltr; }
.star {
  font-size: 2.4rem; line-height: 1; background: none; border: 0; color: var(--star-off); cursor: pointer; padding: 4px;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--fast) ease, transform var(--mid) var(--ease-spring);
}
.star:hover { transform: scale(1.12); }
.star.on { color: #f59e0b; }
.star.on:active { transform: scale(0.9); }
.rate textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--text); font: inherit; resize: vertical;
}
.rate-thanks { margin-top: 18px; text-align: center; font-weight: 800; color: var(--green); }
.rating-bars { display: grid; gap: 6px; margin-bottom: 12px; max-width: 420px; }
.rating-bar { display: grid; grid-template-columns: 2.5em 1fr 2.5em; align-items: center; gap: 8px; }
.rating-bar .bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.rating-bar .bar span { display: block; height: 100%; background: #f59e0b; }
.rating-item { padding: 14px; }
.rating-head { display: flex; justify-content: space-between; gap: 10px; color: #f59e0b; }
.rating-item p { margin: 8px 0 0; }

/* --- Landing: the sections under the hero --- */

.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; }
.landing .block { margin-top: 56px; }
.landing .block > h2 { font-size: clamp(1.4rem, 4vw, 2rem); margin-bottom: 18px; text-align: center; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.feature h3 { font-size: 1.08rem; margin: 8px 0 6px; }
.feature p { margin: 0; color: var(--muted); }
.feature-icon { font-size: 1.8rem; }
.phone {
  justify-self: center; width: min(100%, 250px); aspect-ratio: 9 / 18; padding: 12px; border-radius: 40px;
  background: #111827; box-shadow: var(--shadow), 0 30px 60px -20px rgba(225, 29, 72, 0.45);
  animation: ring 2.5s ease-in-out infinite;
}
:root[data-theme='dark'] .phone { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 30px 70px -20px rgba(244, 63, 94, 0.5); }
.phone-screen {
  height: 100%; border-radius: 30px; padding: 40px 10px;
  background: linear-gradient(160deg, #fda4af, #e11d48 60%, #be123c);
}
.phone-notice {
  display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.95); color: #111827; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.phone-notice img { width: 36px; height: 36px; flex: none; }
.phone-notice strong { display: block; }
.phone-notice span { font-size: 0.85rem; color: #6b7280; }
@keyframes ring {
  0%, 70%, 100% { transform: rotate(0); }
  74% { transform: rotate(-4deg); } 78% { transform: rotate(4deg); } 82% { transform: rotate(-3deg); } 86% { transform: rotate(3deg); }
}
.compare-wrap { padding: 8px; overflow-x: auto; }
.compare { width: 100%; border-collapse: collapse; }
.compare th, .compare td { padding: 12px 10px; text-align: start; border-bottom: 1px solid var(--line); }
.compare tr:last-child th, .compare tr:last-child td { border-bottom: 0; }
.compare .yes { color: var(--primary); font-weight: 800; }
.faqs { display: grid; gap: 10px; max-width: 760px; margin: 0 auto; }
.faq { padding: 16px 18px; }
.faq summary { cursor: pointer; font-weight: 800; }
.faq p { margin: 10px 0 0; color: var(--muted); }
.final { text-align: center; display: grid; gap: 12px; justify-items: center; }
.final p { margin: 0; color: var(--muted); }
.final .btn-big { width: auto; padding-inline: 28px; }
@media (max-width: 720px) {
  .hero-grid { grid-template-columns: 1fr; }
  .phone { width: 200px; }
}

/* --- Phase 6: the landing page comes alive (landing.js) --- */

/* A slow rose aurora behind the hero: three soft lights drifting. Transforms only, so it stays light. */
.aurora {
  position: absolute; top: 0; left: 0; right: 0; height: min(1100px, 100vh + 240px); z-index: -1; overflow: hidden; pointer-events: none;
  mask-image: linear-gradient(#000 50%, transparent); -webkit-mask-image: linear-gradient(#000 50%, transparent);
}
.aurora i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; opacity: 0.55; will-change: transform; }
.aurora i:nth-child(1) { top: -30vmax; inset-inline-start: 20%; background: radial-gradient(closest-side, rgb(253 164 175 / 0.75), transparent); animation: aurora-a 22s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { top: -10vmax; inset-inline-start: 50%; background: radial-gradient(closest-side, rgb(225 29 72 / 0.32), transparent); animation: aurora-b 27s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { top: -24vmax; inset-inline-start: 70%; background: radial-gradient(closest-side, rgb(251 191 36 / 0.22), transparent); animation: aurora-c 31s ease-in-out infinite alternate; }
:root[data-theme='dark'] .aurora i { opacity: 0.4; }
@keyframes aurora-a { to { transform: translate(-18vmax, 8vmax) scale(1.15); } }
@keyframes aurora-b { to { transform: translate(14vmax, -6vmax) scale(0.9); } }
@keyframes aurora-c { to { transform: translate(-10vmax, 10vmax) scale(1.2); } }

/* The hero phone tilts in 3D with the mouse. */
.tilt { justify-self: center; perspective: 900px; }
.tilt .phone { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 0.25s ease-out; transform-style: preserve-3d; }

/* Sections rise in on scroll. */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
.block-lead { max-width: 640px; margin: -8px auto 22px; color: var(--muted); text-align: center; font-size: 1.05rem; }

/* Numbers. */
.numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.number { display: grid; gap: 2px; padding: 18px 14px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.number b { font-family: 'Lalezar', var(--font, inherit); font-size: clamp(2.2rem, 6vw, 3rem); font-weight: 400; line-height: 1.1; color: var(--primary); unicode-bidi: plaintext; }
.number span { color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.numbers.in .number { animation: rise var(--slow) var(--ease-out) both; }
.numbers.in .number:nth-child(2) { animation-delay: 80ms; }
.numbers.in .number:nth-child(3) { animation-delay: 160ms; }
.numbers.in .number:nth-child(4) { animation-delay: 240ms; }

/* The live demo. */
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: center; max-width: 860px; margin: 0 auto; }
.demo-dash { display: grid; gap: 10px; padding: 20px; }
.demo-dash-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.demo-dash-top img { width: 30px; height: 30px; }
.demo-live { margin-inline-start: auto; padding: 2px 10px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 0.78rem; font-weight: 800; }
.demo-live::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-inline-end: 5px; border-radius: 50%; background: currentColor; vertical-align: middle; }
.demo-dash label { font-weight: 800; }
.demo-entry { display: flex; gap: 8px; }
.demo-entry input { flex: 1; min-width: 0; font-size: 1.6rem; font-weight: 800; text-align: center; }
.btn-ready { background: var(--green-fill); color: #fff; border-color: transparent; font-size: 1.1rem; padding-inline: 22px; }
.btn-ready:hover { filter: brightness(1.08); }
.demo-hint { margin: 2px 0 0; }
.demo-phone-wrap { display: grid; place-items: center; }
.demo-phone {
  position: relative; width: min(100%, 250px); aspect-ratio: 9 / 17.5; padding: 11px; border-radius: 40px;
  background: #111827; box-shadow: var(--shadow), 0 26px 60px -24px rgb(225 29 72 / 0.55);
}
.demo-screen {
  display: grid; justify-items: center; align-content: center; gap: 10px; height: 100%; padding: 18px 12px; border-radius: 30px;
  background: linear-gradient(180deg, #fff, #fff1f3); color: #1d1b16; overflow: hidden;
}
.demo-place { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 800; font-size: 0.9rem; }
.demo-place img { width: 22px; height: 22px; }
.demo-ring { position: relative; width: 74%; aspect-ratio: 1; }
.demo-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.demo-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.demo-ring .track { stroke: #ffe4e6; }
.demo-ring .fill { stroke: #e11d48; stroke-dasharray: 100; stroke-dashoffset: 100; }
.demo-phone[data-state='ready'] .demo-ring .fill { stroke: #16a34a; }
.demo-number { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.demo-number small { color: #6b665c; font-weight: 700; }
.demo-number b { font-family: 'Lalezar', var(--font, inherit); font-size: 3rem; font-weight: 400; line-height: 1; }
.demo-check {
  position: absolute; top: -2px; left: 50%; display: grid; place-items: center; width: 34px; height: 34px; margin-left: -17px;
  border-radius: 50%; background: #16a34a; color: #fff; font-weight: 800; box-shadow: 0 0 0 4px #fff;
  transform: scale(0); transition: transform 0.5s var(--ease-spring) 0.3s;
}
.demo-phone[data-state='ready'] .demo-check { transform: scale(1); }
.demo-status { margin: 0; min-height: 1.5em; font-weight: 800; text-align: center; }
.demo-phone[data-state='ready'] .demo-status { color: #15803d; }
.demo-stages { display: flex; gap: 8px; }
.demo-stages i { width: 26px; height: 6px; border-radius: 3px; background: #ffe4e6; transition: background-color var(--mid) ease; }
.demo-stages i:first-child, .demo-phone:not([data-state='idle']) .demo-stages i:nth-child(2) { background: #e11d48; }
.demo-phone[data-state='ready'] .demo-stages i { background: #16a34a; }
.demo-phone.ringing { animation: demo-shake 0.5s ease-in-out 3; }
.demo-phone.ringing .demo-screen { animation: demo-flash 0.9s ease-out 2; }
@keyframes demo-shake { 20% { transform: rotate(-5deg); } 40% { transform: rotate(5deg); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(3deg); } }
@keyframes demo-flash { 0% { background: linear-gradient(180deg, #fda4af, #e11d48); } }
.demo-waves { position: absolute; inset: 0; pointer-events: none; }
.demo-waves i { position: absolute; inset: 0; border-radius: 40px; border: 3px solid #e11d48; opacity: 0; }
.demo-phone.ringing .demo-waves i { animation: demo-wave 1.4s ease-out 2; }
.demo-phone.ringing .demo-waves i:nth-child(2) { animation-delay: 0.25s; }
.demo-phone.ringing .demo-waves i:nth-child(3) { animation-delay: 0.5s; }
@keyframes demo-wave { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }

/* Before and after. The after scene shows from the left edge up to the handle. */
.ba {
  --split: 50%; position: relative; aspect-ratio: 800 / 420; max-width: 900px; margin: 0 auto; overflow: hidden;
  border-radius: 26px; border: 1px solid var(--line); box-shadow: var(--shadow); background: #fdf4ef; touch-action: pan-y;
}
.ba-scene { position: absolute; inset: 0; }
.ba-scene svg { width: 100%; height: 100%; display: block; }
.ba-after { clip-path: inset(0 calc(100% - var(--split)) 0 0); }
.ba-label {
  position: absolute; top: 14px; padding: 6px 12px; border-radius: 99px; font-size: 0.86rem; font-weight: 800; pointer-events: none;
  background: rgb(255 255 255 / 0.92); color: #1d1b16; box-shadow: 0 4px 14px rgb(0 0 0 / 0.12);
}
.ba-label.before { right: 14px; }
.ba-label.after { left: 14px; color: #be123c; }
.ba-handle {
  position: absolute; top: 0; bottom: 0; left: var(--split); width: 4px; margin-left: -2px; background: #fff; pointer-events: none;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08), 0 0 18px rgb(225 29 72 / 0.35);
}
.ba-handle i {
  position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: var(--primary-fill); color: #fff; font-style: normal; font-size: 1.2rem; font-weight: 800;
  box-shadow: 0 0 0 4px #fff, 0 8px 20px -6px rgb(190 18 60 / 0.6);
}
.ba-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.ba-range:focus-visible + .ba-handle, .ba:focus-within .ba-handle i { outline: 3px solid var(--primary); outline-offset: 3px; }
.ba-glow { animation: ba-glow 1.6s ease-in-out infinite; }
.ba-blink { animation: ba-glow 0.9s steps(2) infinite; }
@keyframes ba-glow { 50% { opacity: 0.25; } }

/* The QR in "how it works", with a laser that scans it when it comes into view. */
.step-qr { position: relative; }
.qr-scan {
  position: relative; display: block; width: 66px; height: 66px; margin-bottom: 8px; padding: 5px; border-radius: 14px; overflow: hidden;
  background: #fff; box-shadow: 0 0 0 1px var(--line), 0 10px 22px -14px rgb(0 0 0 / 0.4);
}
.qr-scan svg { width: 100%; height: 100%; display: block; }
.laser {
  position: absolute; inset-inline: 2px; top: 4px; height: 3px; border-radius: 3px; opacity: 0;
  background: #e11d48; box-shadow: 0 0 8px 2px rgb(225 29 72 / 0.7), 0 0 22px 6px rgb(225 29 72 / 0.35);
}
.reveal.in .laser { animation: laser 1.6s ease-in-out 0.4s 4 alternate; }
@keyframes laser { 0% { opacity: 1; top: 4px; } 100% { opacity: 1; top: calc(100% - 7px); } }

/* Register your restaurant. */
.register { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 28px; padding: 28px; overflow: hidden; position: relative; }
.register::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 6px; background: var(--primary-fill);
}
.register-intro h2 { margin: 6px 0 8px; font-size: clamp(1.5rem, 4vw, 2rem); }
.register-intro p { margin: 0 0 14px; color: var(--muted); }
.register-badge { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: var(--primary-soft); font-size: 1.6rem; }
.register-points { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.register-points li { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.register-points li::before { content: '✓'; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 0.8rem; font-weight: 800; }
.register-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; align-content: start; }
.register-form .field { margin: 0; }
.register-form .wide { grid-column: 1 / -1; }
.register-form textarea {
  width: 100%; min-height: 84px; padding: 10px 14px; resize: vertical; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 1rem;
  transition: border-color var(--fast) ease, background-color var(--fast) ease, box-shadow var(--mid) var(--ease-out);
}
.register-form .btn.busy { opacity: 0.7; pointer-events: none; }
.register-privacy { margin: 0; }
.hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.register-done { display: grid; justify-items: center; align-content: center; gap: 10px; text-align: center; }
.register-done[hidden] { display: none; }
.register-done-icon { position: relative; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: var(--primary-soft); font-size: 2.4rem; animation: pop-in var(--slow) var(--ease-spring) both; }
.register-done h3 { margin: 0; font-size: 1.5rem; }
.register-done p { margin: 0 0 6px; color: var(--muted); }

@media (max-width: 720px) {
  .numbers { grid-template-columns: repeat(2, 1fr); }
  .demo-grid { grid-template-columns: 1fr; }
  .demo-phone { width: 210px; }
  .register { grid-template-columns: 1fr; padding: 22px 18px; }
  .register-form { grid-template-columns: 1fr; }
  .ba { aspect-ratio: 4 / 3; }
  .ba-label { font-size: 0.75rem; top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .aurora i { animation: none; }
}

/* --- Settings screen (admin-settings.js): sections of switches beside a live preview --- */

/* The button on each restaurant card; its gear turns on hover. */
.btn-settings { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-settings svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform 0.6s var(--ease-spring); }
.btn-settings:hover svg { transform: rotate(120deg); }

.settings-dialog {
  width: min(100% - 24px, 1180px); height: min(100dvh - 24px, 880px); max-width: none; max-height: none;
  padding: 0; overflow: hidden; border-radius: 26px; background: var(--bg);
}
.sheet { position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: 100%; }
/* Icons in the screen are lines in currentColor; their .f parts are filled. */
.sheet svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sheet svg .f { fill: currentColor; stroke: none; }

.sheet-head {
  display: flex; align-items: center; gap: 14px; padding: 18px 22px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 13%, var(--surface)), var(--surface) 55%);
  border-bottom: 1px solid var(--line);
}
.sheet-badge, .sheet-logo { flex: none; width: 50px; height: 50px; border-radius: 16px; }
.sheet-badge {
  display: grid; place-items: center; color: #fff; background: var(--primary-fill);
  box-shadow: var(--primary-glow), inset 0 1px 0 rgb(255 255 255 / 0.3);
}
.sheet-badge svg { width: 27px; height: 27px; animation: gear-in 0.8s var(--ease-spring) both; }
.sheet-logo { object-fit: cover; box-shadow: var(--shadow); }
.sheet-names { margin-inline-end: auto; min-width: 0; }
.sheet-names h2 { margin: 0; font-size: 1.4rem; }
.sheet-names p { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  transition: transform var(--mid) var(--ease-spring), background-color var(--fast) ease;
}
.icon-btn:hover { background: var(--surface-2); transform: rotate(90deg); }
.icon-btn svg { width: 20px; height: 20px; stroke-width: 2.4; }

/* "Saving…", then "Saved ✓" (the tick draws itself), or what went wrong. */
.save-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 99px;
  font-weight: 800; font-size: 0.88rem; white-space: nowrap;
  opacity: 0; transform: translateY(-6px) scale(0.92); pointer-events: none;
  transition: opacity var(--fast) ease, transform var(--mid) var(--ease-spring);
}
.save-pill:is([data-state='saving'], [data-state='saved'], [data-state='error']) { opacity: 1; transform: none; }
.save-pill[data-state='saving'] { background: var(--surface-2); color: var(--muted); }
.save-pill[data-state='saved'] { background: var(--green-soft); color: var(--green); }
.save-pill[data-state='error'] { background: var(--red-soft); color: var(--red); white-space: normal; max-width: 340px; }
.save-pill svg { width: 17px; height: 17px; flex: none; stroke-width: 3; }
.save-pill[data-state='saved'] svg path { stroke-dasharray: 22; stroke-dashoffset: 22; animation: draw 0.45s var(--ease-out) 0.05s forwards; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin 0.7s linear infinite; }

/* The section chips: they follow the scroll, and a tap jumps to the section. */
.settings-nav {
  display: flex; gap: 8px; padding: 12px 22px; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.set-chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 5px 14px 5px 6px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 800; font-size: 0.92rem; cursor: pointer;
  transition: background-color var(--mid) ease, box-shadow var(--mid) ease, color var(--mid) ease, transform var(--fast) var(--ease-spring);
}
.set-chip:active { transform: scale(0.95); }
.set-chip[aria-current='true'] {
  border-color: transparent; color: color-mix(in srgb, var(--tone-b) 78%, var(--text));
  background: color-mix(in srgb, var(--tone-a) 18%, var(--surface));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tone-b) 45%, transparent);
}
.mini-tile {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: #fff;
  background: linear-gradient(145deg, var(--tone-a), var(--tone-b));
}
.mini-tile svg { width: 16px; height: 16px; }

.sheet-body {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 26px; align-items: start;
  padding: 22px; overflow: auto; overscroll-behavior: contain;
}
.settings-sections { display: grid; gap: 18px; min-width: 0; padding-bottom: 8px; }

/* A section: a coloured tile, its title, and "↺ default" once something differs from the defaults. */
.set-section {
  overflow: hidden; border-radius: 22px; scroll-margin-top: 6px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise var(--slow) var(--ease-out) both; animation-delay: calc(var(--order, 0) * 70ms);
}
.set-head {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--tone-a) 17%, transparent), transparent 65%);
}
:root[data-theme='dark'] .set-head { background: linear-gradient(115deg, color-mix(in srgb, var(--tone-a) 10%, transparent), transparent 65%); }
.set-tile {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #fff;
  background: linear-gradient(145deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 10px 20px -10px var(--tone-b), inset 0 1px 0 rgb(255 255 255 / 0.35);
}
.set-tile svg { width: 25px; height: 25px; }
.set-heading { margin-inline-end: auto; min-width: 0; }
.set-heading h3 { font-size: 1.15rem; }
.set-heading p { margin: 3px 0 0; }
.set-reset {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 6px 12px; border: 0; border-radius: 99px;
  background: color-mix(in srgb, var(--tone-b) 12%, transparent); color: color-mix(in srgb, var(--tone-b) 80%, var(--text));
  font: inherit; font-weight: 800; font-size: 0.85rem; cursor: pointer; animation: pop-in var(--mid) var(--ease-spring);
}
.set-reset svg { width: 15px; height: 15px; transition: transform 0.5s var(--ease-spring); }
.set-reset:hover svg { transform: rotate(-220deg); }

/* A row: its icon, what it does in plain words, and its switch or choices. A tap anywhere flips a switch. */
.set-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 15px 20px; border-top: 1px solid var(--line); cursor: pointer;
  transition: opacity var(--mid) ease, background-color var(--fast) ease;
}
.set-row:hover { background: color-mix(in srgb, var(--tone-a) 7%, transparent); }
.set-row.has-choice { cursor: default; }
.set-row.is-off { opacity: 0.4; cursor: default; }
.set-row.is-off:hover { background: none; }
.row-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px;
  color: var(--tone-b); background: color-mix(in srgb, var(--tone-a) 16%, transparent);
}
:root[data-theme='dark'] .row-icon { color: var(--tone-a); }
.row-icon svg { width: 21px; height: 21px; }
.row-text { display: grid; gap: 2px; min-width: 0; }
.row-title { font-weight: 800; }
.row-desc { color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.row-note {
  justify-self: start; margin-top: 5px; padding: 3px 11px; border-radius: 12px; font-size: 0.84rem; font-weight: 700;
  animation: pop-in var(--mid) var(--ease-spring);
}
.row-note[data-kind='ok'] { background: var(--green-soft); color: var(--green); }
.row-note[data-kind='warn'] { background: var(--amber-soft); color: var(--amber); }
.row-note[data-kind='info'] { background: var(--surface-2); color: var(--muted); }

/* The switch: the rose of the logo when on, a tick in its knob, and the knob stretches while pressed. */
.switch {
  --dir: 1;
  position: relative; flex: none; width: 54px; height: 32px; padding: 0; border: 0; border-radius: 99px;
  background: var(--switch-off); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--mid) ease;
}
[dir='rtl'] .switch { --dir: -1; }
.switch::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--primary-fill);
  opacity: 0; transition: opacity var(--mid) ease;
}
.switch-knob {
  position: absolute; top: 3px; inset-inline-start: 3px; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 99px; background: #fff;
  box-shadow: 0 2px 5px rgb(0 0 0 / 0.22), 0 0 0 0.5px rgb(0 0 0 / 0.05);
  transition: transform 0.4s var(--ease-spring), width var(--fast) ease;
}
.switch-knob svg { width: 14px; height: 14px; color: #e11d48; stroke-width: 3.4; opacity: 0; transform: scale(0.3) rotate(-40deg); transition: opacity var(--fast) ease, transform var(--slow) var(--ease-spring); }
.switch[aria-checked='true'] { box-shadow: var(--primary-glow); }
.switch[aria-checked='true']::before { opacity: 1; }
.switch[aria-checked='true'] .switch-knob { transform: translateX(calc(22px * var(--dir))); }
.switch[aria-checked='true'] .switch-knob svg { opacity: 1; transform: none; }
.switch:not(:disabled):active .switch-knob { width: 31px; }
.switch[aria-checked='true']:not(:disabled):active .switch-knob { transform: translateX(calc(17px * var(--dir))); }
.switch:disabled { cursor: default; }

/* Choices: a pill whose highlight slides to the chosen option. */
.segmented {
  --n: 2; --i: 0;
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; min-width: 190px; padding: 4px;
  border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line);
}
.seg-thumb {
  position: absolute; top: 4px; bottom: 4px; width: calc((100% - 8px) / var(--n));
  inset-inline-start: calc(4px + var(--i) * (100% - 8px) / var(--n)); border-radius: 10px; background: var(--surface);
  box-shadow: 0 3px 10px rgb(0 0 0 / 0.1), inset 0 0 0 1.5px color-mix(in srgb, var(--tone-b) 40%, transparent);
  transition: inset-inline-start var(--slow) var(--ease-spring);
}
.seg {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 6px 12px; border: 0; border-radius: 10px; background: none; color: var(--muted);
  font: inherit; font-weight: 800; cursor: pointer; transition: color var(--mid) ease;
}
.seg[aria-checked='true'] { color: color-mix(in srgb, var(--tone-b) 85%, var(--text)); }
:root[data-theme='dark'] .seg[aria-checked='true'] { color: var(--tone-a); }
.seg:disabled { cursor: default; }
.seg svg { width: 17px; height: 17px; }

/* --- The live preview: the customer page on a phone, and the TV --- */

.settings-preview { position: sticky; top: 0; display: grid; gap: 14px; justify-items: center; }
.pv-head { display: grid; justify-items: center; gap: 10px; width: 100%; }
.pv-live { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.pv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); animation: live 2.4s ease-out infinite; }
.pv-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 100%; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.pv-switch button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border: 0; border-radius: 9px;
  background: none; color: var(--muted); font: inherit; font-weight: 800; font-size: 0.86rem; white-space: nowrap; cursor: pointer;
  transition: background-color var(--mid) ease, color var(--mid) ease;
}
.pv-switch button[aria-selected='true'] { background: var(--surface); color: var(--primary); box-shadow: 0 2px 8px rgb(0 0 0 / 0.08); }
.pv-switch svg { width: 15px; height: 15px; }
.pv-stage { display: grid; justify-items: center; width: 100%; }
.pv-stage > :not([hidden]) { animation: pop-in var(--slow) var(--ease-spring) both; }
.pv-note { margin: 0; text-align: center; }

/* What a switch shows or hides folds open and shut. */
.fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.45s var(--ease-out), opacity var(--mid) ease; }
.fold > * { min-height: 0; overflow: hidden; }
.fold.is-off { grid-template-rows: 0fr; opacity: 0; }
.fold-x { display: inline-grid; grid-template-columns: 1fr; transition: grid-template-columns 0.45s var(--ease-out), opacity var(--mid) ease; }
.fold-x > * { display: inline-flex; min-width: 0; overflow: hidden; }
.fold-x.is-off { grid-template-columns: 0fr; opacity: 0; }

/* The part a change touched glows rose for a moment. */
.spot { animation: spot 1.3s var(--ease-out); }

/* The phone. Its screen keeps the customer page's own light colours, whatever the admin page's theme. */
.phone-device {
  width: 272px; aspect-ratio: 9 / 18.5; padding: 10px; border-radius: 46px;
  background: linear-gradient(155deg, #34343f, #0e0e13 60%);
  box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.08), 0 34px 60px -26px rgb(225 29 72 / 0.5), 0 18px 36px -20px rgb(0 0 0 / 0.55);
}
.pv-screen {
  position: relative; display: flex; flex-direction: column; gap: 8px; height: 100%; overflow: hidden;
  padding: 36px 14px 14px; border-radius: 36px; background: #f6f4ef; color: #1d1b16; font-size: 12px; line-height: 1.45;
}
.pv-screen p { margin: 0; }
.pv-island { position: absolute; top: 10px; left: 50%; width: 78px; height: 21px; border-radius: 99px; background: #0e0e13; translate: -50% 0; }
.pv-top { display: flex; align-items: center; justify-content: space-between; }
.pv-brand { display: inline-flex; align-items: center; gap: 5px; font-family: 'Lalezar', 'Tajawal', sans-serif; font-size: 17px; line-height: 1; color: #e11d48; }
.pv-brand img { width: 22px; height: 22px; }
.pv-tools { display: inline-flex; align-items: center; }
.pv-pill {
  display: inline-grid; place-items: center; height: 22px; min-width: 22px; padding: 0 7px; border-radius: 99px;
  border: 1px solid #e11d48; background: #fff; color: #e11d48; font-size: 9.5px; font-weight: 800;
}
.pv-moon { padding: 0; margin-inline-end: 4px; }
.pv-moon svg { width: 12px; height: 12px; }
.pv-rest { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.pv-rlogo { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; }
.pv-rname { font-size: 17px; font-weight: 800; }
.pv-avg { display: flex; align-items: center; gap: 6px; padding: 1px 4px; border-radius: 8px; color: #6b665c; font-size: 11px; font-weight: 700; }
.pv-sample { padding: 0 6px; border-radius: 99px; background: #fcefd6; color: #a15c07; font-size: 9px; }
.pv-card {
  display: grid; gap: 4px; padding: 12px; border-radius: 18px; text-align: center;
  background: #fff; border: 1px solid #e4dfd3; box-shadow: 0 8px 20px rgb(0 0 0 / 0.06);
}
.pv-label { color: #6b665c; font-size: 10.5px; font-weight: 700; }
.pv-ringed { position: relative; display: grid; place-items: center; width: 92px; height: 92px; margin: 4px auto 2px; }
.pv-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); transition: opacity var(--mid) ease, transform var(--mid) var(--ease-out); }
.pv-ring circle { fill: none; stroke: #16a34a; stroke-width: 7; stroke-linecap: round; }
.pv-ring.is-off { opacity: 0; transform: rotate(-90deg) scale(0.8); }
.pv-ring-check {
  position: absolute; top: -5px; left: 50%; display: grid; place-items: center; width: 20px; height: 20px; margin-left: -10px;
  border-radius: 50%; background: #15803d; color: #fff; box-shadow: 0 0 0 3px #fff;
  transition: opacity var(--mid) ease, transform var(--mid) var(--ease-spring);
}
.pv-ring-check svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.pv-ring-check.is-off { opacity: 0; transform: scale(0.3); }
.pv-ringed .pv-num { font-size: 34px; }
.pv-num { font-size: 40px; font-weight: 800; line-height: 1; direction: ltr; }
.pv-screen .pv-status { margin-top: 4px; padding: 7px; border-radius: 10px; background: #ffe4e6; color: #e11d48; font-size: 11px; font-weight: 800; }
.pv-rate { position: relative; display: grid; gap: 6px; margin-top: 8px; padding: 9px 4px 2px; border-radius: 10px; }
.pv-rate::before { content: ''; position: absolute; top: 0; inset-inline: 6px; height: 1px; background: #e4dfd3; }
.pv-rate-title { font-size: 12px; font-weight: 800; }
.pv-stars { direction: ltr; font-size: 20px; letter-spacing: 2px; line-height: 1; color: #e4dfd3; }
.pv-stars .on { color: #f59e0b; }
.pv-input { padding: 7px 9px; border-radius: 9px; border: 1px solid #e4dfd3; background: #f1eee6; color: #9a9488; font-size: 10px; text-align: start; }
.pv-send {
  padding: 8px; border-radius: 10px; color: #fff; font-size: 11px; font-weight: 800;
  background: linear-gradient(160deg, #f53d64, #e11d48 55%, #c5143e); box-shadow: 0 6px 14px -6px rgb(225 29 72 / 0.55);
}
.pv-foot { display: grid; gap: 3px; margin-top: auto; text-align: center; font-size: 10px; color: #6b665c; }
.pv-link { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 1px 4px; border-radius: 6px; color: #e11d48; font-weight: 700; }
.pv-ic { display: inline-grid; }
.pv-ic svg { width: 11px; height: 11px; }

/* The TV: a screen in the light or dark colours the setting picks, on a small stand. */
.tv-device { display: grid; justify-items: center; width: 100%; max-width: 330px; padding-top: 30px; }
.tv-frame {
  width: 100%; padding: 7px; border-radius: 14px; background: linear-gradient(155deg, #34343f, #0b0b10 60%);
  box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.07), 0 26px 50px -24px rgb(124 58 237 / 0.5), 0 14px 30px -16px rgb(0 0 0 / 0.55);
}
.tv-screen {
  --tv-bg: #f6f4ef; --tv-surface: #fff; --tv-surface-2: #f1eee6; --tv-text: #1d1b16; --tv-line: #e4dfd3; --tv-green: #15803d; --tv-green-soft: #dcf4e3;
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 6px; aspect-ratio: 16 / 9; padding: 8px; overflow: hidden;
  border-radius: 7px; background: var(--tv-bg); color: var(--tv-text); font-size: 8px;
  transition: background-color 0.5s ease, color 0.5s ease;
}
.tv-screen[data-theme='dark'] {
  --tv-bg: #120c0f; --tv-surface: #1c1418; --tv-surface-2: #281d22; --tv-text: #f8eef1; --tv-line: #3a2a31; --tv-green: #4ade80; --tv-green-soft: #0f2b1b;
}
.tv-screen p { margin: 0; }
.tv-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tv-name { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; }
.tv-logo { width: 16px; height: 16px; border-radius: 4px; object-fit: cover; }
.tv-qr { display: block; width: 26px; height: 26px; padding: 2px; border-radius: 4px; background: #fff; color: #111; }
.tv-qr svg { display: block; width: 100%; height: 100%; stroke: none; }
.tv-board {
  display: grid; grid-template-columns: 1fr 1.4fr; column-gap: 6px; min-height: 0;
  transition: grid-template-columns 0.5s var(--ease-out), column-gap 0.5s var(--ease-out);
}
.tv-board.no-prep { grid-template-columns: 0fr 1fr; column-gap: 0; }
.tv-col {
  min-width: 0; overflow: hidden; padding: 5px; border-radius: 6px; background: var(--tv-surface); border: 1px solid var(--tv-line);
  transition: background-color 0.5s ease, border-color 0.5s ease, opacity var(--mid) ease, padding 0.5s var(--ease-out);
}
.no-prep .tv-prep { opacity: 0; padding-inline: 0; border-width: 0; }
.tv-col p { margin-bottom: 4px; font-size: 7.5px; font-weight: 800; white-space: nowrap; }
.tv-ready { background: var(--tv-green-soft); border-color: var(--tv-green); }
.tv-ready p { color: var(--tv-green); }
.tv-tiles { display: flex; flex-wrap: wrap; gap: 3px; }
.tv-tiles span { position: relative; padding: 2px 5px; border-radius: 4px; background: var(--tv-surface-2); font-size: 10px; font-weight: 800; direction: ltr; transition: background-color 0.5s ease, font-size 0.5s var(--ease-out); }
.tv-ready .tv-tiles span { background: var(--tv-surface); color: var(--tv-green); font-size: 14px; }
.no-prep .tv-ready .tv-tiles span { font-size: 19px; }
.tv-tiles .tv-bell {
  position: absolute; top: -5px; inset-inline-end: -6px; display: grid; place-items: center; width: 14px; height: 14px; padding: 0;
  border-radius: 50%; background: #f59e0b; color: #fff; transition: opacity var(--mid) ease, transform var(--mid) var(--ease-spring);
}
.tv-tiles .tv-bell.is-off { opacity: 0; transform: scale(0.2); }
.tv-bell svg { width: 9px; height: 9px; }
.tv-fresh.spot .tv-bell { animation: ring-bell 0.9s ease-in-out; }
.tv-stand { width: 84px; height: 16px; margin-top: -1px; background: linear-gradient(#2c2c35, #121217); clip-path: polygon(34% 0, 66% 0, 100% 100%, 0 100%); }

/* The restaurant's dashboard on a tablet: the orders, and the kitchen rhythm folding in and out under them.
   Light, like a counter tablet usually is. */
.pv-switch:has(> :nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
.pv-switch:has(> :nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
/* The tablet's top: tablet mode and the sound button. */
.dv-tools { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: auto; }
.dv-tablet { padding: 1px 6px; border-radius: 99px; background: #e0f2fe; color: #0369a1; font-size: 6.5px; font-weight: 800; transition: opacity var(--mid) ease, transform var(--mid) var(--ease-spring); }
.dv-sound { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #e11d48; transition: opacity var(--mid) ease, transform var(--mid) var(--ease-spring); }
.dv-tablet.is-off, .dv-sound.is-off { opacity: 0; transform: scale(0.4); }
.dv-badge { padding: 0 4px; border-radius: 99px; background: #b91c1c; color: #fff; font-size: 6.5px; transition: opacity var(--mid) ease; }
.dv-badge.is-off { opacity: 0; }
.dash-screen .dv-col .dv-late { transition: background-color var(--mid) ease, color var(--mid) ease; }
.dash-screen .dv-col .dv-late.on { background: #fde2e2; color: #b91c1c; box-shadow: inset -2px 0 0 #b91c1c; }

/* The posters a restaurant may print: three small sheets. */
.print-device { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 12px; width: 100%; max-width: 330px; padding: 26px 4px 6px; }
.pr-sheet {
  position: relative; display: grid; align-content: start; gap: 5px; aspect-ratio: 210 / 297; padding: 7px; border-radius: 6px;
  background: #fff; box-shadow: 0 14px 26px -14px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(0 0 0 / 0.06);
  transition: opacity var(--mid) ease, transform var(--mid) var(--ease-spring), filter var(--mid) ease;
}
.pr-sheet.is-off { opacity: 0.25; transform: scale(0.9); filter: grayscale(1); }
.pr-sheet i { position: absolute; bottom: -20px; inset-inline: -6px; color: var(--muted); font-size: 0.7rem; font-style: normal; font-weight: 800; text-align: center; white-space: nowrap; }
.pr-band { height: 30%; margin: -7px -7px 0; border-radius: 6px 6px 40% 40% / 6px 6px 12px 12px; background: linear-gradient(160deg, #f53d64, #c5143e); }
.pr-qr { justify-self: center; width: 46%; aspect-ratio: 1; border-radius: 3px; background: repeating-conic-gradient(#1d1b16 0 25%, #fff 0 50%) 0 0 / 25% 25%; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #e4dfd3; }
.pr-line { height: 4px; border-radius: 99px; background: #e4dfd3; }
.pr-line.short { width: 60%; justify-self: center; }
.pr-stand { grid-template-rows: 1fr 1fr; gap: 0; padding: 0; overflow: hidden; }
.pr-half { display: grid; place-items: center; background: linear-gradient(150deg, #f53d64, #c5143e); }
.pr-half.top { transform: rotate(180deg); border-bottom: 1px dashed rgb(255 255 255 / 0.8); }
.pr-half .pr-qr { width: 40%; }
.pr-stickers { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: 5px; place-items: center; }
.pr-stickers span { width: 100%; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(155deg, #f53d64, #c5143e); box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #e4dfd3; }
.pv-switch:has(> :nth-child(3)) button { gap: 4px; padding: 7px 6px; font-size: 0.8rem; }
.dash-device { display: grid; justify-items: center; width: 100%; max-width: 330px; padding-top: 6px; }
.dash-screen {
  --dv-line: #e4dfd3;
  display: grid; align-content: start; gap: 5px; width: 100%; padding: 9px; border-radius: 16px; overflow: hidden;
  border: 7px solid #17171d; background: #f6f4ef; color: #1d1b16; font-size: 7.5px; line-height: 1.4;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.04), 0 26px 50px -24px rgb(13 148 136 / 0.55), 0 14px 30px -16px rgb(0 0 0 / 0.55);
}
.dash-screen p { margin: 0; }
.dv-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dv-brand { display: inline-flex; align-items: center; gap: 3px; color: #e11d48; font-family: 'Lalezar', 'Tajawal', sans-serif; font-size: 11px; line-height: 1; }
.dv-brand img { width: 14px; height: 14px; }
.dv-rname { font-size: 9px; }
.dv-entry { display: grid; grid-template-columns: 1fr 34px 34px; gap: 4px; padding: 5px; border-radius: 8px; background: #fff; border: 1px solid var(--dv-line); }
.dv-input { padding: 2px; border-radius: 5px; background: #f1eee6; text-align: center; font-size: 10px; font-weight: 800; direction: ltr; }
.dv-btn { border-radius: 5px; background: #fff; border: 1px solid var(--dv-line); }
.dv-btn.ready { background: #15803d; border-color: #15803d; }
.dv-stats { display: flex; align-items: center; gap: 5px; min-height: 13px; }
.dv-line { width: 34px; height: 4px; border-radius: 99px; background: #dcd6ca; }
.dv-line.short { width: 22px; }
.dv-chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: 99px; background: #dcf4e3; color: #15803d; font-size: 7px; font-weight: 800; white-space: nowrap; }
.dv-chip svg { width: 8px; height: 8px; }
.dv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.dv-col { display: flex; flex-wrap: wrap; align-content: start; gap: 3px; padding: 4px; border-radius: 6px; background: #fff; border: 1px solid var(--dv-line); }
.dv-col p { width: 100%; font-weight: 800; }
.dv-col span { padding: 1px 5px; border-radius: 4px; background: #f1eee6; font-size: 9px; font-weight: 800; direction: ltr; }
.dv-plus {
  padding: 1px 5px; border-radius: 4px; border: 1px solid #fda4af; color: #e11d48; font-size: 8px; font-weight: 800; line-height: 1.6;
  transition: opacity var(--mid) ease, transform var(--mid) var(--ease-spring);
}
.dv-plus.is-off { opacity: 0; transform: scale(0.4); }
.dash-screen { position: relative; }
.dv-nadi { position: absolute; bottom: 8px; left: 8px; display: flex; align-items: flex-end; gap: 3px; transition: opacity var(--mid) ease, transform var(--mid) var(--ease-spring); }
.dv-nadi.is-off { opacity: 0; transform: translateY(8px) scale(0.6); }
.dv-nadi-bubble { padding: 3px 7px; border-radius: 8px 8px 8px 2px; background: #fff; border: 1px solid #e4dfd3; box-shadow: 0 4px 10px rgb(0 0 0 / 0.12); font-size: 7px; font-weight: 800; white-space: nowrap; order: 2; }
.dv-nadi-bot { order: 1; width: 22px; height: 18px; border-radius: 6px; background: linear-gradient(160deg, #f53d64, #c5143e); box-shadow: 0 4px 8px -2px rgb(190 18 60 / 0.5); position: relative; }
.dv-nadi-bot::before { content: ''; position: absolute; inset: 4px 4px 5px; border-radius: 3px; background: radial-gradient(circle at 30% 45%, #be123c 0 1.6px, transparent 1.8px), radial-gradient(circle at 70% 45%, #be123c 0 1.6px, transparent 1.8px), #fff1f3; }
.dv-nadi-bot::after { content: ''; position: absolute; top: -5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 4px #fbbf24; }
.dv-col.ready { background: #dcf4e3; border-color: #15803d; }
.dv-col.ready p { color: #15803d; }
.dv-col.ready span { background: #fff; color: #15803d; }
.dv-rhythm { display: grid; gap: 4px; padding: 5px; border-radius: 8px; background: #fff; border: 1px solid var(--dv-line); }
.dv-title { display: flex; align-items: center; gap: 4px; font-size: 8px; font-weight: 800; }
.dv-title .pv-sample { font-size: 6.5px; }
.dv-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.dv-tile { display: grid; padding: 3px 4px; border-radius: 5px; background: linear-gradient(140deg, #ccfbf1, #fff 70%); border: 1px solid var(--dv-line); }
.dv-tile:first-child { background: linear-gradient(140deg, #ffe4e6, #fff 70%); }
.dv-tile b { font-size: 9px; }
.dv-tile i { overflow: hidden; color: #6b665c; font-size: 6px; font-style: normal; white-space: nowrap; text-overflow: ellipsis; }
.dv-map { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5px; }
.dv-map i { height: 6px; border-radius: 1.5px; background: #f1eee6; }
.dv-map i[data-l='1'] { background: #fda4af; }
.dv-map i[data-l='2'] { background: #fb7185; }
.dv-map i[data-l='3'] { background: #f43f5e; }
.dv-map i[data-l='4'] { background: #be123c; }
.dv-map i[data-l='5'] { background: #881337; }
.dv-foot { padding: 1px 3px; border-radius: 4px; color: #6b665c; font-size: 6.5px; font-weight: 700; }

/* On a phone the settings fill the screen, and the preview opens from a button at the bottom. */
.preview-fab { display: none; }
@media (max-width: 900px) {
  .sheet-body { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 90px; }
  .settings-preview { display: none; }
  .sheet.show-preview .settings-preview {
    display: grid; position: absolute; inset: auto 0 0; z-index: 5; max-height: 86%; overflow: auto;
    padding: 18px 16px 92px; border-radius: 26px 26px 0 0; background: var(--surface);
    box-shadow: 0 -24px 60px rgb(0 0 0 / 0.3); animation: sheet-up var(--slow) var(--ease-spring) both;
  }
  .preview-fab {
    display: inline-flex; align-items: center; gap: 8px; position: absolute; bottom: 18px; left: 50%; z-index: 6; translate: -50% 0;
    padding: 12px 22px; border: 0; border-radius: 99px; background: var(--primary-fill); color: #fff;
    font: inherit; font-weight: 800; box-shadow: var(--primary-glow), 0 12px 28px -10px rgb(0 0 0 / 0.4); cursor: pointer;
  }
  .preview-fab svg { width: 19px; height: 19px; }
}
@media (max-width: 640px) {
  .settings-dialog { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .sheet-head { gap: 10px; padding: 14px 16px; }
  .sheet-badge, .sheet-logo { width: 42px; height: 42px; border-radius: 13px; }
  .sheet-names h2 { font-size: 1.2rem; }
  .settings-nav { padding: 10px 16px; }
  .set-head { padding: 16px; }
  .set-row { gap: 12px; padding: 14px 16px; }
  .set-row.has-choice { grid-template-columns: auto minmax(0, 1fr); }
  .set-row.has-choice .segmented { grid-column: 1 / -1; }
  .save-pill { position: absolute; top: 74px; left: 50%; z-index: 7; translate: -50% 0; box-shadow: var(--shadow); }
}

/* --- Brands and branches: avatars, brand chips, the brands tab, the brand dialog, the restaurant switcher --- */

/* A brand's colour, registered so it can move: choosing a colour melts the old one into the new. */
@property --tint {
  syntax: '<color>';
  inherits: true;
  initial-value: #e11d48;
}

/* Icons from icons.js take the text's colour and size. */
.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.i .f { fill: currentColor; stroke: none; }
.ic { display: inline-grid; place-items: center; }

.label { display: block; font-weight: 700; margin-bottom: 8px; }
.btn-small { min-height: 34px; padding: 4px 12px; font-size: 0.88rem; }
.tab { display: inline-flex; align-items: center; gap: 8px; }
.tab-icon { display: inline-grid; }

/* A restaurant's or brand's picture (avatar() in shared.js): its logo, or its first letter in Lalezar,
   the logo's font, on a tile in the brand's colour. */
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 48px; height: 48px; overflow: hidden;
  border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px var(--line);
  font-family: 'Lalezar', 'Tajawal', sans-serif; font-size: 1.6rem; line-height: 1;
  transition: --tint 0.5s ease, box-shadow var(--mid) ease;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.monogram {
  padding-top: 0.12em; color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / 0.22);
  background: linear-gradient(145deg, color-mix(in srgb, var(--tint) 58%, #fff), var(--tint) 55%, color-mix(in srgb, var(--tint) 78%, #000));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), 0 8px 16px -10px var(--tint);
}
.avatar.monogram.plain { padding-top: 0; color: var(--muted); background: var(--surface-2); box-shadow: none; text-shadow: none; }
.avatar.tiny { width: 22px; height: 22px; border-radius: 7px; font-size: 0.8rem; }
.avatar.small { width: 36px; height: 36px; border-radius: 11px; font-size: 1.2rem; }
.avatar.large { width: 76px; height: 76px; border-radius: 24px; font-size: 2.5rem; }
.avatar.tiny .i, .avatar.small .i { width: 58%; height: 58%; }

/* The brand's name in its colour, on a restaurant card and at the top of the dashboard. */
.brand-chip {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start; width: fit-content; padding: 2px 10px 2px 9px;
  border-radius: 99px; font-size: 0.82rem; font-weight: 800; white-space: nowrap;
  color: color-mix(in srgb, var(--tint) 75%, var(--text)); background: color-mix(in srgb, var(--tint) 13%, transparent);
}
:root[data-theme='dark'] .brand-chip { color: color-mix(in srgb, var(--tint) 55%, #fff); }
.brand-chip .dot, .brand-dot {
  display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tint);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 22%, transparent);
}

/* --- Admin: restaurants grouped under their brands --- */

.restaurant-groups { display: grid; gap: 22px; }
.brand-group {
  display: grid; gap: 14px; padding: 16px; border-radius: 26px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 10%, transparent), transparent 55%);
  border: 1px solid color-mix(in srgb, var(--tint) 22%, var(--line));
  animation: rise var(--slow) var(--ease-out) both;
}
.brand-group.plain { --tint: #a8a29e; }
.brand-group-head { display: flex; align-items: center; gap: 10px; }
.brand-group-head h3 { font-size: 1.15rem; }
.brand-group-head .btn { margin-inline-start: auto; }
.admin-restaurant .restaurant-names { min-width: 0; }
.admin-restaurant .brand-chip { margin-top: 10px; }
.brand-group .admin-restaurant .brand-chip { display: none; } /* the group already says it */
.admin-restaurant.branded { box-shadow: inset 0 3px 0 var(--tint), var(--shadow); }

/* --- Admin: the brands tab --- */

.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.brand-card {
  position: relative; display: grid; justify-items: start; gap: 8px; padding: 0 20px 20px; overflow: hidden;
  border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform var(--mid) var(--ease-spring), box-shadow var(--mid) ease;
  animation: rise var(--slow) var(--ease-out) both;
}
.brand-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift), 0 18px 40px -24px var(--tint); }
.brand-band, .brand-hero {
  background:
    radial-gradient(circle at 12% 130%, rgb(255 255 255 / 0.28), transparent 45%),
    repeating-linear-gradient(135deg, rgb(255 255 255 / 0.07) 0 10px, transparent 10px 22px),
    radial-gradient(130% 160% at 88% 0%, color-mix(in srgb, var(--tint) 52%, #fff), var(--tint) 46%, color-mix(in srgb, var(--tint) 68%, #000));
}
.brand-band { justify-self: stretch; height: 86px; margin: 0 -20px; }
.brand-card > .avatar.large { margin-top: -40px; box-shadow: 0 0 0 4px var(--surface), 0 12px 26px -12px var(--tint); }
.brand-card h3 { margin-top: 4px; font-size: 1.3rem; }
.brand-card p { margin: 0; }
.branch-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.branch-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 99px;
  background: var(--surface-2); font-size: 0.85rem; font-weight: 700;
}
.branch-chip.more { padding: 3px 10px; color: var(--muted); }
.brand-card .actions { margin-top: 8px; }

.brands-empty {
  display: grid; justify-items: center; gap: 12px; grid-column: 1 / -1; padding: 44px 20px; text-align: center;
  border: 1.5px dashed var(--line); border-radius: 26px; background: var(--surface);
}
.brands-empty-icon {
  display: grid; place-items: center; width: 76px; height: 76px; border-radius: 24px; color: #fff;
  background: var(--primary-fill); box-shadow: var(--primary-glow); animation: float 4s ease-in-out 2;
}
.brands-empty-icon .i { width: 38px; height: 38px; }
.brands-empty h3 { font-size: 1.35rem; }
.brands-empty p { max-width: 470px; margin: 0; }

/* --- Admin: the brand dialog. Its top shows the brand as it will look, live while it is edited. --- */

.brand-dialog { width: min(100% - 32px, 580px); }
.brand-hero {
  position: relative; display: flex; align-items: flex-end; gap: 16px; margin: -22px -22px 20px; padding: 58px 22px 20px;
  color: #fff; transition: --tint 0.5s ease;
}
.brand-hero .avatar.large { box-shadow: 0 0 0 4px rgb(255 255 255 / 0.85), 0 14px 30px -12px rgb(0 0 0 / 0.45); }
.brand-hero-text { min-width: 0; }
.brand-hero-kicker { margin: 0 0 2px; font-size: 0.85rem; font-weight: 800; opacity: 0.85; }
.brand-hero h2 { margin: 0; font-size: 1.7rem; text-shadow: 0 2px 10px rgb(0 0 0 / 0.25); overflow-wrap: anywhere; }
.brand-hero h2.placeholder { opacity: 0.6; }
.brand-hero-count { margin: 4px 0 0; font-weight: 700; opacity: 0.9; }
.brand-hero-count:empty { display: none; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  position: relative; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--tint) 50%, #fff), var(--tint) 62%);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--tint) 30%, transparent);
  transition: transform var(--mid) var(--ease-spring), box-shadow var(--mid) ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-checked='true'], .swatch.custom.on { transform: scale(1.08); box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--tint); }
.swatch[aria-checked='true']::after {
  content: ''; width: 14px; height: 8px; border: solid #fff; border-width: 0 0 3px 3px;
  transform: translateY(-2px) rotate(-45deg); animation: pop-in var(--mid) var(--ease-spring);
}
.swatch.custom { color: #fff; background: conic-gradient(#e11d48, #ea580c, #d97706, #65a30d, #0d9488, #2563eb, #7c3aed, #c026d3, #e11d48); }
.swatch.custom.on { background: radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--tint) 50%, #fff), var(--tint) 62%); }
.swatch.custom .i { width: 19px; height: 19px; filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.35)); }
.swatch-input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; cursor: pointer; }

.branch-list { display: grid; gap: 8px; margin: 10px 0 12px; }
.branch { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: var(--surface-2); animation: rise var(--mid) var(--ease-out) both; }
.branch-names { display: grid; min-width: 0; margin-inline-end: auto; }
.add-branch { display: flex; gap: 8px; }
.add-branch select { flex: 1; min-width: 0; }

/* The restaurant dialog: which brand it belongs to. */
.brand-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-choice {
  --tint: #a8a29e;
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
  transition: border-color var(--fast) ease, background-color var(--fast) ease, box-shadow var(--mid) ease, transform var(--fast) var(--ease-spring);
}
.brand-choice:active { transform: scale(0.96); }
.brand-choice .ic { width: 22px; height: 22px; color: var(--muted); }
.brand-choice[aria-checked='true'] {
  border-color: var(--tint); background: color-mix(in srgb, var(--tint) 12%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 18%, transparent);
}

/* A person's other restaurants, under their email in a staff list. */
.also-in { font-size: 0.82rem; color: var(--muted); }

/* --- The dashboard: the restaurant at the top, and the menu that switches between a login's restaurants --- */

.place-wrap { position: relative; min-width: 0; margin-inline-end: auto; }
.topbar .place-heading { margin: 0; font-size: inherit; }
.place {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; padding: 4px; border: 1px solid transparent;
  border-radius: 18px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer;
  transition: background-color var(--fast) ease, border-color var(--fast) ease, box-shadow var(--mid) ease;
}
.place:disabled { cursor: default; }
.place:not(:disabled) { padding-inline-end: 12px; border-color: var(--line); background: var(--surface); box-shadow: var(--shadow); }
.place:not(:disabled):hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.place[aria-expanded='true'] { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.place-avatar { display: inline-grid; }
.place-avatar .avatar, .place-item .avatar { width: 42px; height: 42px; border-radius: 13px; font-size: 1.4rem; }
.place-names { display: grid; gap: 3px; min-width: 0; }
.place-name { overflow: hidden; font-size: 1.3rem; font-weight: 800; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.place-names .brand-chip { padding: 0 8px; font-size: 0.74rem; }
.place-chevron { display: inline-grid; color: var(--muted); transition: transform var(--slow) var(--ease-spring); }
.place[aria-expanded='true'] .place-chevron { transform: rotate(180deg); }
.place-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-start: 0; z-index: 30; width: min(370px, calc(100vw - 32px)); padding: 8px;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lift), 0 34px 70px -34px rgb(0 0 0 / 0.4);
  transform-origin: top; animation: menu-in var(--mid) var(--ease-spring);
}
.place-menu-title { display: flex; align-items: center; gap: 8px; margin: 4px 8px 8px; color: var(--muted); font-size: 0.9rem; font-weight: 800; }
.place-list { display: grid; gap: 2px; max-height: 60vh; overflow: auto; }
.place-item {
  --tint: #e11d48;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px;
  border: 0; border-radius: 15px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer;
  transition: background-color var(--fast) ease;
}
.place-item:hover, .place-item:focus-visible { background: var(--surface-2); outline: none; }
.place-item[aria-checked='true'] { background: color-mix(in srgb, var(--tint) 11%, var(--surface)); }
.place-item-names { display: grid; min-width: 0; }
.place-item-names strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-item-names .muted { display: flex; align-items: center; gap: 5px; overflow: hidden; white-space: nowrap; }
.place-check { display: grid; place-items: center; width: 24px; height: 24px; color: var(--tint); }
.place-check .i { stroke-width: 3; animation: pop-in var(--mid) var(--ease-spring); }

/* Switching restaurant: the board comes in fresh (dashboard.js). */
#app.switched .place, #app.switched .entry, #app.switched .stats { animation: rise var(--slow) var(--ease-out) both; }
#app.switched .columns { animation: rise var(--slow) var(--ease-out) 70ms both; }

/* The invitation page: the logos of the restaurants it invites to, side by side. */
.join-faces { display: flex; justify-content: center; margin: 0 auto 14px; }
.join-faces:empty { display: none; }
.join-faces .avatar { width: 84px; height: 84px; border-radius: 24px; font-size: 2.7rem; box-shadow: 0 0 0 4px var(--surface), var(--shadow); }
.join-faces .avatar + .avatar { margin-inline-start: -18px; }

@media (max-width: 640px) {
  .place-name { font-size: 1.12rem; }
  /* The menu opens right under the button and spans the screen, so it never leaves it (dashboard.js sets --menu-top). */
  .place-menu { position: fixed; top: var(--menu-top, 76px); inset-inline: 16px; width: auto; }
  .brand-group { padding: 12px; border-radius: 22px; }
  .add-branch { flex-direction: column; }
}

/* --- The kitchen rhythm on the dashboard (rhythm.js): tiles, today hour by hour, the week as a map ---
   Colours: how busy is one rose ramp, light to dark (in dark mode dark to bright); how fast is teal for
   faster and orange for slower around a neutral grey. Both were checked for colour-blind readers. */

:root {
  --hm-none: #f1eee6;
  --hm-1: #fda4af; --hm-2: #fb7185; --hm-3: #f43f5e; --hm-4: #be123c; --hm-5: #881337;
  --hs-m2: #0d9488; --hs-m1: #5eead4; --hs-0: #d6d3d1; --hs-1: #fdba74; --hs-2: #ea580c;
  --tc-usual: #fecdd3; --tc-today: #e11d48;
}
:root[data-theme='dark'] {
  --hm-none: #281d22;
  --hm-1: #881337; --hm-2: #be123c; --hm-3: #f43f5e; --hm-4: #fb7185; --hm-5: #fecdd3;
  --hs-m2: #2dd4bf; --hs-m1: #115e59; --hs-0: #4a3f44; --hs-1: #9a3412; --hs-2: #fb923c;
  --tc-usual: #4c1d2b; --tc-today: #fb7185;
}

/* The closed section's line, and the chip in the stats: faster, slower, or as usual. */
.rhythm-summary { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.rh-pill {
  display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 1px 10px; border-radius: 99px;
  background: var(--surface-2); color: var(--text); font-size: 0.85rem; font-weight: 800;
}
.rh-pill.fast, .pace-chip.fast { background: var(--green-soft); color: var(--green); }
.rh-pill.slow, .pace-chip.slow { background: var(--amber-soft); color: var(--amber); }
.pace-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px; border: 0; border-radius: 99px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 800; cursor: pointer;
  transition: transform var(--fast) var(--ease-spring), box-shadow var(--fast) ease;
}
.pace-chip .i { width: 15px; height: 15px; }
@media (hover: hover) { .pace-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); } }

.rhythm-body { position: relative; display: grid; gap: 14px; }

/* Four tiles: a coloured icon, what it is, the number, and a line under it. */
.rh-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rh-tile {
  position: relative; display: grid; align-content: start; gap: 2px; min-width: 0; padding: 14px 16px; overflow: hidden;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.rh-tile::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tone-a) 15%, transparent), transparent 58%);
}
:root[data-theme='dark'] .rh-tile::before { background: linear-gradient(140deg, color-mix(in srgb, var(--tone-a) 10%, transparent), transparent 58%); }
.rh-tile.rose { --tone-a: #fb7185; --tone-b: #e11d48; }
.rh-tile.green { --tone-a: #4ade80; --tone-b: #15803d; }
.rh-tile.amber { --tone-a: #fbbf24; --tone-b: #ea580c; }
.rh-tile.violet { --tone-a: #a78bfa; --tone-b: #7c3aed; }
.rh-tile.teal { --tone-a: #2dd4bf; --tone-b: #0d9488; }
.rh-ic {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 6px; border-radius: 12px; color: #fff;
  background: linear-gradient(145deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 8px 16px -8px var(--tone-b), inset 0 1px 0 rgb(255 255 255 / 0.35);
}
.rh-ic .i { width: 20px; height: 20px; }
.rh-tile-title { position: relative; margin: 0; color: var(--muted); font-size: 0.86rem; font-weight: 800; }
.rh-value { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
.rh-sub { position: relative; margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.rh-delta {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); font-size: 0.78rem; font-weight: 800; line-height: 1.5;
}
.rh-delta.fast { background: var(--green-soft); color: var(--green); }
.rh-delta.slow { background: var(--amber-soft); color: var(--amber); }
.rh-delta .i { width: 13px; height: 13px; stroke-width: 2.6; }

/* A chart's card: its title and one line under it, its tools or legend at the side. */
.rh-card { min-width: 0; padding: 16px 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.rh-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.rh-head h3 { margin: 0; font-size: 1.05rem; }
.rh-head p { margin: 3px 0 0; }
.rh-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.rh-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rh-legend .key { width: 12px; height: 12px; border-radius: 3px; }
.key.usual { background: var(--tc-usual); }
.key.today { background: var(--tc-today); }
.rh-note { display: flex; align-items: center; gap: 7px; margin: 12px 0 0; font-size: 0.9rem; font-weight: 700; }
.rh-note .i { width: 17px; height: 17px; color: var(--primary); }
.rh-note.fast .i { color: var(--hs-m2); }
.rh-note.slow .i { color: var(--hs-2); }
.rh-note + .rh-note { margin-top: 6px; }

/* Today hour by hour: the usual hour as a pale bar, today's in rose inside it, rising from one baseline. */
.tc-plot {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; align-items: end;
  height: 140px; padding-top: 20px; border-bottom: 1px solid var(--line);
}
.tc-col { position: relative; display: flex; justify-content: center; height: 100%; border-radius: 6px 6px 0 0; outline-offset: 1px; }
.tc-col.now { background: linear-gradient(to top, color-mix(in srgb, var(--primary) 9%, transparent), transparent); }
.tc-usual, .tc-today { position: absolute; bottom: 0; border-radius: 4px 4px 0 0; transform-origin: bottom; }
.tc-usual { width: min(24px, 88%); height: var(--hu); background: var(--tc-usual); }
.tc-today { width: min(12px, 48%); height: var(--ht); background: var(--tc-today); }
.tc-label { position: absolute; color: var(--muted); font-size: 0.72rem; font-weight: 800; white-space: nowrap; line-height: 1; }
.tc-label.peak { bottom: calc(var(--hu) + 4px); }
.tc-label.mine { bottom: calc(var(--ht) + 4px); color: var(--text); }
.tc-axis { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; margin-top: 6px; text-align: center; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.tc-axis .now { color: var(--primary); font-weight: 800; }
@media (hover: hover) { .tc-col:hover .tc-usual { filter: brightness(0.96) saturate(1.3); } }

/* The week hour by hour: one cell for every weekday's hour, 2px of air between them. */
.rh-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rh-seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.rh-seg-btn, .rh-view {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 9px; background: none;
  color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 800; white-space: nowrap; cursor: pointer;
  transition: background-color var(--mid) ease, color var(--mid) ease;
}
.rh-seg-btn[aria-checked='true'] { background: var(--surface); color: var(--primary); box-shadow: 0 2px 8px rgb(0 0 0 / 0.08); }
.rh-seg-btn .i, .rh-view .i { width: 15px; height: 15px; }
.rh-view { border: 1px solid var(--line); background: var(--surface); }
.rh-view[aria-pressed='true'] { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }

.hm {
  display: grid; grid-template-columns: max-content repeat(var(--cols), minmax(12px, 1fr)); gap: 3px 2px; align-items: center;
  animation: fade-in var(--mid) ease;
}
.hm-hour { color: var(--muted); font-size: 0.72rem; font-weight: 700; text-align: center; line-height: 1.6; }
.hm-hour.now { color: var(--primary); font-weight: 800; }
.hm-day { padding-inline-end: 10px; color: var(--muted); font-size: 0.82rem; font-weight: 800; white-space: nowrap; }
.hm-day.today { justify-self: start; margin-inline-end: 6px; padding: 1px 10px; border-radius: 99px; background: var(--primary-fill); color: #fff; }
.hm-cell {
  position: relative; height: 26px; border-radius: 6px; background: var(--hm-none); outline: none;
  transition: transform var(--fast) var(--ease-spring), box-shadow var(--fast) ease;
}
.hm-cell[data-l='1'] { background: var(--hm-1); }
.hm-cell[data-l='2'] { background: var(--hm-2); }
.hm-cell[data-l='3'] { background: var(--hm-3); }
.hm-cell[data-l='4'] { background: var(--hm-4); }
.hm-cell[data-l='5'] { background: var(--hm-5); }
.hm-cell[data-s='-2'], .hm-key[data-s='-2'] { background: var(--hs-m2); }
.hm-cell[data-s='-1'], .hm-key[data-s='-1'] { background: var(--hs-m1); }
.hm-cell[data-s='0'], .hm-key[data-s='0'] { background: var(--hs-0); }
.hm-cell[data-s='1'], .hm-key[data-s='1'] { background: var(--hs-1); }
.hm-cell[data-s='2'], .hm-key[data-s='2'] { background: var(--hs-2); }
.hm-cell.now { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--primary); z-index: 1; }
.hm-cell:hover, .hm-cell:focus-visible { z-index: 2; transform: scale(1.14); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--text) 45%, transparent); }

.rh-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 12px; }
.rh-scale > span { margin-inline: 4px; }
.hm-key { width: 18px; height: 12px; border-radius: 3px; background: var(--hm-none); }
.hm-key[data-l='1'] { background: var(--hm-1); }
.hm-key[data-l='2'] { background: var(--hm-2); }
.hm-key[data-l='3'] { background: var(--hm-3); }
.hm-key[data-l='4'] { background: var(--hm-4); }
.hm-key[data-l='5'] { background: var(--hm-5); }
.hm-key.gap { margin-inline-start: 12px; }

/* The same numbers as a table. */
.rh-table-wrap { overflow-x: auto; }
.rh-table-wrap p { margin: 8px 0 0; }
.rh-table { border-collapse: collapse; width: 100%; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.rh-table th, .rh-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.rh-table thead th { color: var(--muted); font-weight: 700; }
.rh-table tbody th { padding-inline-end: 10px; color: var(--muted); text-align: start; font-weight: 800; }
.rh-table tr.today th, .rh-table tr.today td { color: var(--primary); font-weight: 800; }

/* The tooltip: the number first and strong, what it is beside it. */
.rh-tip {
  position: absolute; z-index: 20; display: grid; gap: 3px; min-width: 140px; padding: 9px 12px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-size: 0.82rem; box-shadow: var(--shadow-lift); pointer-events: none;
  animation: fade-in var(--fast) ease;
}
.rh-tip strong { font-size: 0.78rem; opacity: 0.8; }
.rh-tip-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.rh-tip-row .muted { color: inherit; opacity: 0.75; }
.rh-tip-row b { font-size: 0.95rem; }

.rh-foot { display: flex; align-items: flex-start; gap: 8px; margin: 0; color: var(--muted); font-size: 0.82rem; }
.rh-foot > span:first-child { flex: none; padding-top: 1px; }
.rh-foot .i { width: 16px; height: 16px; color: var(--primary); }
.rh-foot .rh-pill { margin-inline-start: 8px; font-size: 0.78rem; }

/* The first days: Nadini's ticket with a chart on it, and how far the learning has come. */
.rh-learning {
  display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: center; gap: 18px; padding: 18px 20px;
  border-radius: 20px; background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 9%, var(--surface)), var(--surface) 70%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.rh-learning h3 { margin: 0 0 6px; font-size: 1.15rem; }
.rh-learning p { margin: 0 0 12px; }
.rh-art { display: block; width: 100%; height: auto; filter: drop-shadow(0 14px 18px rgb(190 18 60 / 0.3)); }
.rh-art-bars rect { transform-box: fill-box; transform-origin: bottom; animation: grow 0.7s var(--ease-out) both; }
.rh-art-bars rect:nth-child(2) { animation-delay: 0.08s; }
.rh-art-bars rect:nth-child(3) { animation-delay: 0.16s; }
.rh-art-bars rect:nth-child(4) { animation-delay: 0.24s; }
.rh-art-bars rect:nth-child(5) { animation-delay: 0.32s; }
.rh-art-spark { transform-box: fill-box; transform-origin: center; animation: pop-in 0.5s var(--ease-spring) 0.5s both; }
.rh-progress { display: grid; gap: 6px; }
.rh-progress-track { display: block; height: 9px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.rh-progress-fill { display: block; height: 100%; border-radius: 99px; background: var(--primary-fill); transform-origin: right; animation: grow-x 0.9s var(--ease-out) both; }

/* The first draw of a table rises in once; the live updates after it do not move. */
.rh-enter .rh-tile { animation: rise var(--slow) var(--ease-out) both; }
.rh-enter .rh-tile:nth-child(2) { animation-delay: 60ms; }
.rh-enter .rh-tile:nth-child(3) { animation-delay: 120ms; }
.rh-enter .rh-tile:nth-child(4) { animation-delay: 180ms; }
.rh-enter .tc-usual, .rh-enter .tc-today { animation: grow 0.6s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 22ms); }
.rh-enter .hm-cell { animation: fade-in 0.5s ease both; animation-delay: calc(var(--i, 0) * 9ms); }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes grow-x { from { transform: scaleX(0); } }

@media (max-width: 900px) {
  .rh-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .rh-tiles { gap: 10px; }
  .rh-tile { padding: 12px 13px; border-radius: 16px; }
  .rh-value { font-size: 1.4rem; }
  .rh-card { padding: 14px 12px; border-radius: 18px; }
  .hm-cell { height: 22px; border-radius: 5px; }
  .hm-hour.odd { visibility: hidden; }
  .hm-day { padding-inline-end: 6px; font-size: 0.74rem; }
  .hm-day.today { padding: 1px 7px; }
  .tc-plot { height: 120px; }
  .tc-axis span:nth-child(even):not(.now) { visibility: hidden; }
  .rh-learning { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .rh-art-wrap { width: 150px; }
}

/* --- Nadi 🤖 (nadi.js): a robot in the corner, a bubble when it talks, and a chat window ---
   It is Nadini's ticket with a face, in the rose palette. It blinks now and then (a moment, from JS), lifts
   its head and lights its antenna when it talks; nothing here moves when it is quiet. */
.nadi { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 40; display: grid; justify-items: end; gap: 10px; pointer-events: none; }
.nadi > * { pointer-events: auto; }
.nadi-bot {
  position: relative; width: 74px; height: 74px; padding: 0; border: 0; border-radius: 26px; background: none; cursor: pointer;
  filter: drop-shadow(0 12px 16px rgb(190 18 60 / 0.35)); transition: transform var(--mid) var(--ease-spring);
}
.nadi-bot svg { width: 100%; height: 100%; overflow: visible; }
.nadi-bot:hover { transform: translateY(-2px) rotate(-4deg); }
.nadi-bot:active { transform: scale(0.94); }
.nadi .nadi-head { transform-origin: 60px 100px; transition: transform 0.45s var(--ease-spring); }
.nadi.talking .nadi-head { transform: translateY(-7px) rotate(-6deg); }
.nadi-shadow { fill: rgb(0 0 0 / 0.16); transition: transform 0.45s var(--ease-spring), opacity 0.45s ease; transform-origin: 60px 112px; }
.nadi.talking .nadi-shadow { transform: scaleX(0.82); opacity: 0.7; }
/* Messages since the chat was last opened: a white tag on the rose robot, like the ticket's own white. */
.nadi-unread {
  position: absolute; top: 2px; inset-inline-start: 0; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: #fff; color: #be123c; font-size: 0.78rem; font-weight: 800; line-height: 22px; text-align: center;
  box-shadow: 0 0 0 2px #e11d48, 0 4px 10px rgb(0 0 0 / 0.22); animation: nadi-pop 0.35s var(--ease-spring) both;
}
.nadi-unread.bump { animation: bump var(--mid) var(--ease-spring); }
.nadi-bulb { fill: #fda4af; transition: fill var(--mid) ease, filter var(--mid) ease; }
.nadi.talking .nadi-bulb, .nadi.open .nadi-bulb { fill: #fbbf24; filter: drop-shadow(0 0 5px #fbbf24) drop-shadow(0 0 12px rgb(251 191 36 / 0.7)); }
.nadi-eyes { transform-origin: 60px 57px; transition: transform 0.09s ease-in; }
.nadi.blink .nadi-eyes { transform: scaleY(0.12); }

.nadi-bubble {
  position: relative; max-width: min(330px, calc(100vw - 110px)); margin-inline-end: 58px; padding: 12px 16px; border-radius: 20px 20px 6px 20px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-lift);
  font-size: 0.95rem; font-weight: 700; line-height: 1.5; cursor: pointer; transform-origin: bottom right;
  animation: nadi-pop 0.42s var(--ease-spring) both;
}
:root[dir='rtl'] .nadi-bubble, [dir='rtl'] .nadi-bubble { border-radius: 20px 20px 20px 6px; transform-origin: bottom left; }
.nadi-bubble.urgent { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent), var(--shadow-lift); }
.nadi-bubble.out { animation: nadi-out 0.3s ease forwards; }
.nadi-dots { display: inline-flex; gap: 5px; padding: 4px 2px; }
.nadi-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); opacity: 0.35; animation: nadi-dot 0.9s ease-in-out infinite; }
.nadi-dots i:nth-child(2) { animation-delay: 0.15s; }
.nadi-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes nadi-pop { from { opacity: 0; transform: translateY(10px) scale(0.85); } }
@keyframes nadi-out { to { opacity: 0; transform: translateY(6px) scale(0.92); } }
@keyframes nadi-dot { 50% { opacity: 1; transform: translateY(-4px); } }

/* The chat: messages from Nadi like a phone chat, quick questions under them. */
.nadi-panel {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(380px, calc(100vw - 36px)); height: min(560px, calc(100dvh - 130px));
  overflow: hidden; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 70px -20px rgb(0 0 0 / 0.4);
  animation: pop-in var(--slow) var(--ease-spring) both;
}
.nadi-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, rgb(255 255 255 / 0.18), transparent 55%), var(--primary-fill);
}
.nadi-head strong { display: block; font-size: 1.05rem; }
.nadi-head .muted { color: rgb(255 255 255 / 0.82); }
.nadi-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: rgb(255 255 255 / 0.18); }
.nadi-avatar svg { width: 36px; height: 36px; }
.nadi-close {
  margin-inline-start: auto; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.18);
  color: #fff; font: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.nadi-messages {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--primary) 6%, transparent), transparent 60%), var(--bg);
}
.nadi-msg {
  align-self: flex-start; max-width: 88%; padding: 10px 13px 6px; border-radius: 18px 18px 18px 5px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 6px rgb(0 0 0 / 0.04); animation: rise var(--mid) var(--ease-out) both;
}
[dir='rtl'] .nadi-msg { border-radius: 18px 18px 5px 18px; }
.nadi-msg.me { align-self: flex-end; background: var(--primary-soft); border-color: transparent; color: var(--text); }
[dir='rtl'] .nadi-msg.me { border-radius: 18px 18px 18px 5px; }
.nadi-msg.urgent { border-color: var(--red); background: color-mix(in srgb, var(--red-soft) 60%, var(--surface)); }
.nadi-msg p { margin: 0 0 4px; line-height: 1.55; font-size: 0.93rem; }
.nadi-msg blockquote { margin: 4px 0 6px; padding: 6px 10px; border-inline-start: 3px solid var(--primary); border-radius: 8px; background: var(--surface-2); font-size: 0.9rem; }
.nadi-msg time { display: block; color: var(--muted); font-size: 0.7rem; text-align: end; }
.nadi-list { margin: 4px 0 6px; font-size: 0.9rem; }
.nadi-list ul { margin: 2px 0 0; padding-inline-start: 18px; }
.nadi-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin: 6px 0 16px; padding-bottom: 2px; border-bottom: 1px solid var(--line); }
.nadi-bars span { position: relative; display: flex; flex: 1; align-items: flex-end; height: 100%; }
.nadi-bars i { display: block; width: 100%; height: var(--h); border-radius: 3px 3px 0 0; background: var(--hm-2, #fb7185); opacity: 0.6; }
.nadi-bars span.peak i { background: var(--primary); opacity: 1; }
.nadi-bars em { position: absolute; top: calc(100% + 3px); inset-inline: -6px; color: var(--muted); font-size: 0.62rem; font-style: normal; font-weight: 700; text-align: center; }
.nadi-replies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.nadi-chip {
  min-width: 0; padding: 7px 10px; border-radius: 99px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1.5px solid color-mix(in srgb, var(--primary) 40%, var(--line));
  background: var(--surface); color: var(--primary); font: inherit; font-size: 0.86rem; font-weight: 800; cursor: pointer;
  transition: background-color var(--fast) ease, transform var(--fast) var(--ease-spring);
}
.nadi-chip:hover { background: var(--primary-soft); }
.nadi-chip:active { transform: scale(0.95); }

@media (max-width: 560px) {
  .nadi { bottom: 12px; inset-inline-end: 12px; }
  .nadi-bot { width: 62px; height: 62px; }
  .nadi-panel { height: min(560px, calc(100dvh - 100px)); }
}
@media print { .nadi { display: none; } }

/* --- Phase 5: the weekly email drawn small in the settings (reports.*) --- */
.mail-device { display: grid; justify-items: center; gap: 10px; width: 100%; max-width: 330px; padding-top: 8px; }
.ml-card {
  display: grid; gap: 8px; width: 100%; max-width: 290px; padding: 14px; border-radius: 18px; text-align: start;
  background: #fff; color: #1d1b16; border: 1px solid #e4dfd3; box-shadow: 0 18px 40px -20px rgb(0 0 0 / 0.35);
  transition: opacity var(--mid) ease, transform var(--mid) var(--ease-spring), filter var(--mid) ease;
}
.ml-card.is-off { opacity: 0.3; transform: scale(0.94); filter: grayscale(1); }
.ml-top { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; }
.ml-top img { width: 22px; height: 22px; }
.ml-top b { color: #e11d48; font-family: 'Lalezar', var(--font, inherit); font-size: 1rem; font-weight: 400; }
.ml-top span { margin-inline-start: auto; color: #6b665c; font-size: 0.7rem; font-weight: 700; }
.ml-subject { margin: 0; font-size: 0.86rem; font-weight: 800; line-height: 1.4; }
.ml-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.ml-tiles span { display: grid; gap: 1px; padding: 7px 4px; border-radius: 10px; background: #f6f4ef; text-align: center; }
.ml-tiles span.rose { background: #fff1f3; }
.ml-tiles b { font-size: 0.95rem; }
.ml-tiles span.rose b { color: #e11d48; }
.ml-tiles i { color: #6b665c; font-size: 0.62rem; font-style: normal; font-weight: 700; }
.ml-bars { display: flex; align-items: flex-end; gap: 4px; height: 34px; padding: 0 2px; }
.ml-bars i { flex: 1; height: var(--h); border-radius: 4px 4px 2px 2px; background: #fda4af; }
.ml-bars i.top { background: #e11d48; }
.ml-nadi { margin: 0; padding: 7px 9px; border-radius: 10px; background: #fff1f3; font-size: 0.72rem; font-weight: 700; line-height: 1.5; }
.ml-button { justify-self: center; padding: 6px 16px; border-radius: 9px; background: #e11d48; color: #fff; font-size: 0.74rem; font-weight: 800; }
.ml-off { margin: 0; color: var(--muted); font-size: 0.8rem; font-weight: 700; transition: opacity var(--mid) ease; }
.ml-off.is-off { display: none; }

/* --- Phase 5: the admin page's statistics --- */
.stats-hint { margin: -6px 0 14px; }
.stats-body { display: grid; gap: 14px; transition: opacity var(--mid) ease; }
.stats-body[aria-busy='true'] { opacity: 0.55; }
.stats-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stats-tile {
  display: grid; gap: 2px; align-content: start; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  animation: rise var(--mid) var(--ease-out) both;
}
.stats-tile.rose { background: radial-gradient(130% 120% at 0% 0%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 60%), var(--surface); border-color: color-mix(in srgb, var(--primary) 28%, var(--line)); }
.stats-label { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.stats-value { font-size: 1.7rem; font-weight: 800; line-height: 1.25; text-align: start; unicode-bidi: plaintext; }
.stats-tile.rose .stats-value { color: var(--primary); }
.stats-sub { color: var(--muted); font-size: 0.78rem; }
.stats-card { padding: 16px 18px; }
.stats-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.stats-card-head h3 { margin: 0; font-size: 1.02rem; }
.stats-bars { display: flex; align-items: flex-end; gap: 2px; height: 150px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.stats-bar { position: relative; display: flex; flex: 1; align-items: flex-end; height: 100%; outline: none; cursor: default; }
.stats-bar i { display: block; width: 100%; height: var(--h); min-height: 0; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--primary) 55%, var(--surface)); transition: background-color var(--fast) ease; }
.stats-bar.top i { background: var(--primary); }
.stats-bar.now i { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--primary) 45%, transparent) 0 4px, color-mix(in srgb, var(--primary) 20%, transparent) 4px 8px); }
.stats-bar:hover i, .stats-bar:focus-visible i { background: var(--primary-fill); }
.stats-bar em { position: absolute; top: calc(100% + 4px); inset-inline-start: 50%; translate: 50% 0; color: var(--muted); font-size: 0.66rem; font-style: normal; font-weight: 700; white-space: nowrap; }
.stats-peak { margin: 8px 0 0; }
.stats-empty { margin: 30px 0; text-align: center; }
.stats-tip {
  position: absolute; z-index: 60; padding: 5px 10px; border-radius: 9px; background: var(--text); color: var(--bg);
  font-size: 0.8rem; font-weight: 700; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-lift);
}
.table-scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; white-space: nowrap; }
.stats-table th, .stats-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.stats-table thead th { color: var(--muted); font-size: 0.76rem; font-weight: 800; }
.stats-table tbody th { text-align: start; font-weight: 400; }
.stats-table tbody tr { animation: rise var(--mid) var(--ease-out) both; }
.stats-table tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.stats-table tr.quiet td, .stats-table tr.quiet strong { color: var(--muted); }
.stats-table td.strong { font-weight: 800; }
.stats-name { display: inline-flex; align-items: center; gap: 9px; }
.stats-name > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.delta { font-weight: 800; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.same { color: var(--muted); }
.spark { display: inline-flex; align-items: flex-end; gap: 1px; width: 92px; height: 24px; vertical-align: middle; }
.spark i { flex: 1; height: var(--h); border-radius: 1px; background: color-mix(in srgb, var(--primary) 60%, var(--surface)); }
#brand-managers-section { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
#brand-managers-section h3 { margin: 0; }

/* --- Phase 6: registration requests on /admin --- */
.count.new { background: var(--primary-fill); color: #fff; }
.leads { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; transition: opacity var(--mid) ease; }
.leads[aria-busy='true'] { opacity: 0.55; }
.lead { display: grid; gap: 10px; padding: 16px; border-inline-start: 4px solid var(--primary); animation: rise var(--mid) var(--ease-out) both; }
.lead.contacted { border-inline-start-color: #f59e0b; }
.lead.done { border-inline-start-color: var(--green); opacity: 0.8; }
.lead-head { display: flex; align-items: center; gap: 10px; }
.lead-names { display: grid; min-width: 0; }
.lead-names strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-head time { margin-inline-start: auto; white-space: nowrap; }
.lead-contact { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; font-weight: 700; }
.lead-note { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border-inline-start: 3px solid var(--primary); white-space: pre-wrap; }
.lead-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lead-status { margin-inline-start: auto; }
.lead-status .seg.on { background: var(--primary-fill); color: #fff; }
.btn-danger-text { color: var(--red); }

/* --- Phase 5: the brand page (/brand), for a brand's managers --- */
.brand-page { display: grid; gap: 14px; }
.brand-page #brand-view { display: grid; gap: 14px; }
.brand-page #brand-view[hidden] { display: none; }
.bp-hero { margin: 0; padding: 70px 24px 22px; border-radius: 26px; box-shadow: var(--shadow); animation: rise var(--slow) var(--ease-out) both; }
.bp-hero h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.2rem); text-shadow: 0 2px 10px rgb(0 0 0 / 0.25); }
.brand-switch { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; }
.stats-tile.live { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.stats-tile.live .stats-label::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-inline-end: 6px; border-radius: 50%; background: var(--green); vertical-align: middle; }
.bp-compare { display: grid; gap: 8px; }
.bp-row { display: grid; grid-template-columns: minmax(110px, 200px) 1fr auto; align-items: center; gap: 12px; }
.bp-branch { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.bp-branch strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-bar { display: block; height: 14px; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.bp-bar i { display: block; width: var(--w); height: 100%; border-radius: 7px; background: var(--tint, var(--primary)); transition: width var(--slow) var(--ease-out); }
#bp-compare { --tint: var(--primary); }
.bp-value { min-width: 36px; text-align: end; }
.bp-highlights { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bp-highlights:empty { display: none; }
.bp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-size: 0.88rem; }
.bp-note { text-align: center; }
@media (max-width: 560px) {
  .bp-row { grid-template-columns: minmax(90px, 1fr) 1.4fr auto; gap: 8px; }
}


/* --- Motion: the same few soft movements everywhere --- */

/* The page settles in, and a card that appears (hidden → shown) rises into place. */
main { animation: rise var(--slow) var(--ease-out) both; }
section.card:not([hidden]), .login:not([hidden]) { animation: rise var(--slow) var(--ease-out) both; }
details[open] > :not(summary) { animation: rise var(--mid) var(--ease-out) both; }

/* New items in a live list (fillKeyed in shared.js): only the new ones move, never the whole list. */
.enter { animation: rise var(--slow) var(--ease-out) both; }
.order.ready.enter { animation: rise var(--slow) var(--ease-out) both, glow-green 1.2s var(--ease-out) 0.1s; }
.order { transition: background-color var(--mid) ease, border-color var(--mid) ease, opacity var(--mid) ease; }

/* A number that just changed gives a little jump (bump in shared.js). */
.bump { animation: bump 0.45s var(--ease-spring); }
.status.bump { animation-name: bump-soft; } /* a big box only nods */

dialog[open] { animation: pop-in var(--mid) var(--ease-spring); }
dialog[open]::backdrop { animation: fade-in var(--mid) ease; }
dialog::backdrop, .overlay { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.overlay:not([hidden]) { animation: fade-in var(--mid) ease; }
.overlay:not([hidden]) .card { animation: pop-in var(--slow) var(--ease-spring) both; }

.footer a, a.logo { transition: color var(--fast) ease; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes bump { 40% { transform: scale(1.22); } }
@keyframes bump-soft { 40% { transform: scale(1.04); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes gear-in { from { opacity: 0; transform: rotate(-150deg) scale(0.4); } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes spot { 0% { box-shadow: inset 0 0 0 2px rgb(225 29 72 / 0.85); background-color: rgb(253 164 175 / 0.4); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
@keyframes ring-bell { 15%, 45%, 75% { transform: rotate(-18deg); } 30%, 60% { transform: rotate(18deg); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-8px) scale(0.96); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes glow-green { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* Visitors who ask their phone for less motion get none of it. The alert flash stays: it is the alert itself. */
@media (prefers-reduced-motion: reduce) {
  *:not(.alerting), *::before, *::after, ::backdrop {
    animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}
