/* Sign-in, first-run setup, sign-up, the restaurant set-up wizard and the error page (UI unit 3).
   Login + Setup are standalone pages (no _Layout, no Bootstrap): the page sets the tenant / platform palette as
   --p (primary) --pd (dark) --pdeep (deepest) --accent on <html>, and themes.css adds --on-gold (text on an
   accent fill). Every colour below derives from those — no literal colours except the two status hues.
   Light / dark follows <html data-mode> (cookie bay-mode, same as the back office). Logical properties only.
   The file is also loaded inside _Layout / _PlatformLayout (Onboarding, Signup, Error), so page-level rules are
   scoped to body.auth and the wizard / error rules (§ sw-, err-) use the back-office --erp-* tokens. */
:root {
  --auth-danger: #C0392B;
  --auth-success: #1E8E4E;
  --auth-bg: color-mix(in srgb, var(--p) 5%, white);
  --auth-card: white;
  --auth-ink: color-mix(in srgb, var(--p) 14%, black);
  --auth-text: color-mix(in srgb, var(--auth-ink) 84%, white);
  --auth-muted: color-mix(in srgb, var(--auth-ink) 56%, white);
  --auth-line: color-mix(in srgb, var(--auth-ink) 13%, white);
  --auth-line-strong: color-mix(in srgb, var(--auth-ink) 24%, white);
  --auth-field: white;
  --auth-hover: color-mix(in srgb, var(--auth-ink) 4%, white);
  --auth-action: var(--p);
  --auth-action-hover: var(--pd);
  --auth-on-action: white;
  --auth-accent-fg: var(--p);
  --auth-on-brand: white;
  --auth-soft: color-mix(in srgb, var(--p) 8%, var(--auth-card));
  --auth-err-bg: color-mix(in srgb, var(--auth-danger) 7%, var(--auth-card));
  --auth-err-line: color-mix(in srgb, var(--auth-danger) 32%, var(--auth-card));
  --auth-err-ink: color-mix(in srgb, var(--auth-danger) 78%, black);
  --auth-ok-bg: color-mix(in srgb, var(--auth-success) 7%, var(--auth-card));
  --auth-ok-line: color-mix(in srgb, var(--auth-success) 32%, var(--auth-card));
  --auth-ok-ink: color-mix(in srgb, var(--auth-success) 75%, black);
  --auth-ring: color-mix(in srgb, var(--auth-action) 20%, transparent);
  --auth-shadow: 0 1px 2px color-mix(in srgb, black 5%, transparent), 0 24px 48px -24px color-mix(in srgb, black 22%, transparent);
}
html[data-mode="dark"] {
  --auth-bg: color-mix(in srgb, white 5%, color-mix(in srgb, var(--p) 10%, black));
  --auth-card: color-mix(in srgb, white 4%, var(--auth-bg));
  --auth-ink: color-mix(in srgb, var(--p) 5%, white);
  --auth-text: color-mix(in srgb, var(--auth-ink) 84%, var(--auth-card));
  --auth-muted: color-mix(in srgb, var(--auth-ink) 58%, var(--auth-card));
  --auth-line: color-mix(in srgb, var(--auth-ink) 13%, var(--auth-card));
  --auth-line-strong: color-mix(in srgb, var(--auth-ink) 24%, var(--auth-card));
  --auth-field: color-mix(in srgb, black 18%, var(--auth-card));
  --auth-hover: color-mix(in srgb, var(--auth-ink) 6%, var(--auth-card));
  --auth-action: var(--accent);
  --auth-action-hover: color-mix(in srgb, var(--accent) 84%, white);
  --auth-on-action: var(--on-gold, white);
  --auth-accent-fg: color-mix(in srgb, var(--accent) 72%, white);
  --auth-soft: color-mix(in srgb, var(--accent) 14%, var(--auth-card));
  --auth-err-bg: color-mix(in srgb, var(--auth-danger) 16%, var(--auth-card));
  --auth-err-line: color-mix(in srgb, var(--auth-danger) 45%, var(--auth-card));
  --auth-err-ink: color-mix(in srgb, var(--auth-danger) 40%, white);
  --auth-ok-bg: color-mix(in srgb, var(--auth-success) 16%, var(--auth-card));
  --auth-ok-line: color-mix(in srgb, var(--auth-success) 45%, var(--auth-card));
  --auth-ok-ink: color-mix(in srgb, var(--auth-success) 40%, white);
  --auth-ring: color-mix(in srgb, var(--auth-action) 30%, transparent);
  --auth-shadow: 0 1px 2px color-mix(in srgb, black 30%, transparent), 0 24px 48px -24px color-mix(in srgb, black 70%, transparent);
}

