/* ============================================================
   BookPen PHP Edition — design system (vanilla CSS, no build)
   Ported from frontend-spec.md §3 (globals.css tokens) exactly:
   warm paper bg, navy primary, amber brand, emerald primary buttons.
   RTL: logical properties ONLY (no left/right in layout rules).
   ============================================================ */

/* ---------------- tokens ---------------- */
:root {
  --radius: 0.75rem;
  --amber-brand: #e8a33d;

  --background: #fdf9f5;
  --foreground: #1d2939;
  --card: #ffffff;
  --card-foreground: #1d2939;
  --popover: #ffffff;
  --popover-foreground: #1d2939;
  --primary: #22386b;
  --primary-foreground: #fefdfa;
  --secondary: #f6ebe7;
  --secondary-foreground: #22386b;
  --muted: #f4efe9;
  --muted-foreground: #667085;
  --accent: #fdf1dc;
  --accent-foreground: #8a5a12;
  --destructive: #d92d20;
  --border: #e9e1d8;
  --input: #e2d9ce;
  --ring: #22386b;
  --sidebar: #ffffff;
  --sidebar-border: #e9e1d8;

  --emerald-700: #047857;
  --teal-700: #0f766e;
  --emerald-800: #065f46;
  --teal-800: #115e59;

  --shadow-sm: 0 1px 2px rgba(29, 41, 57, 0.06);
  --shadow-md: 0 4px 12px rgba(29, 41, 57, 0.10);
  --shadow-lg: 0 12px 32px rgba(29, 41, 57, 0.14);
  --t: 0.15s ease;
}

/* Lite dark mode — soft, not pitch black (globals.css .dark) */
html.dark {
  --background: #14181f;
  --foreground: #eceef2;
  --card: #1c212b;
  --card-foreground: #eceef2;
  --popover: #1c212b;
  --popover-foreground: #eceef2;
  --primary: #e8b54d;
  --primary-foreground: #1a1f28;
  --secondary: #262c38;
  --secondary-foreground: #eceef2;
  --muted: #232936;
  --muted-foreground: #98a2b3;
  --accent: #332b1a;
  --accent-foreground: #f0c877;
  --destructive: #f97066;
  --border: #2a313e;
  --input: #333b4a;
  --ring: #e8b54d;
  --sidebar: #171c25;
  --sidebar-border: #2a313e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.50);
}

/* ---------------- base ---------------- */
*, *::before, *::after { box-sizing: border-box; border: 0 solid var(--border); }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Naskh Arabic", "Noto Sans Arabic", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
html[dir="rtl"] body {
  font-family: "Noto Naskh Arabic", "Noto Sans Arabic", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Tahoma, Arial, sans-serif;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--amber-brand) 35%, transparent); }

/* custom slim scrollbars (globals.css) — all, extra polish for .scroll-y */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted-foreground) 35%, transparent) transparent; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted-foreground) 30%, transparent); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted-foreground) 50%, transparent); }
.scroll-y { overflow-y: auto; overscroll-behavior: contain; }

/* ---------------- splash (splash-screen.tsx) ---------------- */
@keyframes bp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.bp-float { animation: bp-float 3s ease-in-out infinite; }
@keyframes bp-ring { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.7); opacity: 0; } }
.bp-ring { animation: bp-ring 2s ease-out infinite; }
.bp-ring-2 { animation: bp-ring 2s ease-out 0.7s infinite; }
@keyframes bp-fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.bp-fade-up { animation: bp-fade-up 0.6s ease-out both; }

.splash {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; color: #fff; text-align: center; padding: 24px;
  background: linear-gradient(to bottom, #022c22, #0b3d2e 50%, #042f2e);
}
.splash-lattice, .lattice {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1'%3E%3Cpath d='M36 4 L50 22 L68 36 L50 50 L36 68 L22 50 L4 36 L22 22 Z'/%3E%3Ccircle cx='36' cy='36' r='10'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 72px 72px;
}
.splash-orb { position: absolute; border-radius: 999px; filter: blur(48px); pointer-events: none; }
.splash-orb-a { inset-inline-start: 25%; top: -96px; width: 288px; height: 288px; background: rgba(251, 191, 36, 0.20); }
.splash-orb-b { inset-inline-end: 25%; bottom: -64px; width: 320px; height: 320px; background: rgba(52, 211, 153, 0.20); }
.splash-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.splash-logo-wrap { position: relative; margin-bottom: 28px; }
.splash-logo-wrap .bp-ring, .splash-logo-wrap .bp-ring-2 {
  position: absolute; inset: 0; border-radius: 999px; border: 2px solid rgba(252, 211, 77, 0.5);
}
.splash-logo-wrap .bp-ring-2 { border-color: rgba(110, 231, 183, 0.4); }
.splash-logo {
  position: relative; width: 116px; height: 116px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.95); padding: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4); border: 4px solid rgba(252, 211, 77, 0.6);
}
.splash-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 999px; }
.splash-title { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; animation: bp-fade-up 0.55s ease-out 0.35s both; }
.splash-title-ar { margin-block-start: 8px; font-size: 18px; font-weight: 600; color: rgba(252, 211, 77, 0.9); animation: bp-fade-up 0.55s ease-out 0.55s both; }
.splash-sub { margin-block-start: 4px; font-size: 13px; color: rgba(209, 250, 229, 0.8); animation: bp-fade-up 0.55s ease-out 0.75s both; }
.splash-progress {
  margin-block-start: 40px; width: 208px; height: 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.15); overflow: hidden; animation: bp-fade-up 0.4s ease-out 0.9s both;
}
/* Bar width is set inline every 50ms by shell.js (splash-screen.tsx parity:
   setInterval → style.width, 0→100% over 2.2s) with a 100ms linear width
   transition so it glides. The CSS animation below is ONLY a first-paint
   fallback for the instant before shell.js executes; shell.js switches it
   off (style.animation='none') when the JS driver takes over. */
