/* ============================================================================
   شِفاء — Hospital Management System
   styles.css
   Pure CSS3 (no frameworks). RTL-first. Light + Dark theme.
   ----------------------------------------------------------------------------
   TABLE OF CONTENTS
   01. CSS Reset & Base
   02. Theme Tokens (Light / Dark)
   03. Typography
   04. Utilities & Helpers
   05. Animated Background / Mouse Glow / Scroll Progress
   06. Buttons
   07. Forms & Inputs
   08. Splash Screen
   09. Auth Screen
   10. App Shell (Sidebar / Topbar / Main)
   11. Navigation
   12. Cards & Stat Widgets
   13. Charts (CSS/SVG based)
   14. Tables
   15. Badges / Pills / Chips
   16. Modal
   17. Toast / Notifications
   18. Calendar
   19. Profiles & Detail Pages
   20. Footer
   21. Skeleton / Loading
   22. Scrollbar
   23. Animations (keyframes)
   24. Responsive
============================================================================ */

/* ===========================================================================
   01. CSS RESET & BASE
=========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: "Cairo", "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

/* ===========================================================================
   02. THEME TOKENS
=========================================================================== */
:root {
  /* Brand */
  --medical-blue: #0e7490;
  --medical-blue-600: #0891b2;
  --medical-blue-700: #0e7490;
  --medical-blue-50: #ecfeff;
  --emerald: #059669;
  --emerald-600: #10b981;
  --emerald-50: #ecfdf5;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --warning: #d97706;
  --warning-50: #fffbeb;
  --info: #2563eb;

  /* radius / shadow */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.16);
  --shadow-glow: 0 0 0 4px rgba(14, 116, 144, 0.12);

  /* layout */
  --sidebar-w: 280px;
  --topbar-h: 72px;
  --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #475569;
  --text-muted: #94a3b8;
  --primary: var(--medical-blue);
  --primary-soft: #e0f2fe;
  --accent: var(--emerald);
  --accent-soft: var(--emerald-50);
  --glass: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.7);
  --sidebar-bg: #0b3a4a;
  --sidebar-text: #cbe7ef;
  --sidebar-text-soft: #7fb0bf;
  --sidebar-active: #0e7490;
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0a0f1a;
  --bg-soft: #0f1626;
  --surface: #131c2e;
  --surface-2: #18233a;
  --surface-3: #1f2d49;
  --border: #243049;
  --border-strong: #34435f;
  --text: #e9eef7;
  --text-soft: #a3b0c7;
  --text-muted: #6b7a96;
  --primary: #22d3ee;
  --primary-soft: #0e3a47;
  --accent: #34d399;
  --accent-soft: #0c3a2c;
  --glass: rgba(19, 28, 46, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --sidebar-bg: #0a121f;
  --sidebar-text: #c4d3e8;
  --sidebar-text-soft: #66789a;
  --sidebar-active: #0e7490;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.65);
}

/* ===========================================================================
   03. TYPOGRAPHY
=========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-balance { text-wrap: balance; }
.text-center { text-align: center; }

/* ===========================================================================
   04. UTILITIES
=========================================================================== */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.container { width: 100%; max-width: 1500px; margin-inline: auto; }

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-title h1 { display: flex; align-items: center; gap: 0.6rem; }
.page-title .subtitle { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.2rem; }
.page-title-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}
.section-head h3 { display: flex; align-items: center; gap: 0.5rem; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ===========================================================================
   05. ANIMATED BACKGROUND / MOUSE GLOW / SCROLL PROGRESS
=========================================================================== */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  animation: floatBlob 18s ease-in-out infinite;
}
.blob-1 { width: 420px; height: 420px; background: var(--medical-blue); top: -120px; inset-inline-start: -100px; }
.blob-2 { width: 360px; height: 360px; background: var(--emerald); bottom: -120px; inset-inline-end: -80px; animation-delay: -6s; }
.blob-3 { width: 300px; height: 300px; background: #38bdf8; top: 40%; inset-inline-start: 55%; animation-delay: -12s; opacity: 0.25; }
[data-theme="dark"] .blob { opacity: 0.18; }

.float-icon {
  position: absolute;
  font-size: 2rem;
  opacity: 0.07;
  animation: floatIcon 14s ease-in-out infinite;
  color: var(--primary);
}
.fi-1 { top: 15%; inset-inline-start: 10%; }
.fi-2 { top: 30%; inset-inline-end: 12%; animation-delay: -3s; }
.fi-3 { bottom: 20%; inset-inline-start: 20%; animation-delay: -6s; }
.fi-4 { top: 60%; inset-inline-end: 25%; animation-delay: -9s; }
.fi-5 { bottom: 12%; inset-inline-end: 40%; animation-delay: -4s; }

.mouse-glow {
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 116, 144, 0.18), transparent 65%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.3s;
  opacity: 0;
}
[data-theme="dark"] .mouse-glow {
  background: radial-gradient(circle, rgba(34, 211, 238, 0.12), transparent 65%);
}

