/* Shared tokens + base for the interview (phones first) and the admin pages. Rules: design-system/fg-interview/MASTER.md */
@font-face { font-family: Vazirmatn; font-weight: 100 900; font-display: swap; src: url('/static/fonts/vazirmatn-arabic.woff2') format('woff2'); unicode-range: U+0600-06FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: Vazirmatn; font-weight: 100 900; font-display: swap; src: url('/static/fonts/vazirmatn-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  color-scheme: light;
  --bg: #F8FAFC; --surface: #FFFFFF; --surface-2: #F1F5F9; --border: #E2E8F0; --border-strong: #CBD5E1;
  --fg: #0F172A; --fg-2: #334155; --muted: #475569; --faint: #64748B;
  --primary: #0F766E; --primary-hover: #115E59; --on-primary: #FFFFFF; --primary-soft: #F0FDFA; --primary-ink: #0F766E;
  --user-bubble: #E6F4F1;
  --success: #047857; --success-soft: #ECFDF5; --warning: #B45309; --warning-soft: #FFFBEB;
  --danger: #B91C1C; --danger-soft: #FEF2F2; --focus: #0F766E;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06); --shadow-md: 0 4px 12px rgba(15, 23, 42, .08); --shadow-lg: 0 16px 40px rgba(15, 23, 42, .18);
  --r-ctl: 8px; --r-card: 12px; --r-sheet: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1220; --surface: #111A2B; --surface-2: #0F1726; --border: #1F2A3D; --border-strong: #2B3A52;
    --fg: #E2E8F0; --fg-2: #CBD5E1; --muted: #94A3B8; --faint: #8090A6;
    --primary: #2DD4BF; --primary-hover: #5EEAD4; --on-primary: #042F2E; --primary-soft: #0B2E2C; --primary-ink: #5EEAD4;
    --user-bubble: #12302E;
    --success: #34D399; --success-soft: #052E22; --warning: #FBBF24; --warning-soft: #2E2108;
    --danger: #F87171; --danger-soft: #2D1214; --focus: #5EEAD4;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .35); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1220; --surface: #111A2B; --surface-2: #0F1726; --border: #1F2A3D; --border-strong: #2B3A52;
  --fg: #E2E8F0; --fg-2: #CBD5E1; --muted: #94A3B8; --faint: #8090A6;
  --primary: #2DD4BF; --primary-hover: #5EEAD4; --on-primary: #042F2E; --primary-soft: #0B2E2C; --primary-ink: #5EEAD4;
  --user-bubble: #12302E;
  --success: #34D399; --success-soft: #052E22; --warning: #FBBF24; --warning-soft: #2E2108;
  --danger: #F87171; --danger-soft: #2D1214; --focus: #5EEAD4;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .35); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 16px/1.8 Vazirmatn, Tahoma, sans-serif; font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.45; margin: 0; font-weight: 700; }
p { margin: 0 0 .6em; }
a { color: var(--primary-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--r-ctl); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--fg); font-weight: 600; font-size: 15px; line-height: 1.4;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary-ink); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-weight: 600; font-size: 15px; color: var(--fg-2); }
.field .hint { font-size: 13px; color: var(--muted); line-height: 1.6; }
.field .err { font-size: 13px; color: var(--danger); line-height: 1.6; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-inline-end: 52px; }
.pw-wrap .eye {
  position: absolute; inset-inline-end: 2px; top: 2px; width: 44px; height: 44px; border: 0; background: none;
  color: var(--muted); display: grid; place-items: center; border-radius: var(--r-ctl);
}
.pw-wrap .eye svg { width: 20px; height: 20px; }

.alert { border-radius: var(--r-ctl); padding: 10px 14px; font-size: 14px; line-height: 1.7; margin-bottom: 16px;
  display: flex; gap: 10px; align-items: flex-start; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--primary-soft); color: var(--primary-ink); }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent;
  animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; inset-inline-start: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 80;
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: var(--r-ctl); font-size: 14px;
  box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
