/* ===================================================================
   ShiftX — Design System
   Deep Slate / Navy base · Violet accent · RTL · Dark + Light
   =================================================================== */

:root {
  /* Light theme (default) */
  --bg:            #eef1f6;
  --bg-grad-a:     #eef1f6;
  --bg-grad-b:     #e6eaf2;
  --surface:       #ffffff;
  --surface-2:     #f6f8fb;
  --surface-3:     #eef1f6;
  --sidebar:       #0f1729;
  --sidebar-text:  #aeb9d0;
  --border:        rgba(15, 23, 41, 0.08);
  --border-strong: rgba(15, 23, 41, 0.14);
  --text:          #111a2e;
  --text-2:        #475069;
  --text-muted:    #8590a8;
  --accent:        #7c3aed;
  --accent-2:      #8b5cf6;
  --accent-soft:   rgba(124, 58, 237, 0.10);
  --accent-glow:   rgba(124, 58, 237, 0.28);
  --success:       #0f9d6a;
  --success-soft:  rgba(15, 157, 106, 0.12);
  --warn:          #d9870a;
  --warn-soft:     rgba(217, 135, 10, 0.12);
  --danger:        #dc3a4b;
  --danger-soft:   rgba(220, 58, 75, 0.12);
  --info:          #2a7de1;
  --info-soft:     rgba(42, 125, 225, 0.12);
  --shadow-sm:     0 1px 2px rgba(15,23,41,.06), 0 1px 3px rgba(15,23,41,.04);
  --shadow-md:     0 4px 12px rgba(15,23,41,.06), 0 12px 28px rgba(15,23,41,.05);
  --shadow-lg:     0 12px 32px rgba(15,23,41,.10), 0 24px 60px rgba(15,23,41,.10);
  --shadow-pop:    0 20px 60px rgba(15,23,41,.18);
  --ring:          rgba(124, 58, 237, 0.35);
  --card-radius:   18px;
  --scan:          #8b5cf6;
}