.scroll-progress {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ===========================================================================
   06. BUTTONS
=========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--medical-blue-600), var(--medical-blue-700));
  color: #fff;
  box-shadow: 0 6px 18px rgba(14, 116, 144, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(14, 116, 144, 0.45); }
.btn-accent {
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald));
  color: #fff;
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.32);
}
.btn-accent:hover { transform: translateY(-2px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(220,38,38,0.35); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }
.btn-icon { padding: 0.55rem; aspect-ratio: 1; }

/* Ripple */
.btn-ripple .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--text-soft);
  transition: var(--transition);
  position: relative;
  background: transparent;
}
.icon-btn:hover { background: var(--surface-3); color: var(--primary); transform: translateY(-2px); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-moon { display: none; }
[data-theme="dark"] .ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: block; }

.badge-host { position: relative; }
.badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop 0.3s ease;
}

.link-btn {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}
.link-btn:hover { text-decoration: underline; }

/* ===========================================================================
   07. FORMS & INPUTS
=========================================================================== */
.field { margin-bottom: 1.1rem; }
.field > label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.45rem;
  color: var(--text-soft);
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .input-ico {
  position: absolute;
  inset-inline-start: 0.9rem;
  font-size: 1rem;
  opacity: 0.6;
  pointer-events: none;
}
.input-wrap input,
.input-wrap select {
  width: 100%;
  padding: 0.8rem 2.6rem 0.8rem 1rem;
}
input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-glow);
}
textarea { resize: vertical; min-height: 90px; }
.toggle-pass {
  position: absolute;
  inset-inline-end: 0.9rem;
  font-size: 1rem;
  opacity: 0.6;
}
.toggle-pass:hover { opacity: 1; }
.field-error {
  display: block;
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 0.3rem;
  min-height: 1em;
}
.field.invalid input { border-color: var(--danger); }

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-soft);
  cursor: pointer;
}
.checkbox input { width: auto; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem 1rem;
}
.form-grid .full { grid-column: 1 / -1; }

.pass-strength {
  height: 6px;
  background: var(--surface-3);
  border-radius: 4px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.pass-strength-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: var(--transition);
}

.otp-inputs {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin: 1rem 0;
  direction: ltr;
}
.otp-box {
  width: 50px;
  height: 58px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  padding: 0;
}
.otp-timer { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }

/* ===========================================================================
   08. SPLASH SCREEN
=========================================================================== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #0b3a4a, #0e7490 55%, #059669);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.splash.fade-out { opacity: 0; visibility: hidden; }
.splash-inner { text-align: center; color: #fff; animation: splashIn 0.8s ease; }
.splash-logo-svg { width: 130px; height: 130px; margin-inline: auto; }
.splash-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 3;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: drawRing 2s ease forwards;
}
.splash-cross { fill: #fff; transform-origin: center; animation: pulseScale 1.6s ease-in-out infinite; }
.splash-pulse {
  stroke: #6ee7b7;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawPulse 2s ease forwards 0.4s;
}
.splash-title { font-size: 3rem; color: #fff; margin-top: 0.5rem; letter-spacing: 2px; }
.splash-sub { opacity: 0.85; margin-bottom: 2rem; }
.splash-bar {
  width: 260px;
  height: 7px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  margin: 0 auto;
  overflow: hidden;
}
.splash-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6ee7b7, #fff);
  border-radius: 10px;
  transition: width 0.2s ease;
}
.splash-percent { margin-top: 0.6rem; font-weight: 700; }
.splash-icons { margin-top: 1.6rem; display: flex; gap: 1rem; justify-content: center; font-size: 1.6rem; }
.splash-icons .si { animation: bounceIcon 1.4s ease-in-out infinite; opacity: 0.9; }
.splash-icons .si:nth-child(2) { animation-delay: 0.15s; }
.splash-icons .si:nth-child(3) { animation-delay: 0.3s; }
.splash-icons .si:nth-child(4) { animation-delay: 0.45s; }
.splash-icons .si:nth-child(5) { animation-delay: 0.6s; }
.splash-icons .si:nth-child(6) { animation-delay: 0.75s; }

/* ===========================================================================
   09. AUTH SCREEN
=========================================================================== */
.auth-screen {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.auth-aside {
  background: linear-gradient(155deg, #0b3a4a, #0e7490 60%, #047857);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}
.auth-aside::before {
  content: "";
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.12), transparent 70%);
  top: -150px; inset-inline-end: -150px;
  animation: floatBlob 16s ease-in-out infinite;
}
.auth-aside-content { position: relative; z-index: 2; max-width: 440px; }
.auth-aside-title { color: #fff; font-size: 2rem; margin: 1.5rem 0 1rem; }
.auth-aside-text { opacity: 0.88; line-height: 1.8; margin-bottom: 1.5rem; }
.auth-features { display: grid; gap: 0.7rem; margin-bottom: 2rem; }
.auth-features li { display: flex; align-items: center; gap: 0.6rem; opacity: 0.92; }
.af-ico {
  width: 26px; height: 26px;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.8rem;
}
.auth-aside-stats { display: flex; gap: 2rem; }
.auth-aside-stats > div { display: flex; flex-direction: column; }
.auth-aside-stats strong { font-size: 1.6rem; }
.auth-aside-stats span { opacity: 0.8; font-size: 0.85rem; }

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  background: var(--bg);
}
.auth-topbar { position: absolute; top: 1.5rem; inset-inline-end: 1.5rem; }
.auth-form {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  padding: 2.4rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: slideUp 0.5s ease;
}
.auth-form-title { margin-bottom: 0.3rem; }
.auth-form-sub { color: var(--text-muted); margin-bottom: 1.6rem; font-size: 0.92rem; }
.auth-switch { text-align: center; margin-top: 1.2rem; color: var(--text-soft); font-size: 0.9rem; }
.auth-hint {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--medical-blue-600), var(--emerald));
  border-radius: 12px;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 28px; height: 28px; }
.bm-cross { fill: #fff; }
.bm-pulse { stroke: #bbf7d0; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { font-size: 1.5rem; font-weight: 900; letter-spacing: 1px; }
.brand-lg .brand-mark { width: 56px; height: 56px; }
.brand-lg .brand-text { font-size: 2rem; }

/* ===========================================================================
   10. APP SHELL
=========================================================================== */
.app {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 60;
  transition: transform var(--transition);
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-head .brand-text { color: #fff; }
.sidebar-close { display: none; color: var(--sidebar-text); }
.sidebar-foot { padding: 1rem 1.2rem; border-top: 1px solid rgba(255,255,255,0.08); }
.upgrade-card {
  background: linear-gradient(135deg, var(--medical-blue-600), var(--emerald));
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  color: #fff;
}
.upgrade-ico { font-size: 1.4rem; }
.upgrade-card p { font-weight: 700; margin: 0.3rem 0 0.1rem; }
.upgrade-card small { opacity: 0.85; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 55;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 0.8rem; flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 0.3rem; }

.search-global {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0.9rem;
  max-width: 420px;
  flex: 1;
  transition: var(--transition);
}
.search-global:focus-within { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.search-global input { border: none; background: transparent; box-shadow: none; padding: 0.6rem 0.5rem; }
.search-global input:focus { box-shadow: none; }
.search-ico { opacity: 0.6; }
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  overflow-y: auto;
  z-index: 80;
  animation: slideDown 0.2s ease;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.search-result-item:hover { background: var(--surface-2); }
.search-result-item .sr-type {
  margin-inline-start: auto;
  font-size: 0.7rem;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}
.search-empty { padding: 1.2rem; text-align: center; color: var(--text-muted); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.topbar-user:hover { background: var(--surface-3); }
.topbar-user-info { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-user-info strong { font-size: 0.9rem; }
.topbar-user-info small { font-size: 0.75rem; color: var(--text-muted); }
.chev { font-size: 0.7rem; opacity: 0.6; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 90;
}
.user-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
}
.user-dropdown a:hover { background: var(--surface-2); }
.user-dropdown a.danger { color: var(--danger); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 0.3rem 0; }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--medical-blue-600), var(--emerald));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 0.9rem;
}
.avatar-sm { width: 36px; height: 36px; font-size: 0.8rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 1.8rem; }

.page-content {
  flex: 1;
  padding: 1.8rem;
  animation: pageFade 0.45s ease;
}

/* ===========================================================================
   11. NAVIGATION
=========================================================================== */
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.8rem;
}
.nav-group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sidebar-text-soft);
  padding: 0.9rem 0.8rem 0.4rem;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 0.2rem;
  transition: var(--transition);
  position: relative;
}
.nav-item .nav-ico { font-size: 1.1rem; width: 24px; text-align: center; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); transform: translateX(-4px); }
.nav-item.active {
  background: linear-gradient(135deg, var(--medical-blue-600), var(--medical-blue-700));
  color: #fff;
  box-shadow: 0 6px 16px rgba(14, 116, 144, 0.4);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -0.8rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--emerald-600);
  border-radius: 4px;
}