/* Browsers without color-mix() (Chrome < 111, Safari < 16.2 — e.g. Windows 7/8 cashier PCs): plain neutral
   fallbacks for the base tokens, so the page keeps its background, text and borders. */
@supports not (color: color-mix(in srgb, red, red)) {
  :root { --auth-bg: #F4F5F8; --auth-ink: #1F2126; --auth-text: #3A3D44; --auth-muted: #6B7280; --auth-line: #E2E5EA;
    --auth-line-strong: #CDD2DA; --auth-hover: #F4F5F7; --auth-soft: #EEF1F6; --auth-err-bg: #FDF0EE; --auth-err-line: #EDB9B2;
    --auth-err-ink: #8F2A1E; --auth-ok-bg: #EDF7F1; --auth-ok-line: #A9D8BC; --auth-ok-ink: #17643A; --auth-ring: rgba(60, 90, 160, .25); }
  html[data-mode="dark"] { --auth-bg: #0F1115; --auth-card: #181B21; --auth-ink: #F1F3F6; --auth-text: #D5D9E0; --auth-muted: #9AA3AF;
    --auth-line: #2B3039; --auth-line-strong: #3A404B; --auth-field: #14171C; --auth-hover: #20242C; --auth-soft: #20242C;
    --auth-action-hover: var(--accent); --auth-accent-fg: var(--accent); --auth-err-bg: #3A1F1E; --auth-err-line: #6E3330;
    --auth-err-ink: #FFB4AB; --auth-ok-bg: #1B3325; --auth-ok-line: #2F5E40; --auth-ok-ink: #9BE9A8; --auth-ring: rgba(255, 255, 255, .2); }
}
/* ── page ───────────────────────────────────────────────────────── */
html:has(> body.auth) { color-scheme: light; }
html[data-mode="dark"]:has(> body.auth) { color-scheme: dark; }
body.auth, body.auth *, body.auth *::before, body.auth *::after { box-sizing: border-box; }
body.auth {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif; font-size: 14px; line-height: 1.55; color: var(--auth-ink);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow-x: hidden;
  background:
    radial-gradient(800px 420px at 100% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 65%),
    radial-gradient(800px 420px at 0% 100%, color-mix(in srgb, var(--p) 8%, transparent), transparent 65%),
    var(--auth-bg);
}
body.auth [hidden] { display: none !important; }
body.auth .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.auth code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--auth-hover);
  border: 1px solid var(--auth-line); border-radius: 5px; padding: 0 .3em; }

/* ── card (split screen) ────────────────────────────────────────── */
.auth-card {
  width: 100%; max-width: 940px; min-height: 560px; display: flex; background: var(--auth-card); position: relative; z-index: 1;
  border: 1px solid var(--auth-line); border-radius: 16px; overflow: hidden; box-shadow: var(--auth-shadow);
  animation: auth-rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-card--wide { max-width: 1040px; }
@keyframes auth-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }

/* ── brand panel ────────────────────────────────────────────────── */
.auth-brand {
  flex: 0 0 42%; position: relative; padding: 40px 36px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(160deg, var(--pdeep) 0%, var(--pd) 55%, var(--p) 100%);
  color: var(--auth-on-brand); overflow: hidden; isolation: isolate;
}
.auth-brand--photo { background: var(--auth-photo, none) center / cover no-repeat, var(--pdeep); }
.auth-brand--photo::after { content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(160deg, color-mix(in srgb, var(--pdeep) 90%, transparent) 0%,
    color-mix(in srgb, var(--pd) 74%, transparent) 55%, color-mix(in srgb, var(--p) 58%, transparent) 100%); }
