/* Smart Dismissal Pro — design system. Developed by Noveqtech. */
:root {
  --font: 'Plus Jakarta Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'Plus Jakarta Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --r-sm: 8px; --r: 14px; --r-lg: 20px; --r-xl: 28px;
  --gold: #f2b705; --gold-2: #ffd34d; --gold-ink: #6b4a00; --gold-bg: #fff6d6;
  --ok: #10b981; --ok-bg: #e7f8f1; --warn: #f59e0b; --warn-bg: #fff4e0; --bad: #ef4444; --bad-bg: #fdecec; --info: #3b82f6; --info-bg: #e8f0fe;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow: 0 10px 30px -12px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .06);
  --shadow-lg: 0 30px 60px -20px rgba(16, 24, 40, .35);
  --sidebar-w: 268px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* light base */
  --bg: #f4f6fb; --bg-2: #eef1f8; --surface: rgba(255, 255, 255, .78); --surface-solid: #fff; --surface-2: #f7f8fc;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --line: rgba(15, 23, 42, .08); --line-2: rgba(15, 23, 42, .14);
  --glass-blur: saturate(160%) blur(18px);
  color-scheme: light;
}

/* ---------- Themes (brand, secondary, glow) ---------- */
[data-theme="navy"]     { --brand: #1d3a8a; --brand-2: #3b82f6; --brand-3: #0ea5e9; --brand-soft: #e6edff; --on-brand: #fff; }
[data-theme="emerald"]  { --brand: #047857; --brand-2: #10b981; --brand-3: #84cc16; --brand-soft: #e3f8ef; --on-brand: #fff; }
[data-theme="purple"]   { --brand: #5b21b6; --brand-2: #8b5cf6; --brand-3: #ec4899; --brand-soft: #f0e9ff; --on-brand: #fff; }
[data-theme="graphite"] { --brand: #1f2937; --brand-2: #4b5563; --brand-3: #0ea5e9; --brand-soft: #eceff3; --on-brand: #fff; }
[data-theme="aquatic"]  { --brand: #0369a1; --brand-2: #06b6d4; --brand-3: #22d3ee; --brand-soft: #e0f6fc; --on-brand: #fff; }
[data-theme="sunrise"]  { --brand: #c2410c; --brand-2: #f97316; --brand-3: #facc15; --brand-soft: #fff0e3; --on-brand: #fff; }
[data-theme="aurora"]   { --brand: #4338ca; --brand-2: #06b6d4; --brand-3: #a855f7; --brand-soft: #ebeaff; --on-brand: #fff; }
[data-theme="blossom"]  { --brand: #be185d; --brand-2: #f472b6; --brand-3: #a78bfa; --brand-soft: #fde8f2; --on-brand: #fff; }
[data-theme="forest"]   { --brand: #166534; --brand-2: #65a30d; --brand-3: #ca8a04; --brand-soft: #e6f4e8; --on-brand: #fff; }
[data-theme="coral"]    { --brand: #be123c; --brand-2: #fb7185; --brand-3: #fb923c; --brand-soft: #ffe8eb; --on-brand: #fff; }
[data-theme="midnight"] { --brand: #6d28d9; --brand-2: #22d3ee; --brand-3: #f0abfc; --brand-soft: #241b4a; --on-brand: #fff; }

/* ---------- Dark appearance ---------- */
[data-mode="dark"] {
  --bg: #070b17; --bg-2: #0c1222; --surface: rgba(17, 24, 43, .72); --surface-solid: #111a2e; --surface-2: #151f36;
  --text: #e8ecf6; --text-2: #c3cbe0; --muted: #8a96b3; --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .16);
  --brand-soft: color-mix(in oklab, var(--brand-2) 18%, transparent);
  --gold-bg: rgba(242, 183, 5, .14); --gold-ink: #ffd76a;
  --ok-bg: rgba(16, 185, 129, .15); --warn-bg: rgba(245, 158, 11, .16); --bad-bg: rgba(239, 68, 68, .16); --info-bg: rgba(59, 130, 246, .16);
  --shadow: 0 16px 40px -18px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
[data-mode="dark"][data-theme="graphite"] { --brand: #94a3b8; --brand-2: #cbd5e1; --on-brand: #0b1020; }
[data-mode="dark"][data-theme="navy"] { --brand: #3b82f6; }
[data-mode="dark"][data-theme="emerald"] { --brand: #10b981; }
[data-mode="dark"][data-theme="purple"] { --brand: #8b5cf6; }
[data-mode="dark"][data-theme="forest"] { --brand: #22a050; }
[data-mode="dark"][data-theme="aurora"] { --brand: #6366f1; }
[data-mode="dark"][data-theme="aquatic"] { --brand: #0ea5e9; }
[data-mode="dark"][data-theme="sunrise"] { --brand: #f97316; }
[data-mode="dark"][data-theme="blossom"] { --brand: #ec4899; }
[data-mode="dark"][data-theme="coral"] { --brand: #f43f5e; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
[dir="rtl"] body, [dir="rtl"] { font-family: var(--font-ar); }
body::before {
  content: ''; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vmax 40vmax at 12% 8%, color-mix(in oklab, var(--brand-2) 22%, transparent), transparent 60%),
    radial-gradient(36vmax 36vmax at 92% 12%, color-mix(in oklab, var(--brand-3) 18%, transparent), transparent 60%),
    radial-gradient(44vmax 44vmax at 70% 100%, color-mix(in oklab, var(--brand) 16%, transparent), transparent 60%);
  animation: drift 28s var(--ease) infinite alternate;
}
[data-mode="dark"] body::before { opacity: .9; }
@keyframes drift { to { transform: translate3d(2vmax, -2vmax, 0) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 750; }
h3 { font-size: 15.5px; font-weight: 700; }
p { margin: 0; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; background: var(--surface); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-inline-end: 1px solid var(--line); z-index: 30; overflow-y: auto; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 16px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--on-brand); font-weight: 800; letter-spacing: -.03em;
  box-shadow: 0 8px 20px -8px color-mix(in oklab, var(--brand) 70%, transparent);
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-name { font-weight: 800; font-size: 14.5px; line-height: 1.15; }
.brand-sub { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 8px 12px 6px; }
[dir="rtl"] .nav-label { letter-spacing: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; color: var(--text-2);
  font-weight: 600; cursor: pointer; transition: background .2s, color .2s, transform .2s var(--ease); position: relative; user-select: none;
}
.nav-item:hover { background: var(--brand-soft); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, var(--brand), color-mix(in oklab, var(--brand) 70%, var(--brand-2))); color: var(--on-brand); box-shadow: 0 10px 24px -12px var(--brand); }
.nav-item .badge { margin-inline-start: auto; }
.nav-item.active .badge { background: rgba(255, 255, 255, .25); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }
.sidebar-foot b { color: var(--text-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: color-mix(in oklab, var(--bg) 70%, transparent); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; }
.topbar .crumb { font-size: 12px; color: var(--muted); font-weight: 600; }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 60px; max-width: 1480px; width: 100%; margin: 0 auto; animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.btn.menu-btn { display: none; }

.live {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
}
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in oklab, var(--ok) 60%, transparent); animation: ping 2s infinite; }
.live.off .dot { background: var(--bad); animation: none; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Primitives ---------- */
.card {
  background: var(--surface); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px; min-width: 0;
}
.card.pad-0 { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h .spacer { flex: 1; }
.card-h p { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.mt { margin-top: 18px; } .mt-s { margin-top: 10px; } .mb { margin-bottom: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface-solid); color: var(--text); font: inherit; font-weight: 650; font-size: 13.5px;
  cursor: pointer; transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s; white-space: nowrap; user-select: none;
}
.btn:hover { border-color: color-mix(in oklab, var(--brand) 45%, var(--line-2)); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.primary { background: linear-gradient(135deg, var(--brand), color-mix(in oklab, var(--brand) 65%, var(--brand-2))); color: var(--on-brand); border-color: transparent; box-shadow: 0 10px 22px -12px var(--brand); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.gold { background: linear-gradient(135deg, #f7c531, #f2a900); color: #3d2a00; border-color: transparent; box-shadow: 0 10px 22px -12px #c98d00; }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--brand-soft); box-shadow: none; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 10px; }
.btn.lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--text-2); min-width: 0; }
label.f .hint { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-solid);
  color: var(--text); font: inherit; font-size: 14px; transition: border-color .2s, box-shadow .2s; outline: none; min-width: 0;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 13px; resize: vertical; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand-2) 18%, transparent); }
.input.err { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.input.sm { height: 34px; font-size: 13px; border-radius: 10px; }
.input-icon { position: relative; flex: 1; min-width: 180px; }
.input-icon > svg { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-inline-start: 40px; }
.search-xl .input { height: 58px; font-size: 18px; border-radius: 18px; padding-inline-start: 52px; box-shadow: var(--shadow); }
.search-xl > svg { inset-inline-start: 18px; width: 22px; height: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; user-select: none; }
.switch input { appearance: none; width: 40px; height: 23px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--brand-2); }
.switch input:checked::after { transform: translateX(17px); }
[dir="rtl"] .switch input:checked::after { transform: translateX(-17px); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2);
  background: var(--surface-solid); font-weight: 650; font-size: 12.5px; cursor: pointer; transition: all .2s; white-space: nowrap; color: var(--text-2);
}
.chip:hover { border-color: var(--brand-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip .n { font-size: 11px; opacity: .75; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 11.5px; font-weight: 750; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.in_class { background: var(--info-bg); color: var(--info); }
.pill.called { background: var(--gold-bg); color: var(--gold-ink); }
.pill.dismissed { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: #b45309; }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }
[data-mode="dark"] .pill.warn { color: #fbbf24; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 800; background: var(--gold); color: #3d2a00; }
.badge.soft { background: var(--brand-soft); color: var(--brand); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); transition: all .2s; display: inline-flex; gap: 7px; align-items: center; user-select: none; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }

.table-wrap { overflow: auto; border-radius: var(--r); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th { text-align: start; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 750; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
[dir="rtl"] table.t th { letter-spacing: 0; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .15s; }
table.t tbody tr:hover { background: color-mix(in oklab, var(--brand-soft) 55%, transparent); }
table.t tr.click { cursor: pointer; }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who .nm { font-weight: 700; line-height: 1.25; }
.who .sub { font-size: 12px; color: var(--muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none;
  background: linear-gradient(135deg, color-mix(in oklab, var(--brand-2) 25%, var(--surface-solid)), color-mix(in oklab, var(--brand-3) 25%, var(--surface-solid))); color: var(--brand);
}
.avatar.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }

/* ---------- KPI ---------- */
.kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
.kpi .lbl { padding-inline-end: 48px; font-size: 12.5px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kpi .val { font-size: 32px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .ico { position: absolute; top: 16px; inset-inline-end: 16px; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi.gold .ico { background: var(--gold-bg); color: var(--gold-ink); }
.kpi.gold .val { color: color-mix(in oklab, var(--gold-ink) 80%, var(--gold)); }
.kpi.ok .ico { background: var(--ok-bg); color: var(--ok); }
.kpi.warn .ico { background: var(--warn-bg); color: #b45309; }
.kpi.info .ico { background: var(--info-bg); color: var(--info); }
.kpi.hero { background: linear-gradient(135deg, var(--brand), color-mix(in oklab, var(--brand) 55%, var(--brand-2))); color: var(--on-brand); border: 0; }
.kpi.hero .lbl, .kpi.hero .foot { color: rgba(255, 255, 255, .8); }
.kpi.hero .ico { background: rgba(255, 255, 255, .16); color: #fff; }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mini { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.mini .v { font-size: 22px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.mini .l { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.strip .mini { background: var(--surface); backdrop-filter: var(--glass-blur); }

.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; transition: width .6s var(--ease); }
.bar .b-ok { background: linear-gradient(90deg, var(--ok), #34d399); }
.bar .b-gold { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.bar .b-brand { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.ring { --p: 0; --size: 132px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--ring-c, #fff) calc(var(--p) * 1%), rgba(255, 255, 255, .18) 0); transition: --p .8s; }
.ring > div { width: calc(var(--size) - 22px); height: calc(var(--size) - 22px); border-radius: 50%; display: grid; place-items: center; text-align: center;
  background: color-mix(in oklab, var(--brand) 80%, #000 0%); }
.ring b { font-size: 30px; font-weight: 800; letter-spacing: -.04em; display: block; line-height: 1; }
.ring small { font-size: 11px; opacity: .8; font-weight: 700; }
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }

.class-row { display: grid; grid-template-columns: 110px 1fr 80px; gap: 12px; align-items: center; padding: 8px 0; }
.class-row .nm { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.class-row .ct { font-size: 12px; color: var(--muted); text-align: end; font-variant-numeric: tabular-nums; font-weight: 650; }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.feed-item:last-child { border: 0; }
.feed-item .dot { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.feed-item .dot.gold { background: var(--gold-bg); color: var(--gold-ink); }
.feed-item .dot.ok { background: var(--ok-bg); color: var(--ok); }
.feed-item .txt { font-size: 13px; line-height: 1.35; }
.feed-item .tm { font-size: 11.5px; color: var(--muted); }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 90px; padding-top: 6px; }
.spark > div { flex: 1; min-width: 6px; max-width: 28px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); position: relative; transition: height .6s var(--ease); }
.spark > div:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px); background: var(--text); color: var(--bg); font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; }
.donut { width: 120px; height: 120px; border-radius: 50%; flex: none; position: relative; }
.donut::after { content: ''; position: absolute; inset: 18px; border-radius: 50%; background: var(--surface-solid); }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 8px; }

.notice {
  display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: var(--r-lg); margin-bottom: 18px;
  background: linear-gradient(135deg, color-mix(in oklab, var(--brand-soft) 90%, transparent), color-mix(in oklab, var(--brand-3) 12%, transparent));
  border: 1px solid color-mix(in oklab, var(--brand-2) 25%, transparent); font-weight: 600; color: var(--text-2);
}
.notice .ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-solid); color: var(--brand); flex: none; }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.callout.warn { background: var(--warn-bg); border-color: color-mix(in oklab, var(--warn) 30%, transparent); }
.callout.bad { background: var(--bad-bg); border-color: color-mix(in oklab, var(--bad) 30%, transparent); }
.callout.ok { background: var(--ok-bg); border-color: color-mix(in oklab, var(--ok) 30%, transparent); }

/* ---------- Golden Called cards ---------- */
.gold-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.gold-card {
  position: relative; border-radius: var(--r-lg); padding: 16px; overflow: hidden; isolation: isolate;
  background: linear-gradient(140deg, #fff8dc 0%, #ffe9a6 55%, #ffd76a 100%); color: #3d2a00; border: 1px solid #f3c74a;
  box-shadow: 0 18px 36px -18px rgba(201, 141, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .7); animation: arrive .5s var(--ease);
}
[data-mode="dark"] .gold-card { background: linear-gradient(140deg, #3a2c05, #5a4106 60%, #7a5806); color: #fff3c4; border-color: #a77c0c; }
.gold-card::before { content: ''; position: absolute; inset: -40%; z-index: -1; background: conic-gradient(from 0deg, transparent 0 70%, rgba(255, 255, 255, .55) 80%, transparent 90%); animation: sheen 4.5s linear infinite; }
@keyframes sheen { to { transform: rotate(360deg); } }
@keyframes arrive { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.gold-card .nm { padding-inline-end: 58px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.gold-card .ar { font-size: 14px; font-weight: 600; opacity: .8; font-family: var(--font-ar); }
.gold-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; font-size: 12px; font-weight: 700; }
.gold-card .meta span { background: rgba(255, 255, 255, .55); padding: 3px 9px; border-radius: 99px; }
[data-mode="dark"] .gold-card .meta span { background: rgba(0, 0, 0, .25); }
.gold-card .elapsed { position: absolute; top: 14px; inset-inline-end: 14px; font-family: var(--mono); font-size: 12px; font-weight: 700; background: rgba(61, 42, 0, .1); padding: 3px 8px; border-radius: 8px; }
.gold-card .elapsed.late { background: #ef4444; color: #fff; }
.gold-card .btn { width: 100%; background: #3d2a00; color: #ffe08a; border: 0; height: 44px; font-size: 14px; }
[data-mode="dark"] .gold-card .btn { background: #ffd34d; color: #3d2a00; }
.gold-card.done { background: var(--ok-bg); border-color: color-mix(in oklab, var(--ok) 30%, transparent); color: var(--text); box-shadow: none; }
.gold-card.done::before { display: none; }

.stu-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-solid); transition: all .2s var(--ease); }
.stu-card:hover { border-color: color-mix(in oklab, var(--brand-2) 40%, var(--line)); box-shadow: var(--shadow-sm); }
.stu-card.sel { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-2) 18%, transparent); }
.stu-card.called { background: var(--gold-bg); border-color: #f3c74a; }
.stu-card .grow { flex: 1; min-width: 0; }
.stu-list { display: flex; flex-direction: column; gap: 8px; }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .art { width: 64px; height: 64px; border-radius: 22px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty h3 { color: var(--text); margin-bottom: 4px; }

/* ---------- Attendance ---------- */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--surface-solid); }
.seg button { border: 0; background: transparent; font: inherit; font-weight: 750; font-size: 12.5px; padding: 0 12px; height: 34px; cursor: pointer; color: var(--muted); border-inline-end: 1px solid var(--line); min-width: 42px; transition: all .15s; }
.seg button:last-child { border-inline-end: 0; }
.seg button.on.present { background: var(--ok); color: #fff; }
.seg button.on.absent { background: var(--bad); color: #fff; }
.seg button.on.late { background: var(--warn); color: #fff; }
.seg button.on.excused { background: var(--info); color: #fff; }
.period-chip { position: relative; }
.period-chip.done::after { content: ''; position: absolute; top: -3px; inset-inline-end: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface-solid); }
.reg-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) auto minmax(160px, 1fr); gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.reg-row:last-child { border-bottom: 0; }
.reg-row.need .input { border-color: var(--bad); }

/* ---------- Modal / drawer / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(8, 12, 28, .45); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface-solid); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: pop .3s var(--ease); overflow: hidden; }
.modal.wide { width: min(980px, 100%); }
.modal.xwide { width: min(1180px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 20px 24px 14px; }
.modal-h .spacer { flex: 1; }
.modal-b { padding: 6px 24px 20px; overflow: auto; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.overlay.drawer { place-items: stretch; justify-items: end; padding: 0; }
[dir="rtl"] .overlay.drawer { justify-items: start; }
.overlay.drawer .modal { height: 100vh; max-height: 100vh; border-radius: 0; width: min(620px, 100%); animation: slide .35s var(--ease); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.toasts { position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 650; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: pop .3s var(--ease); max-width: 420px; }
.toast.ok svg { color: #34d399; } .toast.bad svg { color: #f87171; } .toast.gold svg { color: var(--gold-2); }
.palette { width: min(640px, 100%); align-self: start; margin-top: 10vh; }
.palette .input { height: 56px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 17px; padding: 0 22px; box-shadow: none !important; }
.pal-list { max-height: 50vh; overflow: auto; padding: 8px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.pal-item.on, .pal-item:hover { background: var(--brand-soft); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); }
.dropdown { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 230px; background: var(--surface-solid); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; animation: pop .2s var(--ease); }
.dropdown .di { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.dropdown .di:hover { background: var(--brand-soft); }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.rel { position: relative; }

/* ---------- Theme gallery ---------- */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-tile { border-radius: 16px; border: 2px solid var(--line); padding: 10px; cursor: pointer; background: var(--surface-solid); transition: all .2s; }
.theme-tile.on { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.theme-tile .sw { height: 56px; border-radius: 10px; margin-bottom: 8px; position: relative; overflow: hidden; }
.theme-tile .sw::after { content: ''; position: absolute; inset: auto 8px 8px 8px; height: 10px; border-radius: 4px; background: rgba(255, 255, 255, .6); }
.theme-tile b { font-size: 12.5px; }

.code { font-family: var(--mono); font-size: 12px; background: #0b1020; color: #cfe3ff; border-radius: 14px; padding: 14px; max-height: 320px; overflow: auto; white-space: pre; direction: ltr; text-align: left; }
.qr-box { display: grid; place-items: center; padding: 18px; background: #fff; border-radius: 18px; border: 1px solid var(--line); }
.qr-box svg, .qr-box img { width: 220px; height: 220px; }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 34px; text-align: center; cursor: pointer; transition: all .2s; background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--brand-2); background: var(--brand-soft); }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12.5px; color: var(--muted); }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12px; }
.step.on { color: var(--text); } .step.on .n { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.step.done .n { background: var(--ok); color: #fff; border-color: var(--ok); }
.step + .step::before { content: ''; width: 22px; height: 2px; background: var(--line-2); border-radius: 2px; }
.map-row { display: grid; grid-template-columns: 1fr 24px 1fr; gap: 10px; align-items: center; padding: 6px 0; }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Auth screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; padding: 48px; color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(60% 60% at 20% 20%, var(--brand-2), transparent 70%), radial-gradient(60% 60% at 90% 80%, var(--brand-3), transparent 70%), linear-gradient(140deg, var(--brand), #0b1020); }
.auth-art::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent); pointer-events: none; }
.auth-art h2 { font-size: 40px; line-height: 1.08; letter-spacing: -.04em; font-weight: 800; max-width: 560px; }
.auth-art .feat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; position: relative; z-index: 1; }
.auth-art .feat div { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); border-radius: 16px; padding: 14px; backdrop-filter: blur(10px); font-weight: 650; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.orb { position: absolute; width: 380px; height: 380px; border-radius: 50%; right: -90px; top: 18%; background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .9), var(--gold-2) 25%, var(--gold) 45%, transparent 70%); filter: blur(2px); opacity: .55; animation: float 9s ease-in-out infinite alternate; }
@keyframes float { to { transform: translate(-30px, 40px) scale(1.06); } }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 30px; margin: 18px 0 6px; }

/* ---------- Display board ---------- */
.board { min-height: 100vh; padding: 28px 36px; color: #fff; background: radial-gradient(70% 70% at 10% 0%, color-mix(in oklab, var(--brand-2) 55%, transparent), transparent), radial-gradient(60% 60% at 100% 100%, color-mix(in oklab, var(--brand-3) 45%, transparent), transparent), #050816; }
.board-h { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.board-h .clock { margin-inline-start: auto; font-family: var(--mono); font-size: 46px; font-weight: 700; letter-spacing: -.03em; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.board-card { border-radius: 24px; padding: 22px 24px; background: linear-gradient(140deg, rgba(255, 215, 106, .22), rgba(242, 183, 5, .08)); border: 1px solid rgba(255, 215, 106, .45); box-shadow: 0 0 40px -10px rgba(242, 183, 5, .5); animation: arrive .5s var(--ease); }
.board-card .nm { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.board-card .ar { font-size: 22px; opacity: .85; font-family: var(--font-ar); margin-top: 4px; }
.board-card .cl { display: inline-block; margin-top: 14px; padding: 6px 14px; border-radius: 99px; background: #ffd34d; color: #3d2a00; font-weight: 800; font-size: 16px; }

/* ---------- Parent portal ---------- */
.portal { min-height: 100vh; padding: 24px 16px 40px; display: flex; justify-content: center; }
.portal-card { width: min(480px, 100%); }
.portal-head { text-align: center; padding: 26px 18px 18px; }
.portal-head .brand-logo { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 12px; font-size: 24px; }
.kid { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface-solid); cursor: pointer; transition: all .2s var(--ease); }
.kid.sel { border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand-2) 16%, transparent); }
.kid .tick { width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; }
.kid.sel .tick { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.kid.locked { opacity: .75; cursor: default; }

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff !important; font-size: 11px; }
  body::before, .sidebar, .topbar, .no-print, .toasts, .modal-f, .overlay .modal-h .btn { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ddd; backdrop-filter: none; background: #fff; break-inside: avoid; }
  .print-only { display: block; }
  table.t th { background: #f2f2f2 !important; position: static; }
  .overlay { position: static; background: none; backdrop-filter: none; display: block; padding: 0; }
  .overlay .modal { box-shadow: none; border: 0; max-height: none; width: 100%; }
  .modal-b { overflow: visible; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 290px; transform: translateX(-105%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); background: var(--surface-solid); }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .sidebar.open { transform: none !important; }
  .btn.menu-btn { display: inline-flex; }
  .g-2-1, .g-1-2, .g3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 680px) {
  .content { padding: 16px 16px 50px; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .topbar .hide-sm { display: none; }
  .g2, .g4, .form-grid { grid-template-columns: 1fr; }
  .strip { grid-template-columns: repeat(2, 1fr); }
  .kpi .val { font-size: 26px; }
  .reg-row { grid-template-columns: 1fr; gap: 8px; }
  .modal { border-radius: 22px; }
  .modal-h, .modal-b, .modal-f { padding-left: 16px; padding-right: 16px; }
  table.t th, table.t td { padding: 10px; }
  .hide-sm { display: none !important; }
  .board { padding: 18px; } .board-h .clock { font-size: 28px; }
}

/* ---------- Board mode + misc ---------- */
body.board-mode .sidebar, body.board-mode .topbar { display: none; }
body.board-mode .app { display: block; }
body.board-mode .content { padding: 0; max-width: none; animation: none; }
body.board-mode::before { display: none; }
@media (min-width: 1025px) { .hide-lg { display: none; } }
.modal.palette { padding: 0; }
.click { cursor: pointer; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { font-size: 16px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 650; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.pickup-card { width: 340px; border-radius: 22px; overflow: hidden; border: 1px solid #ddd; background: #fff; color: #0b1020; font-family: var(--font); }
.pickup-card .top { padding: 16px 18px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: flex; gap: 12px; align-items: center; }
.pickup-card .mid { padding: 18px; display: grid; grid-template-columns: 1fr 130px; gap: 14px; align-items: center; }
.pickup-card .mid svg { width: 130px; height: 130px; }
.pickup-card .bot { padding: 10px 18px; font-size: 11px; background: #f5f6fa; color: #555; }
.video-box { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 4/3; }
.video-box video { width: 100%; height: 100%; object-fit: cover; }
.video-box::after { content: ''; position: absolute; inset: 18%; border: 3px solid rgba(255, 215, 106, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }

.kpi-row { display: grid; gap: 18px; grid-template-columns: minmax(300px, 1.5fr) repeat(3, minmax(0, 1fr)); }
@media (max-width: 1200px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .kpi-row { grid-template-columns: 1fr 1fr; } .kpi-row > .hero { grid-column: 1 / -1; } }
bdi { unicode-bidi: isolate; }
@media (max-width: 680px) {
  .stu-card { flex-wrap: wrap; }
  .stu-card .grow { flex: 1 1 calc(100% - 100px); }
  .stu-card > .pill { margin-inline-start: 48px; }
  .stu-card > .btn { margin-inline-start: auto; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; }
}