/* ===========================================================================
   12. CARDS & STAT WIDGETS
=========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card-hover:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.stat-card::after {
  content: "";
  position: absolute;
  inset-inline-end: -30px;
  top: -30px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: var(--accent-color, var(--primary-soft));
  opacity: 0.15;
  transition: var(--transition);
}
.stat-card:hover::after { transform: scale(1.3); }
.stat-head { display: flex; align-items: center; justify-content: space-between; }
.stat-ico {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 1.4rem;
  background: var(--accent-color, var(--primary-soft));
  color: var(--accent-text, var(--primary));
}
.stat-trend { font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; gap: 0.2rem; }
.stat-trend.up { color: var(--emerald); }
.stat-trend.down { color: var(--danger); }
.stat-value { font-size: 2rem; font-weight: 900; margin-top: 0.8rem; }
.stat-label { color: var(--text-muted); font-size: 0.88rem; }

.mini-progress {
  height: 6px;
  background: var(--surface-3);
  border-radius: 4px;
  margin-top: 0.8rem;
  overflow: hidden;
}
.mini-progress > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0;
  transition: width 1s ease;
}

/* circular progress */
.circ-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.circ {
  --val: 70;
  --size: 120px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--primary) calc(var(--val) * 1%), var(--surface-3) 0);
  position: relative;
}
.circ::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--surface);
}
.circ span { position: relative; font-weight: 900; font-size: 1.4rem; }

/* activity */
.activity-item {
  display: flex;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary);
}
.activity-meta { flex: 1; }
.activity-meta strong { font-size: 0.92rem; }
.activity-meta p { color: var(--text-muted); font-size: 0.85rem; }
.activity-time { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }

/* ===========================================================================
   13. CHARTS
=========================================================================== */
.chart-card { min-height: 320px; }
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.8rem;
  height: 220px;
  padding-top: 1rem;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%;
  max-width: 42px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--medical-blue-600), var(--medical-blue-700));
  height: 0;
  transition: height 1s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.bar.alt { background: linear-gradient(180deg, var(--emerald-600), var(--emerald)); }
.bar:hover::after {
  content: attr(data-val);
  position: absolute;
  top: -26px;
  inset-inline-start: 50%;
  transform: translateX(50%);
  background: var(--text);
  color: var(--surface);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
}
.bar-label { font-size: 0.78rem; color: var(--text-muted); }