/* soft dot grid + accent glow — texture, never a picture */
.auth-brand::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(420px 260px at 50% 0%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 70%),
    radial-gradient(circle at 1px 1px, color-mix(in srgb, white 13%, transparent) 1px, transparent 1.5px) 0 0 / 22px 22px; }
.auth-brand__inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 300px; }
.auth-logo { width: 72%; max-width: 220px; height: auto; max-height: 170px; object-fit: contain;
  filter: drop-shadow(0 8px 20px color-mix(in srgb, black 35%, transparent)); }
.auth-logo--compact { width: 92px; max-width: 92px; }
.auth-mark { display: none; width: 88px; height: 88px; border-radius: 22px; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; letter-spacing: .02em; color: var(--auth-on-brand);
  background: color-mix(in srgb, white 14%, transparent); border: 1px solid color-mix(in srgb, white 26%, transparent);
  box-shadow: 0 10px 30px -12px color-mix(in srgb, black 50%, transparent); }
.auth-mark--icon { display: flex; font-size: 2.2rem; }
.auth-brand.no-logo .auth-logo { display: none; }
.auth-brand.no-logo .auth-mark { display: flex; }
.auth-name { margin-top: 18px; font-size: 1.4rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.auth-tag { margin-top: 8px; font-size: .9rem; font-weight: 500; color: color-mix(in srgb, white 82%, transparent); line-height: 1.7; }
.auth-rule { width: 44px; height: 3px; border-radius: 3px; margin: 20px auto 22px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.auth-feats { display: flex; flex-direction: column; gap: 10px; width: 100%; margin: 0; padding: 0; list-style: none; text-align: start; }
.auth-feats li { display: flex; align-items: center; gap: 12px; font-size: .86rem; font-weight: 500; color: color-mix(in srgb, white 90%, transparent);
  padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, white 7%, transparent); border: 1px solid color-mix(in srgb, white 10%, transparent); }
.auth-feats .bi { width: 30px; height: 30px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .95rem; color: var(--auth-on-brand); background: color-mix(in srgb, var(--accent) 38%, transparent); }

/* brand-panel stepper (Setup): the form's numbered sections */
.auth-steps { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 0; text-align: start; counter-reset: aust; }
.auth-steps li { counter-increment: aust; position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 0;
  font-size: .88rem; font-weight: 600; color: color-mix(in srgb, white 88%, transparent); }
.auth-steps li::before { content: counter(aust); width: 28px; height: 28px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
  border: 1.5px solid color-mix(in srgb, white 45%, transparent); background: color-mix(in srgb, white 8%, transparent);
  position: relative; z-index: 1; }
.auth-steps li + li::after { content: ''; position: absolute; inset-inline-start: 13.5px; bottom: calc(50% + 14px); height: calc(100% - 28px);
  width: 1.5px; background: color-mix(in srgb, white 28%, transparent); }

/* ── form panel ─────────────────────────────────────────────────── */
.auth-form { flex: 1; padding: 40px 48px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.auth-form__inner { width: 100%; max-width: 400px; margin-inline: auto; }
.auth-form--setup .auth-form__inner { max-width: 520px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 26px; flex-wrap: wrap; }
.auth-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 600;
  color: var(--auth-accent-fg); background: var(--auth-soft); border: 1px solid color-mix(in srgb, var(--auth-action) 20%, var(--auth-card));
  padding: .22rem .65rem; border-radius: 999px; }
.auth-eyebrow .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.auth-form h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; color: var(--auth-ink); margin: 0 0 4px; line-height: 1.3; }
.auth-sub { color: var(--auth-muted); font-size: .9rem; margin: 0 0 24px; }

.auth-fld { margin-bottom: 16px; }
.auth-fld label, .auth-lbl { display: block; font-size: .84rem; font-weight: 600; color: var(--auth-text); margin-bottom: 6px; }
.auth-input { position: relative; }
.auth-input .icn { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 13px;
  color: var(--auth-muted); font-size: 1rem; pointer-events: none; line-height: 1; transition: color .15s; }
