/* Sign-in + first-run setup (ERP unit 14). Standalone pages (no _Layout): the page sets the tenant / platform
   theme as --p (primary) --pd (dark) --pdeep (deepest) --accent on :root; everything else derives from them.
   Light / dark follows <html data-mode> (cookie bay-mode, same as the back office). Logical properties only. */
:root {
  --auth-bg: #EEF0F4;
  --auth-card: #FFFFFF;
  --auth-ink: #1F2126;
  --auth-text: #3A3D44;
  --auth-muted: #6B7280;
  --auth-line: #E2E5EA;
  --auth-field: #F6F7F9;
  --auth-err-bg: color-mix(in srgb, #C0392B 10%, var(--auth-card));
  --auth-err-ink: #9A2A1A;
  --auth-ok-bg: color-mix(in srgb, #1E8E4E 10%, var(--auth-card));
  --auth-ok-ink: #17643A;
  --auth-ring: color-mix(in srgb, var(--p) 16%, transparent);
  --auth-shadow: 0 30px 70px -28px rgba(20, 16, 12, .45), 0 6px 18px rgba(20, 16, 12, .08);
  color-scheme: light;
}
html[data-mode="dark"] {
  --auth-bg: #0F1115;
  --auth-card: #181B21;
  --auth-ink: #F1F3F6;
  --auth-text: #D5D9E0;
  --auth-muted: #9AA3AF;
  --auth-line: #2B3039;
  --auth-field: #20242C;
  --auth-err-bg: color-mix(in srgb, #E5534B 18%, var(--auth-card));
  --auth-err-ink: #FFB4AB;
  --auth-ok-bg: color-mix(in srgb, #3FB950 18%, var(--auth-card));
  --auth-ok-ink: #9BE9A8;
  --auth-ring: color-mix(in srgb, var(--p) 32%, transparent);
  --auth-shadow: 0 30px 70px -28px rgba(0, 0, 0, .8), 0 6px 18px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body.auth {
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif; color: var(--auth-ink);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow-x: hidden;
  background:
    radial-gradient(900px 480px at 88% -8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(900px 520px at 6% 108%, color-mix(in srgb, var(--p) 12%, transparent), transparent 60%),
    var(--auth-bg);
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── card ───────────────────────────────────────────────────────── */
.auth-card {
  width: 100%; max-width: 900px; display: flex; background: var(--auth-card); position: relative; z-index: 1;
  border-radius: 22px; overflow: hidden; box-shadow: var(--auth-shadow);
  animation: auth-rise .55s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-card--narrow { max-width: 500px; flex-direction: column; }
@keyframes auth-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }

/* ── brand panel ────────────────────────────────────────────────── */
.auth-brand {
  flex: 0 0 45%; position: relative; padding: 44px 34px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(150deg, var(--pdeep) 0%, var(--pd) 52%, var(--p) 100%);
  color: #fff; overflow: hidden;
}
.auth-brand--photo { background: var(--auth-photo, none) center / cover no-repeat, var(--pdeep); }
.auth-brand--photo::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(150deg, color-mix(in srgb, var(--pdeep) 88%, transparent) 0%,
    color-mix(in srgb, var(--pd) 72%, transparent) 55%, color-mix(in srgb, var(--p) 55%, transparent) 100%); }
.auth-brand::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(440px 240px at 50% 6%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%); }
.auth-brand__inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: 100%; }
.auth-logo { width: 74%; max-width: 230px; height: auto; max-height: 180px; object-fit: contain;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .40)); }
.auth-logo--compact { width: 96px; max-width: 96px; }
.auth-mark { display: none; width: 96px; height: 96px; border-radius: 26px; align-items: center; justify-content: center;
  font-size: 2.1rem; font-weight: 800; letter-spacing: .02em; color: #fff;
  background: color-mix(in srgb, #fff 16%, transparent); border: 1px solid color-mix(in srgb, #fff 30%, transparent);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); }
.auth-brand.no-logo .auth-logo { display: none; }
.auth-brand.no-logo .auth-mark { display: flex; }
.auth-name { margin-top: 16px; font-size: 1.45rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.auth-tag { margin-top: 14px; font-size: .92rem; font-weight: 500; color: rgba(255, 255, 255, .88); line-height: 1.7; }
.auth-rule { width: 54px; height: 3px; border-radius: 3px; margin: 16px auto 22px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.auth-feats { display: flex; flex-direction: column; gap: 9px; width: 100%; max-width: 240px; margin: 0; padding: 0; list-style: none; }
.auth-feats li { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: rgba(255, 255, 255, .85); }
.auth-feats .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }

/* ── form panel ─────────────────────────────────────────────────── */
.auth-form { flex: 1; padding: 44px 46px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.auth-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: .74rem; font-weight: 700; letter-spacing: .04em;
  color: var(--p); background: color-mix(in srgb, var(--p) 10%, transparent); padding: .3rem .7rem; border-radius: 999px; }
html[data-mode="dark"] .auth-eyebrow { color: color-mix(in srgb, var(--p) 45%, #fff); }
.auth-eyebrow .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.auth-form h1 { font-size: 1.55rem; font-weight: 800; color: var(--auth-ink); margin: 0 0 5px; }
.auth-sub { color: var(--auth-muted); font-size: .88rem; margin: 0 0 24px; }

.auth-fld { margin-bottom: 16px; }
.auth-fld label, .auth-lbl { display: block; font-size: .82rem; 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: 14px;
  color: var(--auth-muted); font-size: 1rem; pointer-events: none; line-height: 1; }
.auth-input input, .auth-ctl {
  width: 100%; background: var(--auth-field); border: 1.5px solid var(--auth-line); border-radius: 12px;
  padding: .8rem 1rem; padding-inline-start: 2.7rem; font-size: .95rem; color: var(--auth-ink); font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-ctl { padding-inline-start: 1rem; }
.auth-input input::placeholder, .auth-ctl::placeholder { color: var(--auth-muted); opacity: .7; }
.auth-input input:focus, .auth-ctl:focus { outline: none; background: var(--auth-card); border-color: var(--p); box-shadow: 0 0 0 4px var(--auth-ring); }
.auth-input.has-toggle input { padding-inline-end: 2.9rem; }
.auth-pw { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 6px;
  width: 38px; height: 38px; border: none; background: transparent; cursor: pointer; border-radius: 9px;
  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-line); color: var(--auth-ink); outline: none; }
.auth-hint { font-size: .74rem; color: var(--auth-muted); margin-top: .35rem; }
.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: .76rem; color: var(--auth-muted); margin-top: .5rem; display: grid; gap: .35rem; }
.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(--p); background: transparent; color: var(--p); border-radius: 999px; padding: 3px 12px; }
.auth-db-chip.on { background: var(--p); color: #fff; }
.auth-db-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.auth-btn {
  width: 100%; margin-top: 8px; padding: .9rem; border: none; border-radius: 13px; min-height: 48px;
  font-family: inherit; font-size: 1rem; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--p) 0%, var(--pd) 100%);
  box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--p) 60%, transparent);
  transition: transform .12s, box-shadow .15s, filter .15s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn[disabled] { opacity: .7; cursor: progress; }
.auth-btn--ghost { background: var(--auth-field); color: var(--auth-ink); border: 1.5px solid var(--p); box-shadow: none; }
.auth-btn .spin { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  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: .6rem; }
.auth-row > * { flex: 1; }

.auth-msg { border-radius: 11px; padding: .65rem .85rem; font-size: .85rem; margin-bottom: 16px; text-align: center;
  display: flex; align-items: center; gap: 8px; justify-content: center; }
.auth-msg--err { background: var(--auth-err-bg); color: var(--auth-err-ink); }
.auth-msg--ok { background: var(--auth-ok-bg); color: var(--auth-ok-ink); }

.auth-pin { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px;
  min-height: 44px; border-radius: 11px; border: 1px dashed var(--auth-line); color: var(--p);
  font-weight: 700; font-size: .9rem; text-decoration: none; }
html[data-mode="dark"] .auth-pin { color: color-mix(in srgb, var(--p) 45%, #fff); }
.auth-pin:hover, .auth-pin:focus-visible { border-color: var(--p); background: var(--auth-field); outline: none; }

.auth-themes { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.auth-tdot { width: 24px; height: 24px; 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);
  transition: transform .12s, box-shadow .12s; }
.auth-tdot:hover { transform: translateY(-2px) scale(1.08); }
.auth-tdot.on { box-shadow: 0 0 0 2px var(--p); transform: scale(1.12); }

.auth-foot { margin-top: 18px; 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: .74rem; color: var(--auth-muted); }
.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, .auth-mode:focus-visible { color: var(--auth-ink); border-color: var(--p); outline: none; }

/* language pills — staff-i18n renders Bootstrap-class markup; these pages have no Bootstrap */
.auth-lang .btn-group { display: inline-flex; background: var(--auth-field); 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: 700;
  line-height: 1; color: var(--auth-muted); padding: .38rem .72rem; border-radius: 999px; min-height: 30px; }
.auth-lang .btn:hover { color: var(--auth-ink); }
.auth-lang .btn.btn-secondary { background: var(--p); color: #fff; }

/* ── first-run setup ────────────────────────────────────────────── */
.auth-banner { background: linear-gradient(135deg, var(--pdeep) 0%, var(--pd) 60%, var(--p) 100%); color: #fff;
  padding: .7rem 1.25rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.auth-banner .en { font-size: .72rem; opacity: .9; letter-spacing: .12em; text-transform: uppercase; }
.auth-head { text-align: center; margin-bottom: 1.2rem; }
.auth-head .mark { width: 64px; height: 64px; margin: 0 auto .8rem; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; background: linear-gradient(135deg, var(--p), var(--pdeep)); box-shadow: 0 6px 18px var(--auth-ring); }
.auth-head h1 { margin: 0 0 .25rem; }
.auth-auth { display: flex; gap: .6rem; margin-bottom: .9rem; }
.auth-auth > div { flex: 1; position: relative; }
.auth-auth input { position: absolute; opacity: 0; pointer-events: none; }
.auth-auth label { display: block; text-align: center; cursor: pointer; padding: .6rem .4rem; min-height: 44px;
  border: 1.5px solid var(--auth-line); border-radius: 10px; background: var(--auth-field);
  font-size: .85rem; font-weight: 600; color: var(--auth-text); }
.auth-auth input:checked + label { border-color: var(--p); background: var(--auth-card); color: var(--auth-ink); box-shadow: 0 0 0 3px var(--auth-ring); }
.auth-auth input:focus-visible + label { outline: 2px solid var(--p); outline-offset: 2px; }
.auth-setup-body { padding: 1.6rem 2rem 1.5rem; }
/* first-run setup: what is being set up (existing system / standalone POS / online POS) */
.auth-modes { display: grid; gap: .5rem; margin-bottom: 1rem; }
.auth-modes > div { position: relative; }
.auth-modes input { position: absolute; opacity: 0; pointer-events: none; }
.auth-modes label { display: block; cursor: pointer; padding: .65rem .8rem; min-height: 44px;
  border: 1.5px solid var(--auth-line); border-radius: 10px; background: var(--auth-field); color: var(--auth-text); }
.auth-modes label b { display: block; font-size: .88rem; font-weight: 700; color: var(--auth-ink); }
.auth-modes label span { font-size: .76rem; color: var(--auth-muted); }
.auth-modes label b span { font-size: inherit; color: inherit; }
.auth-modes input:checked + label { border-color: var(--p); background: var(--auth-card); box-shadow: 0 0 0 3px var(--auth-ring); }
.auth-modes input:focus-visible + label { outline: 2px solid var(--p); outline-offset: 2px; }
.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-bottom: .9rem; border: 1.5px solid var(--auth-line); border-radius: 10px; background: var(--auth-field); padding: .7rem .8rem; }
.auth-progress-head { display: flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 700; color: var(--auth-ink); }
.auth-pspin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--auth-line); border-top-color: var(--p);
  border-radius: 50%; animation: auth-pspin .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: .7rem; line-height: 1.45;
  color: var(--auth-muted); white-space: pre-wrap; text-align: left; }
@keyframes auth-pspin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

/* ── mobile ─────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  body.auth { padding: 14px; align-items: flex-start; padding-top: 4vh; }
  .auth-card { flex-direction: column; max-width: 440px; }
  .auth-brand { flex: none; padding: 28px 22px 24px; }
  .auth-logo { width: 58%; max-width: 190px; max-height: 120px; }
  .auth-mark { width: 72px; height: 72px; font-size: 1.6rem; border-radius: 20px; }
  .auth-name { font-size: 1.2rem; margin-top: 12px; }
  .auth-tag { font-size: .84rem; margin-top: 10px; }
  .auth-rule { margin: 12px auto 4px; }
  .auth-feats { display: none; }
  .auth-form { padding: 26px 20px 24px; }
  .auth-setup-body { padding: 1.3rem 1.1rem 1.2rem; }
  .auth-input input, .auth-ctl { font-size: 16px; }   /* no iOS zoom */
  .auth-row { flex-direction: column; }
}