.line-chart-wrap { position: relative; height: 240px; }
.line-chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.line-path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: drawLine 2s ease forwards;
}
.line-area { fill: url(#areaGrad); opacity: 0.25; }
.line-dot { fill: var(--surface); stroke: var(--primary); stroke-width: 3; }

.donut-legend { display: grid; gap: 0.6rem; margin-top: 1rem; }
.donut-legend li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; }

/* ===========================================================================
   14. TABLES
=========================================================================== */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.table-filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.table-filters input, .table-filters select { width: auto; min-width: 160px; padding: 0.55rem 0.9rem; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-scroll { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.data-table thead th {
  text-align: start;
  padding: 1rem 1.1rem;
  background: var(--surface-2);
  font-size: 0.82rem;
  color: var(--text-soft);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
}
.data-table thead th .sort-arrow { opacity: 0.4; font-size: 0.7rem; }
.data-table thead th.sorted .sort-arrow { opacity: 1; color: var(--primary); }
.data-table tbody td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  white-space: nowrap;
}
.data-table tbody tr { transition: var(--transition); animation: rowIn 0.4s ease backwards; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.cell-user { display: flex; align-items: center; gap: 0.6rem; }
.cell-actions { display: flex; gap: 0.35rem; }
.cell-actions button {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  transition: var(--transition);
  background: var(--surface-2);
}
.cell-actions .act-view:hover { background: var(--primary-soft); color: var(--primary); }
.cell-actions .act-edit:hover { background: var(--warning-50); color: var(--warning); }
.cell-actions .act-del:hover { background: var(--danger-50); color: var(--danger); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.pagination-info { color: var(--text-muted); font-size: 0.85rem; }
.pagination-controls { display: flex; gap: 0.3rem; }
.page-btn {
  min-width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  transition: var(--transition);
  font-size: 0.85rem;
}
.page-btn:hover:not(:disabled) { background: var(--surface-3); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===========================================================================
   15. BADGES / PILLS / CHIPS
=========================================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.7rem;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-success { background: var(--accent-soft); color: var(--emerald); }
.pill-warning { background: var(--warning-50); color: var(--warning); }
.pill-danger { background: var(--danger-50); color: var(--danger); }
.pill-info { background: var(--primary-soft); color: var(--primary); }
.pill-muted { background: var(--surface-3); color: var(--text-muted); }
[data-theme="dark"] .pill-warning { background: rgba(217,119,6,0.18); }
[data-theme="dark"] .pill-danger { background: rgba(220,38,38,0.18); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.3rem; border-bottom: 1px solid var(--border); }
.tab {
  padding: 0.7rem 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-color: var(--primary); }

/* ===========================================================================
   16. MODAL
=========================================================================== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 30, 0.55);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}
.modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal.modal-lg { max-width: 820px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-foot {
  padding: 1.1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
}
.modal-foot:empty { display: none; }

/* ===========================================================================
   17. TOAST / NOTIFICATIONS
=========================================================================== */
.toast-host {
  position: fixed;
  top: 1.2rem;
  inset-inline-end: 1.2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.toast.removing { animation: toastOut 0.35s ease forwards; }
.toast.success { border-inline-start-color: var(--emerald); }
.toast.error { border-inline-start-color: var(--danger); }
.toast.warning { border-inline-start-color: var(--warning); }
.toast-ico { font-size: 1.2rem; }
.toast-body strong { display: block; font-size: 0.92rem; }
.toast-body p { font-size: 0.84rem; color: var(--text-muted); }
.toast-close { margin-inline-start: auto; opacity: 0.5; }
.toast-close:hover { opacity: 1; }
.toast-progress {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  height: 3px;
  background: var(--primary);
  animation: toastProgress 4s linear forwards;
}

.notif-center {
  position: fixed;
  top: var(--topbar-h);
  inset-inline-end: 1rem;
  width: 360px;
  max-width: calc(100vw - 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 70;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideDown 0.25s ease;
}
.notif-center-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.notif-list { overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 0.8rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-soft); }
[data-theme="dark"] .notif-item.unread { background: rgba(34,211,238,0.08); }
.notif-item .ni-ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--surface-3);
}
.notif-item .ni-body strong { font-size: 0.9rem; }
.notif-item .ni-body p { font-size: 0.83rem; color: var(--text-muted); }
.notif-item .ni-time { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ===========================================================================
   18. CALENDAR
=========================================================================== */
.calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.cal-head h3 { font-size: 1.2rem; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
}
.cal-dow {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.5rem 0;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: 1px solid transparent;
}
.cal-day:hover { background: var(--surface-2); border-color: var(--border); }
.cal-day.muted { color: var(--text-muted); opacity: 0.4; }
.cal-day.today { background: var(--primary); color: #fff; }
.cal-day.has-event::after {
  content: "";
  position: absolute;
  bottom: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}
.cal-day.today.has-event::after { background: #fff; }

/* ===========================================================================
   19. PROFILES & DETAIL PAGES
=========================================================================== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--medical-blue-700), var(--emerald));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.profile-header::after {
  content: "";
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.15), transparent 70%);
  top: -100px; inset-inline-end: -100px;
}
.profile-header .avatar-lg { border: 4px solid rgba(255,255,255,0.3); }
.profile-header h2 { color: #fff; }
.profile-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.6rem; opacity: 0.92; font-size: 0.9rem; }
.profile-meta span { display: flex; align-items: center; gap: 0.35rem; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.info-item {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}
.info-item .il { font-size: 0.78rem; color: var(--text-muted); }
.info-item .iv { font-weight: 700; margin-top: 0.2rem; }

.list-tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  margin: 0.2rem;
}

.dept-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: #fff;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}
.dept-card:hover { transform: translateY(-6px) scale(1.01); box-shadow: var(--shadow-lg); }
.dept-card .dept-ico { font-size: 2.2rem; }
.dept-card h4 { color: #fff; font-size: 1.2rem; }
.dept-card .dept-count { font-size: 0.85rem; opacity: 0.9; }
.dept-card::before {
  content: "";
  position: absolute;
  inset-inline-end: -40px; bottom: -40px;
  width: 130px; height: 130px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .es-ico { font-size: 3rem; opacity: 0.5; margin-bottom: 0.5rem; }

/* glass + neumorphism samples */
.glass {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}
.neu {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: 8px 8px 18px rgba(0,0,0,0.08), -8px -8px 18px rgba(255,255,255,0.7);
}
[data-theme="dark"] .neu { box-shadow: 8px 8px 18px rgba(0,0,0,0.5), -8px -8px 18px rgba(255,255,255,0.03); }
.card-3d { transition: transform 0.2s ease; transform-style: preserve-3d; }

/* ===========================================================================
   20. FOOTER
=========================================================================== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.8rem 1.5rem;
  margin-top: 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 2rem;
  max-width: 1500px;
  margin-inline: auto;
}
.footer-col h5 { margin-bottom: 1rem; font-size: 1rem; }
.footer-col a { display: block; color: var(--text-muted); padding: 0.3rem 0; transition: var(--transition); font-size: 0.9rem; }
.footer-col a:hover { color: var(--primary); transform: translateX(-4px); }
.footer-about { color: var(--text-muted); margin-top: 0.8rem; line-height: 1.8; font-size: 0.9rem; }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 1500px;
  margin: 1.5rem auto 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===========================================================================
   21. SKELETON / LOADING
=========================================================================== */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
.skel-line { height: 14px; margin-bottom: 0.6rem; }
.skel-card { height: 130px; border-radius: var(--radius-lg); }
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  inset-inline-start: 1.5rem;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition);
}
.back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-4px); }

/* ===========================================================================
   22. SCROLLBAR
=========================================================================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

/* count up / typing helpers */
.type-cursor::after { content: "|"; animation: blink 1s step-end infinite; color: var(--primary); }
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ===========================================================================
   23. ANIMATIONS
=========================================================================== */
@keyframes floatBlob {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px,-30px) scale(1.1); }
  66% { transform: translate(-30px,20px) scale(0.95); }
}
@keyframes floatIcon {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(10deg); }
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes splashIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes drawRing { to { stroke-dashoffset: 0; } }
@keyframes drawPulse { to { stroke-dashoffset: 0; } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes pulseScale { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes bounceIcon { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pageFade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(40px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-120%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-120%); } }
@keyframes toastProgress { from { width: 100%; } to { width: 0; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }

/* stagger helper applied via inline delay in JS */

/* ===========================================================================
   24. RESPONSIVE
=========================================================================== */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

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

@media (max-width: 860px) {
  :root { --sidebar-w: 280px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar-w);
    transform: translateX(100%);
  }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; }
  .grid-3 { grid-template-columns: 1fr; }
  .topbar-user-info { display: none; }
  .search-global { max-width: none; }
}

@media (max-width: 640px) {
  .page-content { padding: 1.1rem; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .auth-form { padding: 1.6rem; }
  .topbar { padding: 0 1rem; }
  .stat-value { font-size: 1.6rem; }
  .otp-box { width: 42px; height: 50px; font-size: 1.2rem; }
  .profile-header { padding: 1.4rem; }
  .modal-foot { flex-direction: column; }
  .modal-foot .btn { width: 100%; }
}

@media (max-width: 420px) {
  .topbar-right .icon-btn { width: 40px; height: 40px; }
  .splash-title { font-size: 2.2rem; }
}