.auth-input:focus-within .icn { color: var(--auth-accent-fg); }
.auth-input input, .auth-ctl {
  width: 100%; min-height: 44px; background: var(--auth-field); border: 1px solid var(--auth-line-strong); border-radius: 10px;
  padding: .6rem .9rem; padding-inline-start: 2.55rem; font-size: .95rem; color: var(--auth-ink); font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.auth-ctl { padding-inline-start: .9rem; }
.auth-input input::placeholder, .auth-ctl::placeholder { color: var(--auth-muted); opacity: .7; }
.auth-input input:hover, .auth-ctl:hover { border-color: color-mix(in srgb, var(--auth-ink) 36%, var(--auth-card)); }
.auth-input input:focus, .auth-ctl:focus { outline: none; border-color: var(--auth-action); box-shadow: 0 0 0 3px var(--auth-ring); }
.auth-input input:disabled, .auth-ctl:disabled { opacity: .6; cursor: not-allowed; }
.auth-input.has-toggle input { padding-inline-end: 2.9rem; }
/* inline validation: only after the user touched the field (:user-invalid), never on first paint */
.auth-input input:user-invalid, .auth-ctl:user-invalid { border-color: var(--auth-danger); }
.auth-input input:user-invalid:focus, .auth-ctl:user-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-danger) 20%, transparent); }
.auth-input:has(input:user-invalid) .icn { color: var(--auth-danger); }
.auth-err { display: none; align-items: center; gap: 5px; margin-top: 5px; font-size: .78rem; font-weight: 500; color: var(--auth-err-ink); }
.auth-fld:has(:user-invalid) .auth-err { display: flex; }
.auth-pw { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 4px;
  width: 36px; height: 36px; border: none; background: transparent; cursor: pointer; border-radius: 8px;
  color: var(--auth-muted); font-size: 1.05rem; display: flex; align-items: center; justify-content: center; }
.auth-pw:hover, .auth-pw:focus-visible { background: var(--auth-hover); color: var(--auth-ink); outline: none; }
.auth-pw:focus-visible { box-shadow: 0 0 0 2px var(--auth-ring); }
.auth-hint { font-size: .76rem; color: var(--auth-muted); margin-top: .4rem; line-height: 1.6; }
.auth-hint code, .auth-foot code { direction: ltr; unicode-bidi: isolate; }
/* /Setup: existing restaurant databases found on the server (auth.js renderDbs) */
.auth-dbs { font-size: .78rem; color: var(--auth-muted); margin-top: .5rem; display: grid; gap: .4rem; }
.auth-dbs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.auth-db-chip { direction: ltr; unicode-bidi: isolate; font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--auth-line-strong); background: var(--auth-field); color: var(--auth-text); border-radius: 999px; padding: 3px 12px; }
.auth-db-chip:hover { border-color: var(--auth-action); color: var(--auth-accent-fg); }
.auth-db-chip.on { background: var(--auth-soft); border-color: var(--auth-action); color: var(--auth-accent-fg); }
.auth-db-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--auth-ring); }

.auth-btn {
  width: 100%; margin-top: 10px; padding: .7rem 1rem; border: 1px solid transparent; border-radius: 10px; min-height: 46px;
  font-family: inherit; font-size: .98rem; font-weight: 600; color: var(--auth-on-action); cursor: pointer;
  background: var(--auth-action);
  box-shadow: 0 1px 2px color-mix(in srgb, black 10%, transparent), inset 0 1px 0 color-mix(in srgb, white 12%, transparent);
  transition: background .15s, box-shadow .15s, transform .1s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-btn:hover { background: var(--auth-action-hover); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--auth-ring); }
.auth-btn[disabled] { opacity: .72; cursor: progress; }
.auth-btn--ghost { background: var(--auth-field); color: var(--auth-ink); border-color: var(--auth-line-strong); box-shadow: none; }
.auth-btn--ghost:hover { background: var(--auth-hover); border-color: color-mix(in srgb, var(--auth-ink) 36%, var(--auth-card)); }
.auth-btn .spin { width: 15px; height: 15px; border: 2px solid color-mix(in srgb, currentColor 35%, transparent); border-top-color: currentColor;
  border-radius: 50%; animation: auth-spin .7s linear infinite; display: none; }