.splash-bar {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(to right, #fcd34d, #fbbf24);
  transition: width 100ms linear;
  animation: splash-bar-grow 2.2s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes splash-bar-grow { from { width: 0%; } to { width: 100%; } }
.splash-caption { margin-block-start: 12px; font-size: 12px; color: rgba(209, 250, 229, 0.6); animation: bp-fade-up 0.4s ease-out 1s both; }
.splash-footer { position: absolute; bottom: 24px; font-size: 11px; letter-spacing: 0.02em; color: rgba(209, 250, 229, 0.5); animation: bp-fade-up 0.4s ease-out 1.2s both; }

/* ---------------- app shell ---------------- */
.app-flex { display: flex; min-height: 100dvh; background: var(--background); }

.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 30;
  display: flex; flex-direction: column;
  width: 256px; border-inline-end: 1px solid var(--border); background: var(--sidebar);
}
.sidebar-head { padding: 16px 20px; border-block-end: 1px solid var(--border); }
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 14px; border-radius: 12px; text-align: start;
  font-size: 14px; font-weight: 500; color: var(--muted-foreground);
  transition: background var(--t), color var(--t);
}
.sidebar-item:hover { background: var(--muted); color: var(--foreground); }
.sidebar-item.active { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-sm); }
.sidebar-item .ico { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-item .nav-label { display: inline; margin: 0; font-size: 14px; font-weight: 500; line-height: 1.4; }
.sidebar-item .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item .count-badge { margin-inline-start: auto; }
.sidebar-foot { padding: 12px; border-block-start: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.sidebar-user .who { min-width: 0; flex: 1; }
.sidebar-user .who .nm { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-col { display: flex; flex-direction: column; min-height: 100dvh; width: 100%; }
/* mobile: sidebar hidden → bottom-nav takes over (frontend-spec §5.4) */
@media (max-width: 899px) { .sidebar { display: none; } }
@media (min-width: 900px) { .main-col { margin-inline-start: 256px; width: calc(100% - 256px); } }

.header {
  position: sticky; top: 0; z-index: 20;
  border-block-end: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 16px; }
@media (min-width: 640px) { .header-inner { padding: 0 24px; } }
.header-title { font-size: 16px; font-weight: 700; display: none; align-items: center; gap: 8px; }
@media (min-width: 900px) { .header-title { display: flex; } }
.header-mobile-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-mobile-brand .nm { font-size: 14px; font-weight: 700; line-height: 1.2; }
.header-mobile-brand .full { font-size: 10px; color: var(--muted-foreground); line-height: 1.3; }
@media (min-width: 900px) { .header-mobile-brand { display: none; } }
.header-actions { display: flex; align-items: center; gap: 6px; }

.content { flex: 1; padding: 16px 16px 96px; }
@media (min-width: 640px) { .content { padding: 16px 24px 96px; } }
@media (min-width: 900px) { .content { padding-block-end: 32px; } }

.footer { margin-block-start: auto; display: none; padding: 16px 24px; border-block-start: 1px solid var(--border); background: color-mix(in srgb, var(--card) 60%, transparent); }
.footer p { text-align: center; font-size: 12px; color: var(--muted-foreground); }
.footer-links { margin-block-start: 6px; text-align: center; font-size: 12px; color: var(--muted-foreground); }
.footer-links a { text-decoration: underline; text-underline-offset: 2px; }
.footer-links a:hover { color: var(--foreground); }
@media (min-width: 900px) { .footer { display: block; } }

/* ---------------- mobile bottom nav (app-shell §5.4) ---------------- */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  border-block-start: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 95%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding-block-end: env(safe-area-inset-bottom);
}
@media (min-width: 900px) { .bottom-nav { display: none !important; } }
.bottom-nav-inner { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 512px; margin-inline: auto; }
.bottom-item {
  position: relative; height: 64px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  font-size: 10px; font-weight: 500; color: var(--muted-foreground); transition: color var(--t);
}
.bottom-item.active { color: var(--primary); }
.bottom-item.active .lbl { font-weight: 700; }
.bottom-item.active::before { content: ""; position: absolute; top: 0; width: 32px; height: 2px; border-radius: 999px; background: var(--primary); }
.bottom-item .ico { width: 20px; height: 20px; }

/* ---------------- brand blocks ---------------- */
.school-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.school-brand .logo { flex-shrink: 0; border-radius: 999px; object-fit: cover; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.school-brand .bnm { font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.school-brand .bsub { color: var(--muted-foreground); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- cards / stats ---------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm); }
.card-hover { transition: box-shadow var(--t), transform var(--t); }
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-lg { border-radius: 24px; padding: 24px; box-shadow: var(--shadow-lg); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-head .sub { font-size: 12px; color: var(--muted-foreground); }

.stat-card {
  position: relative; overflow: hidden; text-align: start; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow-sm);
}
button.stat-card { transition: box-shadow var(--t), transform var(--t); }
button.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; margin-block-end: 10px; }
.stat-icon .ico { width: 20px; height: 20px; }
.stat-value { font-size: 20px; font-weight: 800; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-label { margin-block-start: 2px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-hint { margin-block-start: 2px; font-size: 10px; color: color-mix(in srgb, var(--muted-foreground) 70%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tone-primary { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, transparent), color-mix(in srgb, var(--primary) 5%, transparent)); color: var(--primary); }
.tone-sky { background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(14, 165, 233, 0.05)); color: #0284c7; }
html.dark .tone-sky { color: #38bdf8; }
.tone-emerald { background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05)); color: #059669; }
html.dark .tone-emerald { color: #34d399; }
.tone-amber { background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05)); color: #d97706; }
html.dark .tone-amber { color: #fbbf24; }
.tone-rose { background: linear-gradient(135deg, rgba(244, 63, 94, 0.15), rgba(244, 63, 94, 0.05)); color: #e11d48; }
html.dark .tone-rose { color: #fb7185; }
.tone-violet { background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05)); color: #7c3aed; }
html.dark .tone-violet { color: #a78bfa; }
.tone-teal { background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(20, 184, 166, 0.05)); color: #0d9488; }
html.dark .tone-teal { color: #2dd4bf; }

.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--muted) 60%, transparent); }
.kpi .kv { font-size: 18px; font-weight: 800; }
.kpi .kl { font-size: 11px; font-weight: 500; color: var(--muted-foreground); }

/* ---------------- layout utilities ---------------- */
.grid { display: grid; gap: 12px; }
/* grid items must be allowed to shrink below their content width — long
   nowrap names (child cards, chat rows) would otherwise stretch the implicit
   column past the viewport and push the whole page out on phones */
.grid > * { min-width: 0; }
.cols-1 { grid-template-columns: 1fr; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } .cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 640px) and (max-width: 1023px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) {
  .cols-4 { grid-template-columns: repeat(4, 1fr); }
  .lg-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .lg-cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.space-y > * + * { margin-block-start: 16px; }
.space-y-sm > * + * { margin-block-start: 8px; }
.mt-1 { margin-block-start: 4px; } .mt-2 { margin-block-start: 8px; } .mt-3 { margin-block-start: 12px; } .mt-4 { margin-block-start: 16px; }
.mb-2 { margin-block-end: 8px; } .mb-3 { margin-block-end: 12px; } .mb-4 { margin-block-end: 16px; }
.w-full { width: 100%; } .h-full { height: 100%; }
.text-center { text-align: center; }
.bold { font-weight: 700; } .xbold { font-weight: 800; }
.small { font-size: 12px; } .xs { font-size: 11px; } .micro { font-size: 10px; }
.muted { color: var(--muted-foreground); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rel { position: relative; }
.max-w-sm { max-width: 384px; margin-inline: auto; }
.max-w-md { max-width: 448px; margin-inline: auto; }
.max-w-lg { max-width: 512px; margin-inline: auto; }
.max-w-2xl { max-width: 672px; margin-inline: auto; }
.ltr { direction: ltr; }
.center-page { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; white-space: nowrap; user-select: none;
  transition: filter var(--t), background var(--t), color var(--t), box-shadow var(--t), transform var(--t);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
/* PRIMARY action = emerald gradient (frontend-spec §3.5) */
.btn-primary {
  background: linear-gradient(135deg, #047857, #0f766e);
  color: #fff; box-shadow: var(--shadow-md);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #065f46, #115e59); }
.btn-outline { background: var(--card); border-color: var(--input); color: var(--foreground); }
.btn-outline:hover:not(:disabled) { background: var(--muted); }
.btn-danger { background: var(--destructive); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn-ghost { color: var(--muted-foreground); }
.btn-ghost:hover:not(:disabled) { background: var(--muted); color: var(--foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover:not(:disabled) { filter: brightness(0.97); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { height: 44px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 999px; }
.btn-pill { border-radius: 999px; height: 36px; padding: 0 14px; font-size: 12px; }

/* ---------------- forms ---------------- */
.label { display: block; font-size: 12px; font-weight: 600; color: var(--foreground); margin-block-end: 6px; }
.hint { font-size: 11px; color: var(--muted-foreground); margin-block-start: 4px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.input, .textarea, .select {
  width: 100%; background: var(--card); color: var(--foreground);
  border: 1px solid var(--input); border-radius: 12px; padding: 0 12px; height: 42px;
  transition: border-color var(--t), box-shadow var(--t);
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: calc(100% - 12px) center; padding-inline-end: 36px; }
html[dir="rtl"] .select { background-position: 12px center; padding-inline-end: 12px; padding-inline-start: 36px; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted-foreground) 80%, transparent); }
.input-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.input-lg { height: 44px; }
.searchbar {
  display: flex; align-items: center; gap: 8px; height: 40px;
  background: var(--card); border: 1px solid var(--input); border-radius: 12px; padding: 0 12px;
}
.searchbar .ico { width: 16px; height: 16px; color: var(--muted-foreground); flex-shrink: 0; }
.searchbar input { border: 0; outline: none; background: transparent; flex: 1; min-width: 0; }
.switch { position: relative; display: inline-flex; flex-shrink: 0; width: 40px; height: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--input); transition: background var(--t); }
.switch .track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 16px; height: 16px; border-radius: 999px; background: #fff;
  box-shadow: var(--shadow-sm); transition: transform var(--t);
}
html[dir="rtl"] .switch .track::after { transform: scaleX(-1); }
.switch input:checked + .track { background: var(--emerald-700); }
html[dir="rtl"] .switch input:checked + .track::after { transform: scaleX(-1) translateX(-18px); }
html:not([dir="rtl"]) .switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--ring); outline-offset: 2px; }
.field-error { border-radius: 12px; background: color-mix(in srgb, var(--destructive) 10%, transparent); padding: 8px 12px; font-size: 12px; font-weight: 500; color: var(--destructive); }
.notice-success { display: flex; gap: 6px; align-items: flex-start; border-radius: 12px; background: color-mix(in srgb, #10b981 10%, transparent); padding: 8px 12px; font-size: 12px; font-weight: 500; color: #047857; }
html.dark .notice-success { color: #34d399; }
.notice-amber { border-radius: 12px; border: 1px solid color-mix(in srgb, #f59e0b 60%, transparent); background: color-mix(in srgb, #f59e0b 10%, transparent); padding: 10px 12px; font-size: 12px; color: #92400e; }
html.dark .notice-amber { color: #fbbf24; }
.notice-muted { border-radius: 12px; background: color-mix(in srgb, var(--muted) 70%, transparent); padding: 8px 12px; font-size: 11px; color: var(--muted-foreground); line-height: 1.55; }

/* ---------------- pills / badges ---------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; background: var(--muted); color: var(--muted-foreground); }
.pill-navy { background: var(--primary); color: var(--primary-foreground); }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 600; background: var(--muted); color: var(--muted-foreground); }
.badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 2px 8px; font-size: 11px; font-weight: 500; background: var(--muted); color: var(--muted-foreground);
}
/* status colors (frontend-spec §7 StatusBadge + CONVENTIONS list) */
.badge-PRESENT, .badge-PAID, .badge-ACTIVE, .badge-VERIFIED, .badge-APPROVED, .badge-PUBLISHED { background: color-mix(in srgb, #10b981 14%, transparent); color: #047857; }
html.dark .badge-PRESENT, html.dark .badge-PAID, html.dark .badge-ACTIVE, html.dark .badge-VERIFIED, html.dark .badge-APPROVED, html.dark .badge-PUBLISHED { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.badge-ABSENT, .badge-REJECTED, .badge-SUSPENDED { background: color-mix(in srgb, #f43f5e 14%, transparent); color: #e11d48; }
html.dark .badge-ABSENT, html.dark .badge-REJECTED, html.dark .badge-SUSPENDED { background: rgba(244, 63, 94, 0.15); color: #fda4af; }
.badge-LATE, .badge-PENDING_REVIEW { background: color-mix(in srgb, #f59e0b 14%, transparent); color: #b45309; }
html.dark .badge-LATE, html.dark .badge-PENDING_REVIEW { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge-PENDING, .badge-DRAFT { background: color-mix(in srgb, #71717a 14%, transparent); color: #52525b; }
html.dark .badge-PENDING, html.dark .badge-DRAFT { background: rgba(113, 113, 122, 0.15); color: #d4d4d8; }
.badge-PENDING_PAYMENT { background: color-mix(in srgb, #0ea5e9 14%, transparent); color: #0369a1; }
html.dark .badge-PENDING_PAYMENT { background: rgba(14, 165, 233, 0.15); color: #7dd3fc; }
.badge-LEAVE { background: color-mix(in srgb, #64748b 14%, transparent); color: #475569; }
html.dark .badge-LEAVE { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.badge-SUBMITTED { background: color-mix(in srgb, #14b8a6 14%, transparent); color: #0f766e; }
html.dark .badge-SUBMITTED { background: rgba(20, 184, 166, 0.15); color: #5eead4; }
/* role badges (shared.tsx ROLE_META) */
.badge-role-SUPER_ADMIN { background: color-mix(in srgb, #f59e0b 14%, transparent); color: #b45309; }
html.dark .badge-role-SUPER_ADMIN { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge-role-PRINCIPAL { background: color-mix(in srgb, #8b5cf6 14%, transparent); color: #6d28d9; }
html.dark .badge-role-PRINCIPAL { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }
.badge-role-TEACHER { background: color-mix(in srgb, #14b8a6 14%, transparent); color: #0f766e; }
html.dark .badge-role-TEACHER { background: rgba(20, 184, 166, 0.15); color: #5eead4; }
.badge-role-STUDENT { background: color-mix(in srgb, #0ea5e9 14%, transparent); color: #0369a1; }
html.dark .badge-role-STUDENT { background: rgba(14, 165, 233, 0.15); color: #7dd3fc; }
.badge-role-PARENT { background: color-mix(in srgb, #f43f5e 14%, transparent); color: #be123c; }
html.dark .badge-role-PARENT { background: rgba(244, 63, 94, 0.15); color: #fda4af; }
.badge-role-ACCOUNTANT { background: color-mix(in srgb, #84cc16 14%, transparent); color: #4d7c0f; }
html.dark .badge-role-ACCOUNTANT { background: rgba(132, 204, 22, 0.15); color: #bef264; }

/* unread counters (app-shell) */
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #f43f5e; color: #fff; font-size: 10px; font-weight: 700;
}
.notif-dot {
  position: absolute; inset-inline-end: -2px; inset-block-start: -2px;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: #f43f5e; color: #fff; font-size: 9px; font-weight: 700;
}

/* ---------------- avatars (shared.tsx Avatar + COLOR_CLASSES) ---------------- */
.avatar { position: relative; display: inline-flex; flex-shrink: 0; }
.avatar img, .avatar .av-initials { width: 100%; height: 100%; border-radius: 999px; object-fit: cover; }
.avatar .av-initials { display: flex; align-items: center; justify-content: center; font-weight: 600; }
.avatar .online-dot { position: absolute; bottom: 0; inset-inline-end: 0; width: 10px; height: 10px; border-radius: 999px; background: #10b981; border: 2px solid var(--card); }
.av-emerald { background: #d1fae5; color: #065f46; } html.dark .av-emerald { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.av-amber { background: #fef3c7; color: #92400e; } html.dark .av-amber { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.av-rose { background: #ffe4e6; color: #9f1239; } html.dark .av-rose { background: rgba(244, 63, 94, 0.2); color: #fda4af; }
.av-teal { background: #ccfbf1; color: #115e59; } html.dark .av-teal { background: rgba(20, 184, 166, 0.2); color: #5eead4; }
.av-violet { background: #ede9fe; color: #5b21b6; } html.dark .av-violet { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.av-orange { background: #ffedd5; color: #9a3412; } html.dark .av-orange { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
.av-cyan { background: #cffafe; color: #155e75; } html.dark .av-cyan { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
.av-lime { background: #ecfccb; color: #3f6212; } html.dark .av-lime { background: rgba(132, 204, 22, 0.2); color: #bef264; }
.av-fuchsia { background: #fae8ff; color: #86198f; } html.dark .av-fuchsia { background: rgba(217, 70, 239, 0.2); color: #f0abfc; }
.av-sky { background: #e0f2fe; color: #075985; } html.dark .av-sky { background: rgba(14, 165, 233, 0.2); color: #7dd3fc; }

/* ---------------- tabs ---------------- */
.tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; background: var(--muted); border-radius: 12px; padding: 4px; }
.tabs-3 { grid-template-columns: repeat(3, 1fr); }
.tabs-4 { grid-template-columns: repeat(4, 1fr); }
.tab {
  height: 36px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted-foreground);
  transition: background var(--t), color var(--t), box-shadow var(--t);
}
.tab.active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }
.tabline { display: flex; gap: 16px; border-block-end: 1px solid var(--border); }
.tabline .tab { height: 40px; border-radius: 0; background: none; box-shadow: none; border-block-end: 2px solid transparent; }
.tabline .tab.active { color: var(--primary); border-block-end-color: var(--primary); }

/* ---------------- dropdown ---------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 200px; background: var(--popover); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; overflow: hidden;
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 500; text-align: start;
  transition: background var(--t);
}
.dropdown-item:hover { background: var(--muted); }
.dropdown-item.danger { color: var(--destructive); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-label { padding: 8px 10px; }
.backdrop { position: fixed; inset: 0; z-index: 40; background: transparent; }

/* ---------------- modal / sheet ---------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, 0.5);
  animation: overlay-fade 0.15s ease-out both;
}
@keyframes overlay-fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 512px; max-height: 90dvh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg); padding: 24px;
  animation: modal-in 0.18s ease-out both;
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.modal-wide { max-width: 672px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-block-end: 16px; }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-head .sub { font-size: 13px; color: var(--muted-foreground); margin-block-start: 2px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-block-start: 16px; flex-wrap: wrap; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 70;
  background: var(--card); border: 1px solid var(--border); border-block-end: 0;
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  max-height: 72dvh; display: flex; flex-direction: column;
  animation: sheet-up 0.25s ease-out;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
.sheet-grab { width: 40px; height: 4px; border-radius: 999px; background: var(--border); margin: 10px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-block-end: 1px solid var(--border); }
.sheet-body { overflow-y: auto; padding: 16px; }
/* mobile: modals become full-screen sheets */
@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 24px 24px 0 0; border-block-end: 0; max-height: 92dvh; animation: sheet-up 0.25s ease-out; }
}

/* ---------------- toast ---------------- */
.toast-stack {
  position: fixed; bottom: 84px; inset-inline: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
@media (min-width: 900px) { .toast-stack { bottom: 24px; inset-inline-start: auto; inset-inline-end: 24px; align-items: flex-end; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 92vw;
  background: var(--popover); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px;
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  animation: bp-fade-up 0.25s ease-out;
}
.toast .ico { width: 16px; height: 16px; flex-shrink: 0; }
.toast-success { border-inline-start: 3px solid #10b981; }
.toast-success .ico { color: #10b981; }
.toast-error { border-inline-start: 3px solid var(--destructive); }
.toast-error .ico { color: var(--destructive); }
.toast-info { border-inline-start: 3px solid var(--primary); }
.toast-info .ico { color: var(--primary); }

/* ---------------- skeleton / spinner / progress / empty ---------------- */
@keyframes bp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.skeleton { border-radius: 8px; background: var(--muted); animation: bp-pulse 1.6s ease-in-out infinite; }
.skeleton-card { height: 112px; border-radius: 16px; }
.spinner {
  display: inline-block; border-radius: 999px;
  border: 2.5px solid color-mix(in srgb, currentColor 20%, transparent);
  border-block-start-color: currentColor; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 8px; width: 100%; border-radius: 999px; background: var(--muted); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: #f43f5e; transition: width 0.3s ease; }
.progress-bar.p90 { background: #10b981; }
.progress-bar.p70 { background: #14b8a6; }
.progress-bar.p50 { background: #f59e0b; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: 16px; background: color-mix(in srgb, var(--card) 50%, transparent);
  padding: 48px 24px; text-align: center;
}
.empty-state .icon-tile {
  display: flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  border-radius: 16px; background: var(--muted); color: var(--muted-foreground); margin-block-end: 12px;
}
.empty-state .icon-tile .ico { width: 22px; height: 22px; }
.empty-state .t { font-weight: 600; }
.empty-state .d { margin-block-start: 4px; font-size: 13px; color: var(--muted-foreground); max-width: 384px; }

/* ---------------- tables ---------------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.table th {
  text-align: start; padding: 10px 14px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground);
  background: color-mix(in srgb, var(--muted) 60%, transparent); border-block-end: 1px solid var(--border);
  position: sticky; top: 0;
}
.table td { padding: 10px 14px; border-block-end: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-block-end: 0; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: color-mix(in srgb, var(--muted) 40%, transparent); }

/* ---------------- list rows ---------------- */
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px; border-radius: 12px; text-align: start; transition: background var(--t);
}
.list-row:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.list-row .body { min-width: 0; flex: 1; }

/* ---------------- attendance status buttons ---------------- */
.status-btn {
  flex: 1; min-width: 64px; height: 32px; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground);
  transition: all var(--t);
}
.status-btn.st-PRESENT.active { background: #10b981; border-color: #10b981; color: #fff; }
.status-btn.st-ABSENT.active { background: #f43f5e; border-color: #f43f5e; color: #fff; }
.status-btn.st-LATE.active { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.status-btn.st-LEAVE.active { background: #0ea5e9; border-color: #0ea5e9; color: #fff; }

/* ---------------- auth screen ---------------- */
.auth-wrap { display: flex; min-height: 100dvh; background: var(--background); }
.auth-brand {
  position: relative; display: none; width: 46%; overflow: hidden;
  background: linear-gradient(135deg, #022c22, #0b3d2e 50%, #042f2e); color: #fff;
}
@media (min-width: 900px) { .auth-brand { display: block; } }
.auth-brand .lattice { opacity: 0.07; }
.auth-brand-orb-a { position: absolute; inset-inline-end: -80px; top: 25%; width: 320px; height: 320px; border-radius: 999px; background: rgba(251, 191, 36, 0.15); filter: blur(48px); }
.auth-brand-orb-b { position: absolute; inset-inline-start: -96px; bottom: 0; width: 288px; height: 288px; border-radius: 999px; background: rgba(45, 212, 191, 0.1); filter: blur(48px); }
.auth-brand-inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 48px; }
.auth-brand-card { width: 100%; max-width: 448px; }
.auth-brand-logo { display: flex; align-items: center; gap: 16px; }
.auth-brand-logo .disc { border-radius: 999px; background: rgba(255, 255, 255, 0.95); padding: 8px; box-shadow: var(--shadow-lg); border: 2px solid rgba(252, 211, 77, 0.6); }
.auth-brand-logo .disc img { width: 56px; height: 56px; border-radius: 999px; object-fit: cover; }
.auth-divider { height: 1px; width: 96px; margin-block: 28px; background: linear-gradient(to inline-end, rgba(252, 211, 77, 0.7), transparent); }
.auth-brand h2 { font-size: 34px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.auth-brand .hero { margin-block-start: 16px; font-size: 15px; line-height: 1.65; color: rgba(209, 250, 229, 0.85); }
.auth-feature-grid { margin-block-start: 36px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.auth-feature { display: flex; align-items: center; gap: 10px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; background: rgba(255, 255, 255, 0.06); padding: 12px 14px; backdrop-filter: blur(4px); }
.auth-feature .ico { width: 18px; height: 18px; color: #fcd34d; flex-shrink: 0; }
.auth-feature span { font-size: 14px; font-weight: 500; color: #ecfdf5; }
.auth-address { margin-block-start: 36px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: rgba(209, 250, 229, 0.6); }
.auth-address .ico { width: 14px; height: 14px; color: rgba(252, 211, 77, 0.8); }
.auth-form-panel { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
@media (min-width: 640px) { .auth-form-panel { padding: 32px 32px; } }
.auth-corner { position: absolute; inset-inline-end: 16px; top: 16px; display: flex; align-items: center; gap: 8px; }
.auth-mobile-head { margin-block-end: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
@media (min-width: 900px) { .auth-mobile-head { display: none; } }
.auth-mobile-head .disc { border-radius: 999px; background: linear-gradient(135deg, #064e3b, #134e4a); padding: 12px; box-shadow: var(--shadow-lg); border: 2px solid rgba(252, 211, 77, 0.5); }
.auth-mobile-head .disc img { width: 56px; height: 56px; border-radius: 999px; object-fit: cover; }
.auth-card { width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 24px; box-shadow: var(--shadow-lg); }
@media (min-width: 640px) { .auth-card { padding: 32px; } }
.auth-card h2.form-title { font-size: 20px; font-weight: 700; }
.auth-card .form-sub { margin-block-start: 2px; font-size: 14px; color: var(--muted-foreground); }
.choice-btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border: 1px solid var(--input); border-radius: 12px; font-size: 14px; font-weight: 600; color: var(--muted-foreground); transition: all var(--t); }
.choice-btn:hover { background: var(--muted); }
.choice-btn.active { border-color: #059669; background: rgba(5, 150, 105, 0.1); color: #047857; }
html.dark .choice-btn.active { color: #34d399; }
.group-box { border-radius: 12px; background: color-mix(in srgb, var(--muted) 50%, transparent); padding: 12px; }
.group-box .gt { font-size: 12px; font-weight: 700; margin-block-end: 12px; }
.avatar-uploader {
  display: flex; flex-direction: column; align-items: center; border: 1px dashed var(--border);
  border-radius: 12px; padding: 20px 12px;
}
.avatar-circle {
  position: relative; width: 96px; height: 96px; border-radius: 999px; overflow: hidden;
  border: 2px dashed rgba(5, 150, 105, 0.5); background: color-mix(in srgb, var(--muted) 50%, transparent);
  transition: border-color var(--t);
}
.avatar-circle:hover { border-color: #059669; }
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-circle .ph { display: flex; width: 100%; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #047857; }
html.dark .avatar-circle .ph { color: #34d399; }
.avatar-circle .ph .ico { width: 24px; height: 24px; }
.avatar-cam {
  position: absolute; bottom: 0; inset-inline-end: 0; display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 999px; color: #fff;
  background: linear-gradient(135deg, #047857, #0f766e); box-shadow: var(--shadow-md);
  border: 2px solid var(--background);
}
.doc-tile { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--border); border-radius: 12px; background: var(--background); padding: 10px; }
.doc-tile .drop { position: relative; width: 100%; height: 80px; border-radius: 8px; overflow: hidden; border: 1px dashed rgba(5, 150, 105, 0.4); background: color-mix(in srgb, var(--muted) 40%, transparent); transition: border-color var(--t); }
.doc-tile .drop:hover { border-color: #059669; }
.doc-tile .drop img { width: 100%; height: 100%; object-fit: cover; }
.doc-tile .drop .ph { display: flex; width: 100%; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #047857; }
html.dark .doc-tile .drop .ph { color: #34d399; }
.demo-code-box { border: 1px solid rgba(245, 158, 11, 0.6); border-radius: 12px; background: rgba(245, 158, 11, 0.1); padding: 10px 12px; font-size: 12px; color: #92400e; }
html.dark .demo-code-box { color: #fbbf24; }

/* ---------------- student status gate ---------------- */
.gate-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 40px 16px;
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.9), rgba(240, 253, 250, 0.5));
}
html.dark .gate-wrap { background: linear-gradient(135deg, rgba(6, 78, 59, 0.3), rgba(19, 78, 74, 0.3)); }
.gate-icon { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 999px; }
.gate-icon .ico { width: 30px; height: 30px; }
.gate-icon.amber { background: rgba(245, 158, 11, 0.15); color: #d97706; }
html.dark .gate-icon.amber { color: #fbbf24; }
.gate-icon.danger { background: color-mix(in srgb, var(--destructive) 15%, transparent); color: var(--destructive); }
.gate-icon.emerald { background: rgba(16, 185, 129, 0.15); color: #059669; }
html.dark .gate-icon.emerald { color: #34d399; }
.pay-box { border: 1px solid var(--border); border-radius: 16px; background: color-mix(in srgb, var(--muted) 40%, transparent); padding: 16px; }
.pay-amount { font-size: 24px; font-weight: 800; }
.mada-box { border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mada-logo { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: #0b7d6e; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; padding: 2px 8px; }

/* ---------------- misc widgets ---------------- */
.id-promo {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: start;
  border: 1px solid rgba(251, 191, 36, 0.4); border-radius: 16px; padding: 16px; color: #fff;
  /* dark emerald gradient (dashboard-screen.tsx: from-emerald-950 via-[#0b3d2e] to-teal-900)
     — white text stays readable in light AND dark mode */
  background: linear-gradient(to right, #022c22, #0b3d2e 50%, #134e4a);
  box-shadow: var(--shadow-sm); transition: box-shadow var(--t), transform var(--t);
}
.id-promo:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.id-promo .tile { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex-shrink: 0; border-radius: 16px; background: rgba(251, 191, 36, 0.2); color: #fcd34d; }
.cta-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-radius: 16px; padding: 20px; color: #fff;
  background: linear-gradient(to right, #065f46, #115e59);
}
.period-chip {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 10px; font-size: 12px; font-weight: 700;
  background: rgba(245, 158, 11, 0.15); color: #b45309;
}
html.dark .period-chip { color: #fcd34d; }
.now-badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  background: #10b981; padding: 2px 8px; font-size: 10px; font-weight: 800; color: #fff;
}
.pulse-dot { position: relative; display: inline-flex; width: 6px; height: 6px; }
.pulse-dot::before { content: ""; position: absolute; inset: 0; border-radius: 999px; background: #fff; opacity: 0.75; animation: ping 1.2s cubic-bezier(0, 0, 0.2, 1) infinite; }
.pulse-dot::after { content: ""; position: relative; border-radius: 999px; background: #fff; }
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }
.child-card { border: 1px solid var(--border); border-radius: 16px; background: var(--card); padding: 16px; box-shadow: var(--shadow-sm); }
.mini-tile { border-radius: 12px; background: color-mix(in srgb, var(--muted) 60%, transparent); padding: 10px; }
.plan-card { border: 1px solid rgba(16, 185, 129, 0.3); border-radius: 16px; padding: 16px; background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(20, 184, 166, 0.05), transparent); }
.subject-tag { display: inline-block; border-radius: 8px; background: rgba(16, 185, 129, 0.1); padding: 2px 8px; font-size: 11px; font-weight: 700; color: #047857; }
html.dark .subject-tag { color: #6ee7b7; }
.ann-item { border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--background) 50%, transparent); padding: 12px; }

/* ---------------- dropdown panels (notifications) ---------------- */
.notif-menu { width: 320px; }
@media (min-width: 640px) { .notif-menu { width: 384px; } }
.notif-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 12px; text-align: start; border-radius: 9px; transition: background var(--t); }
.notif-item:hover { background: var(--muted); }
.notif-item.unread { background: color-mix(in srgb, #10b981 6%, transparent); }
.notif-item .nt { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; }
.notif-item .nb { font-size: 11px; color: var(--muted-foreground); line-height: 1.5; }
.unread-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 999px; background: #10b981; }

/* ---------------- print (#print-area: ID cards, reports) ---------------- */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block; position: absolute; inset: 0; margin: 0; padding: 0; }
  #print-area .no-print { display: none !important; }
  .sidebar, .header, .bottom-nav, .footer, .toast-stack, .modal-overlay { display: none !important; }
  .main-col { margin-inline-start: 0 !important; width: 100% !important; }
  @page { margin: 14mm; }
}

/* ---------------- rtl helpers ---------------- */
html[dir="rtl"] .rtl-flip { transform: scaleX(-1); }
.rtl-block { display: inline-block; }

/* misc */
.nextjs-portal, nextjs-portal { display: none !important; }