.dark {
  --bg:            #070b15;
  --bg-grad-a:     #0a1020;
  --bg-grad-b:     #070b15;
  --surface:       #0f1729;
  --surface-2:     #141d33;
  --surface-3:     #1b2641;
  --sidebar:       #0a0f1d;
  --sidebar-text:  #8e9bb8;
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text:          #eef2fb;
  --text-2:        #b3bdd6;
  --text-muted:    #6c7896;
  --accent:        #8b5cf6;
  --accent-2:      #a78bfa;
  --accent-soft:   rgba(139, 92, 246, 0.14);
  --accent-glow:   rgba(139, 92, 246, 0.40);
  --success:       #2ee6a0;
  --success-soft:  rgba(46, 230, 160, 0.13);
  --warn:          #fbbf3f;
  --warn-soft:     rgba(251, 191, 63, 0.13);
  --danger:        #ff6172;
  --danger-soft:   rgba(255, 97, 114, 0.14);
  --info:          #5aa2ff;
  --info-soft:     rgba(90, 162, 255, 0.14);
  --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
  --shadow-md:     0 8px 30px rgba(0,0,0,.45);
  --shadow-lg:     0 20px 50px rgba(0,0,0,.55);
  --shadow-pop:    0 24px 70px rgba(0,0,0,.6);
  --ring:          rgba(139, 92, 246, 0.5);
  --scan:          #a78bfa;
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

::selection { background: var(--accent-glow); color: #fff; }

/* Scrollbars */
.scroll-area { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll-area::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
.scroll-area::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: padding-box; }

/* ===== Theme transition ===== */
.theming, .theming * {
  transition: background-color .5s ease, color .5s ease, border-color .5s ease, box-shadow .5s ease !important;
}

/* ===================================================================
   LAYOUT SHELL
   =================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  background:
    radial-gradient(1200px 600px at 90% -10%, var(--accent-soft), transparent 60%),
    linear-gradient(160deg, var(--bg-grad-a), var(--bg-grad-b));
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: relative;
  border-inline-start: 1px solid rgba(255,255,255,.05);
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 100% 0%, rgba(139,92,246,.18), transparent 55%);
  pointer-events: none;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 26px 24px 22px;
  position: relative;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 22px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.3);
  font-weight: 700; color: #fff; flex-shrink: 0;
  position: relative; overflow: hidden;
}
.brand-mark span { font-size: 22px; line-height: 1; transform: translateY(-1px); }
.brand-mark::after {
  content:""; position:absolute; inset:0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%); animation: sheen 5s ease-in-out infinite;
}
@keyframes sheen { 0%,60% { transform: translateX(-120%);} 80%,100%{ transform: translateX(120%);} }
.brand-name { font-size: 21px; font-weight: 700; color: #fff; letter-spacing: -.3px; }
.brand-name b { color: var(--accent-2); }
.brand-sub { font-size: 11.5px; color: #6b7799; margin-top: 1px; letter-spacing: .2px; }

.nav { padding: 8px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 1.4px;
  color: #56627f; padding: 16px 12px 8px; text-transform: uppercase;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--sidebar-text); cursor: pointer;
  font-size: 14.5px; font-weight: 500;
  transition: color .2s, background .2s;
  user-select: none;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; transition: transform .25s; }
.nav-item .nav-badge {
  margin-inline-start: auto; font-size: 11px; font-weight: 700;
  background: var(--accent); color:#fff; min-width: 20px; height: 20px;
  border-radius: 99px; display:grid; place-items:center; padding: 0 6px;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-item:hover svg { transform: scale(1.08); }
.nav-item.active { color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; inset: 0; border-radius: 12px;
  background: linear-gradient(100deg, rgba(139,92,246,.28), rgba(139,92,246,.10));
  border: 1px solid rgba(139,92,246,.35);
  box-shadow: 0 6px 18px rgba(139,92,246,.25);
  z-index: 0;
}
.nav-item.active::after {
  content:""; position:absolute; inset-inline-start: -16px; top: 50%;
  width: 4px; height: 22px; border-radius: 99px; background: var(--accent-2);
  transform: translateY(-50%); box-shadow: 0 0 12px var(--accent-2);
}
.nav-item.active > * { position: relative; z-index: 1; }

.sidebar-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.06); }
.user-chip {
  display:flex; align-items:center; gap:11px; padding: 10px 12px;
  border-radius: 12px; cursor:pointer; transition: background .2s;
}
.user-chip:hover { background: rgba(255,255,255,.04); }
.user-avatar {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink:0;
  background: linear-gradient(140deg,#334063,#1c263f);
  display:grid; place-items:center; color:#cdd6ea; font-weight:600; font-size:14px;
  border: 1px solid rgba(255,255,255,.08);
}
.user-name { font-size: 13.5px; color: #e7ecf7; font-weight: 600; }
.user-role { font-size: 11.5px; color:#697694; }

/* ===== Main column ===== */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  backdrop-filter: blur(12px);
  position: relative; z-index: 5;
}
.page-title h1 { font-size: 21px; font-weight: 700; margin: 0; letter-spacing: -.4px; }
.page-title p { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }

.searchbox {
  margin-inline-start: auto;
  display:flex; align-items:center; gap:9px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 14px; width: 280px;
  color: var(--text-muted); transition: border-color .2s, box-shadow .2s;
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.searchbox input { border: none; background: none; outline: none; color: var(--text); font-family: inherit; font-size: 13.5px; width: 100%; }
.searchbox input::placeholder { color: var(--text-muted); }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  display:grid; place-items:center; cursor:pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); transition: all .2s; position: relative;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn .dot { position:absolute; top:9px; inset-inline-end:10px; width:8px; height:8px; border-radius:99px; background: var(--danger); border: 2px solid var(--surface); }

.page {
  flex: 1; overflow-y: auto; padding: 32px;
  animation: pageIn .5s cubic-bezier(.2,.7,.2,1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================================
   PRIMITIVES
   =================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }

.btn {
  display: inline-flex; align-items:center; justify-content:center; gap: 9px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; transition: all .18s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; box-shadow: 0 8px 20px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 28px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { background: var(--accent); color:#fff; }
.btn-success { background: var(--success); color: #04150e; }
.btn-success:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: var(--danger); color:#fff; }

.badge {
  display:inline-flex; align-items:center; gap:6px;
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 99px;
  border: 1px solid transparent;
}
.badge .dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.badge-success { color: var(--success); background: var(--success-soft); }
.badge-warn    { color: var(--warn);    background: var(--warn-soft); }
.badge-danger  { color: var(--danger);  background: var(--danger-soft); }
.badge-info    { color: var(--info);    background: var(--info-soft); }
.badge-accent  { color: var(--accent);  background: var(--accent-soft); }
.badge-muted   { color: var(--text-muted); background: var(--surface-3); }

.chip {
  display:inline-flex; align-items:center; gap:7px; padding: 6px 12px;
  border-radius: 10px; font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  cursor: pointer; transition: all .18s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.avatar {
  border-radius: 50%; display:grid; place-items:center;
  font-weight: 600; color:#fff; flex-shrink:0; position: relative;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.12);
}

/* ===== Table ===== */
.tbl-wrap { overflow-x: auto; border-radius: var(--card-radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl thead th {
  text-align: start; font-weight: 600; font-size: 12px; letter-spacing: .3px;
  color: var(--text-muted); text-transform: uppercase;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); position: sticky; top: 0; z-index: 2;
  white-space: nowrap;
}
table.tbl tbody td { padding: 15px 18px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
table.tbl tbody tr { transition: background .15s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.cell-strong { color: var(--text); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ===================================================================
   AUTH / LOGIN
   =================================================================== */
.auth {
  height: 100vh; width: 100%;
  display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--bg); overflow: hidden;
}
.auth-brand {
  position: relative; overflow: hidden;
  background: linear-gradient(155deg, #0c1226 0%, #0a0f1d 55%, #120a2e 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 54px 56px; color: #e7ecf7;
}
.auth-brand::before {
  content:""; position:absolute; width: 520px; height: 520px; border-radius: 50%;
  top: -160px; inset-inline-end: -140px;
  background: radial-gradient(circle, rgba(139,92,246,.45), transparent 65%);
  filter: blur(20px); animation: floatOrb 11s ease-in-out infinite;
}
.auth-brand::after {
  content:""; position:absolute; width: 420px; height: 420px; border-radius: 50%;
  bottom: -160px; inset-inline-start: -120px;
  background: radial-gradient(circle, rgba(42,125,225,.30), transparent 65%);
  filter: blur(20px); animation: floatOrb 13s ease-in-out infinite reverse;
}
@keyframes floatOrb { 0%,100%{ transform: translateY(0) scale(1);} 50%{ transform: translateY(26px) scale(1.06);} }
.auth-brand .grid-tex {
  position:absolute; inset:0; opacity:.5; pointer-events:none;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 60% 40%, #000, transparent 75%);
  mask-image: radial-gradient(circle at 60% 40%, #000, transparent 75%);
}
.auth-brand .ab-top { position: relative; z-index: 2; display:flex; align-items:center; gap:14px; }
.auth-brand .ab-mid { position: relative; z-index: 2; }
.auth-brand .ab-foot { position: relative; z-index: 2; font-size: 12.5px; color:#697694; }
.auth-headline { font-size: 40px; font-weight: 700; line-height: 1.25; letter-spacing: -1px; margin: 0 0 16px; }
.auth-headline b { color: var(--accent-2); }
.auth-sub { font-size: 16px; color: #aeb9d0; line-height: 1.8; max-width: 440px; margin: 0 0 34px; }
.auth-feats { display:flex; flex-direction:column; gap: 16px; max-width: 420px; }
.auth-feat { display:flex; align-items:center; gap: 14px; }
.auth-feat .fi {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink:0;
  display:grid; place-items:center; color: var(--accent-2);
  background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.22);
}
.auth-feat .ft { font-size: 14.5px; font-weight: 600; color: #dbe2f2; }
.auth-feat .fs { font-size: 12.5px; color: #7e8aa6; margin-top: 1px; }

.auth-form-wrap { display:grid; place-items:center; padding: 40px; position: relative; }
.auth-card { width: 100%; max-width: 396px; animation: fadeUp .6s cubic-bezier(.2,.7,.2,1); }
.auth-card h1 { font-size: 27px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.5px; }
.auth-card .lead { font-size: 14.5px; color: var(--text-muted); margin: 0 0 30px; }
.auth-input-ico { position: relative; }
.auth-input-ico > svg:first-child { position:absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events:none; }
.auth-input-ico .input { padding-inline-start: 42px; padding-block: 13px; }
.auth-input-ico .eye { position:absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 8px; display:grid; place-items:center; color: var(--text-muted); cursor:pointer; background:none; border:none; }
.auth-input-ico .eye:hover { color: var(--text); }
.auth-or { display:flex; align-items:center; gap: 14px; margin: 22px 0; color: var(--text-muted); font-size: 12.5px; }
.auth-or::before, .auth-or::after { content:""; height:1px; flex:1; background: var(--border); }
.auth-check { display:flex; align-items:center; gap: 9px; font-size: 13.5px; color: var(--text-2); cursor:pointer; user-select:none; }
.auth-check input { width: 17px; height: 17px; accent-color: var(--accent); cursor:pointer; }
.auth-link { font-size: 13.5px; color: var(--accent); font-weight: 600; cursor:pointer; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.btn-block { width: 100%; padding-block: 13px; }
.spin-ico { animation: spin 0.9s linear infinite; }

/* Face login overlay */
.face-login {
  position:absolute; inset:0; z-index: 20; display:grid; place-items:center;
  background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(10px);
  animation: fadeIn .3s ease;
}
.face-scan-disc {
  width: 200px; height: 200px; border-radius: 50%; position: relative;
  display:grid; place-items:center; margin: 0 auto;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
}
.face-scan-disc .ring2 { position:absolute; inset: 0; border-radius:50%; border: 2px dashed var(--accent); animation: spin 6s linear infinite; opacity:.6; }
.face-scan-disc .ring3 { position:absolute; inset: 18px; border-radius:50%; border: 2px solid var(--accent-soft); }
.face-scan-disc .sweep { position:absolute; inset: 18px; border-radius:50%; overflow:hidden; }
.face-scan-disc .sweep::after { content:""; position:absolute; left:0; right:0; height: 40%; top: -40%; background: linear-gradient(transparent, var(--accent-glow)); animation: faceSweep 1.8s ease-in-out infinite; }
@keyframes faceSweep { 0%{ top:-40%;} 100%{ top:100%; } }

.auth-theme { position:absolute; top: 24px; inset-inline-end: 24px; z-index: 5; }

@media (max-width: 880px) { .auth { grid-template-columns: 1fr; } .auth-brand { display:none; } }

/* ===================================================================
   ANIMATIONS
   =================================================================== */
@keyframes fadeUp { from { opacity:0; transform: translateY(16px);} to { opacity:1; transform:none; } }
@keyframes fadeIn { from { opacity:0;} to { opacity:1; } }
@keyframes scaleIn { from { opacity:0; transform: scale(.96);} to { opacity:1; transform:none; } }
@keyframes popIn { 0%{opacity:0; transform: scale(.9) translateY(8px);} 60%{transform: scale(1.01) translateY(0);} 100%{opacity:1; transform:none;} }
.stagger > * { opacity: 0; animation: fadeUp .55s cubic-bezier(.2,.7,.2,1) forwards; }
.stagger > *:nth-child(1){ animation-delay: .04s; }
.stagger > *:nth-child(2){ animation-delay: .10s; }
.stagger > *:nth-child(3){ animation-delay: .16s; }
.stagger > *:nth-child(4){ animation-delay: .22s; }
.stagger > *:nth-child(5){ animation-delay: .28s; }
.stagger > *:nth-child(6){ animation-delay: .34s; }

/* ===== Stat card ===== */
.stat {
  position: relative; overflow: hidden;
  padding: 22px 24px; border-radius: var(--card-radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s, border-color .25s;
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat::after {
  content:""; position:absolute; inset-inline-end:-30px; top:-30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--stat-glow, var(--accent-glow)), transparent 70%);
  opacity: .5; pointer-events: none;
}
.stat-ico {
  width: 46px; height: 46px; border-radius: 13px; display:grid; place-items:center;
  margin-bottom: 16px; background: var(--stat-soft, var(--accent-soft)); color: var(--stat-c, var(--accent));
}
.stat-ico svg { width: 23px; height: 23px; }
.stat-val { font-size: 31px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat-val small { font-size: 15px; font-weight: 600; color: var(--text-muted); margin-inline-start: 4px; }
.stat-label { font-size: 13.5px; color: var(--text-muted); margin-top: 7px; font-weight: 500; }
.stat-trend { display:inline-flex; align-items:center; gap:4px; font-size:12.5px; font-weight:600; margin-top:12px; }

/* ===== Chart ===== */
.bar-track { position: relative; }
.bar {
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(to top, var(--accent), var(--accent-2));
  transition: height 1s cubic-bezier(.2,.8,.2,1);
  position: relative; box-shadow: 0 -2px 12px var(--accent-glow);
}
.bar.ghost { background: var(--surface-3); box-shadow:none; }

/* ===== Face Desk ===== */
.cam-stage {
  position: relative; border-radius: 22px; overflow: hidden;
  background: #05070d; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.cam-stage video { width: 100%; height: 100%; object-fit: cover; display:block; transform: scaleX(-1); }
.scan-overlay { position: absolute; inset: 0; pointer-events: none; }
.scan-line {
  position: absolute; left: 8%; right: 8%; height: 3px; top: 0;
  background: linear-gradient(90deg, transparent, var(--scan), transparent);
  box-shadow: 0 0 22px 4px var(--scan); border-radius: 99px;
  animation: scanY 2.6s cubic-bezier(.5,0,.5,1) infinite;
}
@keyframes scanY { 0%{ top: 12%; opacity:0;} 12%{opacity:1;} 88%{opacity:1;} 100%{ top: 88%; opacity:0; } }
.face-frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(46%, 280px); aspect-ratio: 3/3.4;
}
.face-frame .corner { position:absolute; width: 34px; height: 34px; border: 3px solid var(--scan); }
.face-frame .corner.tl { top:0; left:0; border-right:none; border-bottom:none; border-radius: 14px 0 0 0; }
.face-frame .corner.tr { top:0; right:0; border-left:none; border-bottom:none; border-radius: 0 14px 0 0; }
.face-frame .corner.bl { bottom:0; left:0; border-right:none; border-top:none; border-radius: 0 0 0 14px; }
.face-frame .corner.br { bottom:0; right:0; border-left:none; border-top:none; border-radius: 0 0 14px 0; }
.face-frame::before {
  content:""; position:absolute; inset:-6px; border-radius: 24px;
  border: 1.5px dashed rgba(139,92,246,.4); animation: spin 22s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pulse-ring { animation: pulseRing 1.6s ease-out infinite; }
@keyframes pulseRing { 0%{ box-shadow: 0 0 0 0 var(--accent-glow);} 70%{ box-shadow: 0 0 0 18px transparent;} 100%{ box-shadow:0 0 0 0 transparent;} }

.cam-hud { position:absolute; pointer-events:none; }
.hud-tl { top: 16px; inset-inline-start: 16px; }
.hud-tr { top: 16px; inset-inline-end: 16px; }
.hud-bl { bottom: 16px; inset-inline-start: 16px; }
.hud-chip {
  display:inline-flex; align-items:center; gap:8px; padding: 7px 13px; border-radius: 10px;
  background: rgba(7,11,21,.6); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.12);
  color: #dbe2f2; font-size: 12.5px; font-weight: 600;
}
.rec-dot { width: 9px; height:9px; border-radius:99px; background: #ff5a5a; animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* match success flash */
.match-flash { position:absolute; inset:0; pointer-events:none; }
.match-flash.show { animation: flashOk .8s ease-out; }
@keyframes flashOk { 0%{ background: rgba(46,230,160,0); box-shadow: inset 0 0 0 0 var(--success);} 25%{ background: rgba(46,230,160,.14); box-shadow: inset 0 0 0 6px var(--success);} 100%{ background: rgba(46,230,160,0); box-shadow: inset 0 0 0 0 transparent;} }

/* feed row */
.feed-row {
  display:flex; align-items:center; gap:13px; padding: 13px 16px;
  border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
  animation: feedIn .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes feedIn { from { opacity:0; transform: translateX(-18px) scale(.98);} to { opacity:1; transform:none; } }

/* ===== Toast ===== */
.toast-host { position: fixed; bottom: 28px; inset-inline-end: 28px; z-index: 9999; display:flex; flex-direction:column; gap:12px; align-items: flex-end; }
.toast {
  display:flex; align-items:center; gap:14px; padding: 14px 18px 14px 16px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop); min-width: 320px; max-width: 380px;
  animation: toastIn .55s cubic-bezier(.18,.9,.25,1.3);
  position: relative; overflow: hidden;
}
.toast.out { animation: toastOut .4s ease forwards; }
@keyframes toastIn { from { opacity:0; transform: translateX(40px) scale(.92);} to { opacity:1; transform:none; } }
@keyframes toastOut { to { opacity:0; transform: translateX(40px) scale(.95);} }
.toast .t-bar { position:absolute; bottom:0; inset-inline-start:0; height:3px; background: var(--success); animation: tbar 3.2s linear forwards; }
@keyframes tbar { from { width:100%;} to { width:0%; } }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5,8,15,.55); backdrop-filter: blur(6px);
  display:grid; place-items:center; padding: 24px;
  animation: fadeIn .25s ease;
}
.modal {
  width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 22px; box-shadow: var(--shadow-pop);
  animation: popIn .4s cubic-bezier(.18,.9,.25,1.15);
}

/* form */
.field { margin-bottom: 16px; }
.field label { display:block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.input, .select {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder { color: var(--text-muted); }

/* range slider styling */
input[type=range].rng { -webkit-appearance: none; appearance:none; width:100%; height: 6px; border-radius:99px; background: var(--surface-3); outline:none; }
input[type=range].rng::-webkit-slider-thumb { -webkit-appearance:none; width: 20px; height:20px; border-radius:50%; background: var(--accent); cursor:pointer; box-shadow: 0 2px 8px var(--accent-glow), 0 0 0 4px var(--surface); border: none; transition: transform .15s; }
input[type=range].rng::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* segmented */
.seg { display:inline-flex; background: var(--surface-2); border:1px solid var(--border); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { font-family:inherit; border:none; background:none; color: var(--text-muted); font-size:13px; font-weight:600; padding: 7px 15px; border-radius: 9px; cursor:pointer; transition: all .18s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.dark .seg button.on { background: var(--surface-3); }

.divider { height:1px; background: var(--border); border:none; margin: 0; }

/* dropzone */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 16px; padding: 26px;
  display:flex; flex-direction:column; align-items:center; gap:10px; text-align:center;
  cursor: pointer; transition: all .2s; background: var(--surface-2);
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }

/* tooltip-ish progress ring uses svg */
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); }

/* misc */
.muted { color: var(--text-muted); }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.grow-in { animation: scaleIn .4s ease; }
.hr-soft { height:1px; background: var(--border); margin: 0; border:none; }

.kpi-spark { display:flex; align-items:flex-end; gap:3px; height: 34px; }
.kpi-spark i { width: 5px; border-radius: 3px; background: var(--accent-soft); display:block; }
.kpi-spark i.hi { background: var(--accent); }

/* Reduced-motion / safety: never leave content permanently invisible */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; }
  .stagger > *, .feed-row, .page,
  .m-screen, .m-stagger > * { opacity: 1 !important; }
}

/* empty placeholder image (striped) */
.img-ph {
  background-image: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 10px, var(--surface-3) 10px, var(--surface-3) 20px);
  display:grid; place-items:center; color: var(--text-muted);
}