.auth-btn.loading .spin { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-row { display: flex; gap: .6rem; margin-top: .9rem; }
.auth-row > * { flex: 1; margin-top: 0; }

.auth-msg { border-radius: 10px; padding: .6rem .8rem; font-size: .86rem; margin-bottom: 16px; text-align: start;
  display: flex; align-items: flex-start; gap: 9px; border: 1px solid transparent; line-height: 1.55; }
.auth-msg > .bi { flex: none; font-size: 1rem; line-height: 1.4; }
.auth-msg--err { background: var(--auth-err-bg); border-color: var(--auth-err-line); color: var(--auth-err-ink); }
.auth-msg--ok { background: var(--auth-ok-bg); border-color: var(--auth-ok-line); color: var(--auth-ok-ink); }
.demo-login { flex-wrap: wrap; align-items: center; margin-top: 14px; margin-bottom: 0; }
.demo-fill { margin-inline-start: auto; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--auth-ok-line); background: var(--auth-card); color: var(--auth-ok-ink); padding: .2rem .65rem; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 0; color: var(--auth-muted); font-size: .76rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--auth-line); }
.auth-pin { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px;
  min-height: 44px; border-radius: 10px; border: 1px solid var(--auth-line-strong); color: var(--auth-ink); background: var(--auth-field);
  font-weight: 600; font-size: .9rem; text-decoration: none; transition: background .15s, border-color .15s; }
.auth-pin .bi { color: var(--auth-accent-fg); }
.auth-pin:hover { background: var(--auth-hover); }
.auth-pin:focus-visible { outline: none; border-color: var(--auth-action); box-shadow: 0 0 0 3px var(--auth-ring); }

.auth-themes { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.auth-tdot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--auth-card); cursor: pointer; padding: 0;
  background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 0 0 1px var(--auth-line-strong);
  transition: transform .12s, box-shadow .12s; }
.auth-tdot:hover { transform: scale(1.1); }
.auth-tdot:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--auth-ring); }
.auth-tdot.on { box-shadow: 0 0 0 2px var(--auth-action); transform: scale(1.1); }

.auth-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--auth-line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: .76rem; color: var(--auth-muted); }
.auth-foot .bi-shield-lock { color: var(--auth-success); }
.auth-mode { border: 1px solid var(--auth-line); background: var(--auth-field); color: var(--auth-muted); cursor: pointer;
  border-radius: 999px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; }
.auth-mode:hover { color: var(--auth-ink); background: var(--auth-hover); }
.auth-mode:focus-visible { outline: none; border-color: var(--auth-action); box-shadow: 0 0 0 3px var(--auth-ring); }

/* language pills — staff-i18n renders Bootstrap-class markup; these pages have no Bootstrap */
.auth-lang .btn-group { display: inline-flex; background: var(--auth-hover); border: 1px solid var(--auth-line); border-radius: 999px; padding: 3px; gap: 2px; }
.auth-lang .btn { border: none; background: transparent; cursor: pointer; font-family: inherit; font-size: .78rem; font-weight: 600;
  line-height: 1; color: var(--auth-muted); padding: .38rem .72rem; border-radius: 999px; min-height: 28px; }
.auth-lang .btn:hover { color: var(--auth-ink); }
.auth-lang .btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--auth-ring); }
.auth-lang .btn.btn-secondary { background: var(--auth-card); color: var(--auth-ink);
  box-shadow: 0 1px 2px color-mix(in srgb, black 12%, transparent); }

/* ── first-run setup ────────────────────────────────────────────── */
.auth-sec { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; font-size: .95rem; font-weight: 600; color: var(--auth-ink); }
.auth-sec:first-of-type { margin-top: 0; }
.auth-stepno { width: 24px; height: 24px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .76rem; font-weight: 700; color: var(--auth-accent-fg); background: var(--auth-soft);
  border: 1px solid color-mix(in srgb, var(--auth-action) 28%, var(--auth-card)); font-variant-numeric: tabular-nums; }
.auth-sec::after { content: ''; flex: 1; height: 1px; background: var(--auth-line); }
.auth-auth { display: flex; gap: .6rem; margin-bottom: 1rem; }
.auth-auth > div { flex: 1; position: relative; }
.auth-auth input, .auth-modes input { position: absolute; opacity: 0; pointer-events: none; }
.auth-auth label { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; cursor: pointer; padding: .55rem .4rem; min-height: 44px;
  border: 1px solid var(--auth-line-strong); border-radius: 10px; background: var(--auth-field);
  font-size: .86rem; font-weight: 600; color: var(--auth-text); transition: border-color .15s, background .15s; }
.auth-auth label:hover, .auth-modes label:hover { border-color: color-mix(in srgb, var(--auth-ink) 36%, var(--auth-card)); }
.auth-auth input:checked + label { border-color: var(--auth-action); background: var(--auth-soft); color: var(--auth-ink); box-shadow: 0 0 0 1px var(--auth-action); }
.auth-auth input:focus-visible + label, .auth-modes input:focus-visible + label { outline: none; box-shadow: 0 0 0 3px var(--auth-ring); }
/* first-run setup: what is being set up (existing system / standalone POS / online POS) — radio cards */
.auth-modes { display: grid; gap: .5rem; margin-bottom: .4rem; }
.auth-modes > div { position: relative; }
.auth-modes label { display: block; position: relative; cursor: pointer; padding: .7rem .9rem; padding-inline-start: 2.6rem; min-height: 44px;
  border: 1px solid var(--auth-line-strong); border-radius: 10px; background: var(--auth-field); color: var(--auth-text);
  transition: border-color .15s, background .15s; }
.auth-modes label::before { content: ''; position: absolute; inset-inline-start: .9rem; top: .95rem; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--auth-line-strong); background: var(--auth-card); transition: border-color .15s, box-shadow .15s; }
.auth-modes input:checked + label { border-color: var(--auth-action); background: var(--auth-soft); box-shadow: 0 0 0 1px var(--auth-action); }
.auth-modes input:checked + label::before { border-color: var(--auth-action); box-shadow: inset 0 0 0 4px var(--auth-action); }
.auth-modes label b { display: block; font-size: .9rem; font-weight: 600; color: var(--auth-ink); }
.auth-modes label span { font-size: .78rem; color: var(--auth-muted); line-height: 1.55; }
.auth-modes label b span { font-size: inherit; color: inherit; }
.auth-modes input:disabled + label { cursor: not-allowed; opacity: .6; }
.auth-soon { font-style: normal; font-size: .68rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px;
  border: 1px solid var(--auth-line); color: var(--auth-muted); margin-inline-start: .35rem; }
.auth-progress { margin-top: 1rem; border: 1px solid var(--auth-line); border-radius: 10px; background: var(--auth-hover); padding: .7rem .85rem; }
.auth-progress-head { display: flex; align-items: center; gap: .5rem; font-size: .86rem; font-weight: 600; color: var(--auth-ink); }
.auth-pspin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--auth-line-strong); border-top-color: var(--auth-action);
  border-radius: 50%; animation: auth-spin .7s linear infinite; flex: none; }
.auth-progress.is-idle .auth-pspin { display: none; }
.auth-progress pre { margin: .5rem 0 0; max-height: 9.5rem; overflow: auto; font-size: .72rem; line-height: 1.45;
  color: var(--auth-muted); white-space: pre-wrap; text-align: left; }

/* ── mobile ─────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  body.auth { padding: 16px; align-items: flex-start; }
  .auth-card { flex-direction: column; max-width: 480px; min-height: 0; margin-block: 2vh; }
  .auth-brand { flex: none; padding: 26px 20px 22px; }
  .auth-brand__inner { max-width: none; }
  .auth-logo { width: 52%; max-width: 170px; max-height: 104px; }
  .auth-mark { width: 64px; height: 64px; font-size: 1.5rem; border-radius: 18px; }
  .auth-name { font-size: 1.15rem; margin-top: 12px; }
  .auth-tag { font-size: .84rem; margin-top: 4px; }
  .auth-rule { display: none; }
  .auth-feats, .auth-steps { display: none; }
  .auth-form { padding: 24px 20px 22px; }
  .auth-top { margin-bottom: 18px; }
  .auth-input input, .auth-ctl { font-size: 16px; }   /* no iOS zoom */
  .auth-row { flex-direction: column; }
}

/* ═════════ Restaurant set-up wizard (Views/Onboarding, inside _Layout) ═════════ */
.sw-page { max-width: 980px; margin-inline: auto; }
.sw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.sw-title { font-size: var(--erp-fs-title, 1.375rem); font-weight: 600; margin: 0; display: flex; align-items: center; gap: .6rem; color: var(--erp-text); }
.sw-title__icon { width: 38px; height: 38px; border-radius: var(--erp-radius-control, 10px); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--erp-accent-fg); background: var(--erp-primary-soft); border: 1px solid var(--erp-primary-line); flex: none; }
.sw-sub { color: var(--erp-muted); margin: .3rem 0 0; font-size: var(--erp-fs-body, .875rem); }
.sw-later { text-align: end; }
.sw-later .form-text { max-width: 260px; margin-inline-start: auto; }

/* stepper: numbered circles joined by a rail; done = check, current = filled */
.sw-steps { list-style: none; display: flex; padding: 0; margin: 0 0 1.25rem; counter-reset: none; }
.sw-steps li { flex: 1 1 0; min-width: 0; position: relative; }
.sw-steps li + li::before { content: ''; position: absolute; top: 15px; inset-inline-end: calc(50% + 22px); inset-inline-start: calc(-50% + 22px);
  height: 2px; border-radius: 2px; background: var(--erp-border); }
.sw-steps li.is-done + li::before, .sw-steps li.is-done + li.is-current::before { background: var(--erp-success); }
.sw-steps a { display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: 0 .25rem .2rem; text-align: center;
  color: var(--erp-muted); text-decoration: none; font-weight: 500; font-size: var(--erp-fs-meta, .78rem); border-radius: var(--erp-radius-sm, 8px); }
.sw-steps a:hover { color: var(--erp-text); }
.sw-steps a:focus-visible { outline: 2px solid var(--erp-action); outline-offset: 2px; }
.sw-steps__n { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; flex: 0 0 auto;
  background: var(--erp-surface); border: 1.5px solid var(--erp-border-strong, var(--erp-border)); color: var(--erp-muted);
  transition: background .15s, border-color .15s; }
.sw-steps li.is-current a { color: var(--erp-text); font-weight: 600; }
.sw-steps li.is-current .sw-steps__n { background: var(--erp-action); border-color: var(--erp-action); color: var(--erp-on-action);
  box-shadow: 0 0 0 4px var(--erp-primary-soft); }
.sw-steps li.is-done a { color: var(--erp-text); }
.sw-steps li.is-done .sw-steps__n { background: var(--erp-success-soft); border-color: var(--erp-success-line, var(--erp-success)); color: var(--erp-success-ink, var(--erp-success)); }
.sw-steps li.is-done .sw-steps__n .bi { font-size: 1rem; }

.sw-card .erp-card__body { padding: 1.5rem; }
.sw-h2 { font-size: var(--erp-fs-md, 1rem); font-weight: 600; margin: 0 0 .25rem; color: var(--erp-text); }
.sw-lead { color: var(--erp-muted); font-size: var(--erp-fs-meta, .78rem); margin: 0 0 1.1rem; }
.sw-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding-top: 1rem; margin-top: .5rem; border-top: 1px solid var(--erp-border); }
.sw-actions .btn-primary, .sw-actions .btn-success { margin-inline-start: auto; }
.sw-actions .btn-link { order: -1; }
[dir="ltr"] .sw-fwd { transform: scaleX(-1); display: inline-block; }
.sw-logo { width: 48px; height: 48px; object-fit: contain; border: 1px solid var(--erp-border); border-radius: var(--erp-radius-sm, 8px); background: var(--erp-surface); flex: none; }
.sw-themes { display: flex; gap: .7rem; flex-wrap: wrap; }
.sw-theme { display: flex; flex-direction: column; align-items: center; gap: .25rem; cursor: pointer; position: relative; color: var(--erp-muted); }
.sw-theme input { position: absolute; opacity: 0; }
.sw-theme__sw { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--c1) 55%, var(--c2) 55%);
  border: 3px solid transparent; box-shadow: 0 0 0 1px var(--erp-border); transition: box-shadow .15s; }
.sw-theme:has(input:checked) { color: var(--erp-text); font-weight: 600; }
.sw-theme input:checked + .sw-theme__sw { border-color: var(--erp-surface); box-shadow: 0 0 0 2px var(--erp-action); }
.sw-theme input:focus-visible + .sw-theme__sw { outline: 2px solid var(--erp-action); outline-offset: 2px; }
.sw-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.sw-mod { display: flex; gap: .65rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--erp-border); border-radius: var(--erp-radius-control, 10px);
  cursor: pointer; background: var(--erp-surface); transition: border-color .15s, background .15s; }
.sw-mod:hover { border-color: var(--erp-primary-line); }
.sw-mod:has(input:checked) { border-color: var(--erp-primary-line); background: var(--erp-primary-soft); }
.sw-mod input { margin-top: 0; flex: 0 0 auto; }
.sw-mod__icon { width: 30px; height: 30px; flex: none; border-radius: var(--erp-radius-sm, 8px); display: inline-flex; align-items: center; justify-content: center;
  font-size: .95rem; color: var(--erp-accent-fg); background: var(--erp-primary-soft); }
html[lang="en"] .sw-mod__en { display: none; }   /* the English hint only helps the ar / am UI */
.sw-addresses { display: grid; gap: .3rem; padding: .7rem .9rem; border-radius: var(--erp-radius-control, 10px);
  background: var(--erp-info-soft); border: 1px solid var(--erp-info-line, var(--erp-border)); color: var(--erp-info-ink, var(--erp-text)); }
.sw-todo { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; }
.sw-todo__item { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem; border: 1px solid var(--erp-border); border-radius: var(--erp-radius, 12px);
  color: var(--erp-text); text-decoration: none; background: var(--erp-surface); transition: border-color .15s, box-shadow .15s; }
.sw-todo__item:hover { border-color: var(--erp-primary-line); box-shadow: var(--erp-shadow-1); color: var(--erp-text); }
.sw-todo__item > .bi { width: 36px; height: 36px; flex: none; border-radius: var(--erp-radius-control, 10px); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; color: var(--erp-accent-fg); background: var(--erp-primary-soft); }
@media (max-width: 576px) {
  .sw-steps li:not(.is-current) a span:not(.sw-steps__n) { display: none; }
  .sw-steps li + li::before { inset-inline-start: calc(-50% + 20px); inset-inline-end: calc(50% + 20px); }
  .sw-card .erp-card__body { padding: 1rem; }
  .sw-later { text-align: start; }
  .sw-later .form-text { margin-inline-start: 0; }
}

/* ═════════ Sign-up (Views/Signup, inside _PlatformLayout) ═════════ */
.su-sec { display: flex; align-items: center; gap: .6rem; }
.su-sec .auth-stepno { width: 26px; height: 26px; color: var(--erp-accent-fg); background: var(--erp-primary-soft); border: 1px solid var(--erp-primary-line); }
.su-done { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--erp-success-soft); border: 1px solid var(--erp-success-line, var(--erp-border)); }
.su-done .pf-thanks-icon { font-size: 2rem; line-height: 1; }

/* ═════════ Error page (Views/Home/Error, inside _Layout) ═════════ */
.err-page { min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.err-card { max-width: 480px; width: 100%; text-align: center; padding: 2.5rem 2rem; background: var(--erp-surface);
  border: 1px solid var(--erp-border); border-radius: var(--erp-radius-lg, 16px); }
.err-icon { width: 64px; height: 64px; margin: 0 auto 1.1rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; color: var(--erp-warning); background: var(--erp-warning-soft); border: 1px solid var(--erp-warning-line, var(--erp-border));
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--erp-warning-soft) 50%, transparent); }
.err-title { font-size: var(--erp-fs-title, 1.375rem); font-weight: 600; margin: 0 0 .4rem; color: var(--erp-text); }
.err-text { color: var(--erp-muted); margin: 0 0 1.5rem; }
.err-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.err-ref { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--erp-border); font-size: var(--erp-fs-meta, .78rem); color: var(--erp-muted); }
.err-ref code { direction: ltr; unicode-bidi: isolate; color: var(--erp-text); }
[dir="ltr"] .err-back-ic { transform: scaleX(-1); display: inline-block; }
