/* ============================================================
   UZES 2.0 — Design System
   v2: bulletproof dark mode + Bootstrap 5 dark overrides
   ============================================================ */

:root {
  /* ----- Accent (user-swappable) ----- */
  --accent-h: 217;
  --accent-s: 86%;
  --accent-l: 32%;

  --brand-50:  hsl(var(--accent-h) var(--accent-s) 96%);
  --brand-100: hsl(var(--accent-h) var(--accent-s) 90%);
  --brand-200: hsl(var(--accent-h) var(--accent-s) 80%);
  --brand-300: hsl(var(--accent-h) var(--accent-s) 65%);
  --brand-400: hsl(var(--accent-h) var(--accent-s) 50%);
  --brand-500: hsl(var(--accent-h) var(--accent-s) 40%);
  --brand-600: hsl(var(--accent-h) var(--accent-s) var(--accent-l));      /* base */
  --brand-700: hsl(var(--accent-h) var(--accent-s) calc(var(--accent-l) - 6%));
  --brand-800: hsl(var(--accent-h) var(--accent-s) calc(var(--accent-l) - 14%));
  --brand-900: hsl(var(--accent-h) var(--accent-s) calc(var(--accent-l) - 22%));

  --brand-rgb: 14,71,150; /* sync at runtime via JS if needed */

  /* ----- Neutrals ----- */
  --bg:        #f4f6fa;
  --bg-soft:   #eef1f6;
  --surface:   #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #f3f5f9;
  --border:    #e3e7ee;
  --border-strong: #cfd6e1;
  --text:      #1a2233;
  --text-muted:#5a6478;
  --text-dim:  #8a93a6;

  /* ----- Status ----- */
  --success-50:  #e7f6ec;
  --success-600: #1d8f4f;
  --success-700: #156c3b;
  --warning-50:  #fdf3e0;
  --warning-600: #b87808;
  --warning-700: #8a5a06;
  --danger-50:   #fae8ea;
  --danger-600:  #c0353f;
  --danger-700:  #93222b;
  --info-50:     #e6f1f9;
  --info-600:    #1a6da6;
  --info-700:    #134d76;

  /* ----- Sidebar (always dark) ----- */
  --sidebar-bg:    #0a2855;
  --sidebar-bg-2:  #0d3370;
  --sidebar-text:  rgba(255,255,255,0.82);
  --sidebar-dim:   rgba(255,255,255,0.55);
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active:rgba(255,255,255,0.14);
  --sidebar-accent: hsl(var(--accent-h) 90% 60%);

  /* ----- Shape ----- */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* ----- Shadow ----- */
  --shadow-1: 0 1px 2px rgba(15,28,55,0.04), 0 1px 1px rgba(15,28,55,0.03);
  --shadow-2: 0 2px 4px rgba(15,28,55,0.05), 0 4px 12px rgba(15,28,55,0.04);
  --shadow-3: 0 4px 12px rgba(15,28,55,0.08), 0 12px 32px rgba(15,28,55,0.08);

  /* ----- Type ----- */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --sidebar-w: 248px;
  --topbar-h:  64px;

  /* sidebar style follows accent — keep it deep */
  --sidebar-bg:   hsl(var(--accent-h) 65% 14%);
  --sidebar-bg-2: hsl(var(--accent-h) 60% 22%);
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --bg:        #0c1118;
  --bg-soft:   #131922;
  --surface:   #1a212c;
  --surface-2: #20283a;
  --surface-3: #262f43;
  --border:    #2a3344;
  --border-strong: #3a455a;
  --text:      #e8edf5;
  --text-muted:#a2acbe;
  --text-dim:  #7a8499;

  /* lighter accent shades in dark */
  --brand-50:  hsl(var(--accent-h) 60% 18%);
  --brand-100: hsl(var(--accent-h) 60% 24%);
  --brand-600: hsl(var(--accent-h) 75% 62%);
  --brand-700: hsl(var(--accent-h) 75% 70%);

  --success-50: #0e2a1a;
  --success-600: #4ade80;
  --success-700: #86efac;
  --warning-50: #2a1f0a;
  --warning-600: #f5c069;
  --warning-700: #fcd9a0;
  --danger-50:  #2a1216;
  --danger-600: #f08a92;
  --danger-700: #f5b3b8;
  --info-50:    #0e1f2c;
  --info-600:   #6ec3ec;
  --info-700:   #9bd5f1;

  --sidebar-bg:   #0a1320;
  --sidebar-bg-2: #0e1a2e;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-3: 0 6px 24px rgba(0,0,0,0.5);

  color-scheme: dark;
}

/* ============================================================
   BASE
   ============================================================ */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  /* NOT: html/body'ye overflow-x:hidden VERME — sidebar position:sticky'yi kırar.
     Yatay taşma min-width:0 + grid auto-fill min(100%) + topbar nowrap ile engelleniyor. */
}
body { min-height: 100vh; }

h1,h2,h3,h4,h5,h6 { margin: 0; font-weight: 600; letter-spacing: -0.018em; color: var(--text); }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
h4 { font-size: 16px; } h5 { font-size: 14.5px; } h6 { font-size: 13px; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }

small, .small { font-size: 12.5px; }
.text-muted, .form-text { color: var(--text-muted) !important; }
.text-dim   { color: var(--text-dim) !important; }
.text-primary { color: var(--brand-600) !important; }
.text-success { color: var(--success-600) !important; }
.text-warning { color: var(--warning-600) !important; }
.text-danger  { color: var(--danger-600) !important; }
.text-info    { color: var(--info-600) !important; }
.text-secondary { color: var(--text-muted) !important; }
.text-dark { color: var(--text) !important; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.mono { font-family: var(--font-mono); }

::selection { background: var(--brand-100); color: var(--brand-900); }
[data-theme="dark"] ::selection { background: var(--brand-100); color: var(--text); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  isolation: isolate;
  transition: grid-template-columns 0.25s ease;
}

/* ── Desktop: sidebar collapse ── */
.app.sidebar-collapsed {
  grid-template-columns: 0px 1fr;
}
.app.sidebar-collapsed .sidebar {
  overflow: hidden;
  min-width: 0;
  width: 0;
  padding: 0;
  visibility: hidden;
}

/* ── Sidebar (masaüstü: grid içinde sticky, overlay değil) ── */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* scroll içerideki .sidebar-scroll'da; brand+foot sabit */
  z-index: 10;
  transition: none;
}

/* Sidebar 3 bölge: brand (sabit üst) + scroll (kayan orta) + foot (sabit alt) */
.sidebar-brand { flex-shrink: 0; }
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;             /* flex column'da scroll için şart */
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Eğitim Grid ──
   Container genişliğine göre otomatik kolon: ~300px altına düşmeden sığdığı kadar.
   min(100%,300px) → çok dar container'da (≈280px) taşmayı önler, tek kolona iner.
   Viewport değil CONTAINER ölçüldüğü için sidebar açılıp kapandığında kendini ayarlar. */
.egitim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
}

/* ── Eğitim Kart Renkleri ── */
.egitim-card-tamamlandi  { background: #e8f5e9 !important; border: 1.5px solid #a5d6a7 !important; }
.egitim-card-devam       { background: #fff8e1 !important; border: 1.5px solid #ffe082 !important; }
.egitim-card-suresi-doldu{ background: #fce4ec !important; border: 1.5px solid #f48fb1 !important; }
.egitim-card-baslamamis  { background: #f0f4ff !important; border: 1.5px solid #c5cae9 !important; }

.egitim-card-tamamlandi  .egitim-card-img { background: rgba(232,245,233,0.5); }
.egitim-card-devam       .egitim-card-img { background: rgba(255,248,225,0.5); }
.egitim-card-suresi-doldu .egitim-card-img{ background: rgba(252,228,236,0.5); }
.egitim-card-baslamamis  .egitim-card-img { background: rgba(240,244,255,0.5); }

/* ── Mobil overlay backdrop ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.active { display: block; }

/* ── Mobil (≤767px): sidebar fixed overlay olarak açılır ── */
@media (max-width: 767px) {
  /* KRİTİK: sidebar position:fixed ile grid akışından çıkar. .app grid kalırsa
     app-content otomatik yerleşimle 0px'lik ilk track'e düşüp sıfır genişliğe
     sıkışır (kartlar kaybolur, topbar çöker). Bloka çevirince içerik tam
     genişlik akar; sidebar üstte fixed overlay olarak kalır. */
  .app, .app.sidebar-collapsed {
    display: block;
  }
  /* Sidebar sayfanın dışında bekleyen bağımsız katman.
     height:100vh YERİNE top:0;bottom:0 — fixed öğede yüksekliği GÖRÜNÜR viewport'a
     kesin sabitler (100vh mobilde URL çubuğu dahil olup taşardı, foot ekran dışına
     kayardı). Böylece brand üste, foot ekranın dibine kesin dayanır. */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    height: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    visibility: visible !important;
  }
  /* Açık hâl */
  .app.sidebar-open .sidebar {
    transform: translateX(0);
  }
  /* Kapalı hâl (collapsed override) */
  .app.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    visibility: visible !important;
  }
  /* Topbar: breadcrumb gizle, padding azalt */
  .crumbs { display: none !important; }
  .topbar { padding: 0 12px; }
  /* Main içerik padding azalt */
  .main { padding: 14px 12px 32px !important; }
  /* Sayfa başlığındaki istatistik satırı gizle */
  .page-header-stats { display: none !important; }
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, hsl(45, 95%, 52%) 0%, hsl(45, 95%, 65%) 100%);
  display: grid; place-items: center;
  color: hsl(var(--accent-h) 65% 18%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25), inset 0 -1px 1px rgba(0,0,0,0.1);
}
.brand-title { font-weight: 700; font-size: 15px; color: white; letter-spacing: -0.01em; }
.brand-sub   { font-size: 10.5px; color: var(--sidebar-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }

.sidebar-section {
  padding: 18px 16px 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.42);
  font-weight: 600;
}
.sidebar-nav { list-style: none; padding: 2px 10px; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  text-decoration: none;
  position: relative;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: white; text-decoration: none; }
.sidebar-link.active { background: var(--sidebar-active); color: white; }
.sidebar-link.active::before {
  content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px;
  width: 3px; background: var(--sidebar-accent); border-radius: 0 3px 3px 0;
}
.sidebar-link i, .sidebar-link svg { width: 16px; text-align: center; font-size: 13px; opacity: 0.9; flex-shrink: 0; }
.sb-badge {
  margin-left: auto;
  background: hsl(45 90% 55%);
  color: #2a1f00;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.5;
}
.sidebar-foot {
  flex-shrink: 0;            /* altta sabit kalsın, kayan alanın dışında */
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.user-meta { min-width: 0; flex: 1; }
.user-name { color: white; font-weight: 600; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--sidebar-dim); margin-top: 1px; }

/* ============================================================
   TOPBAR
   ============================================================ */
.app-content { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;          /* asla iki satıra kırılma */
  gap: 8px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }  /* daralınca crumbs kısalsın */
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }                 /* butonlar sıkışmasın */
.crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
  flex-wrap: nowrap;          /* dikey dizilme yok */
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--text-dim); font-size: 10px; }
.crumbs .current { color: var(--text); font-weight: 600; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: inline-grid; place-items: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); border-color: var(--border); }
.icon-btn.active { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger-600);
  border: 2px solid var(--surface);
}

.profile-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.profile-pill:hover { border-color: var(--border-strong); background: var(--bg-soft); }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: white;
  display: grid; place-items: center;
  font-weight: 600; font-size: 11.5px;
  flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.md { width: 40px; height: 40px; font-size: 14px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.profile-pill .meta { font-size: 12.5px; line-height: 1.1; }
.profile-pill .meta .name { font-weight: 600; color: var(--text); }
.profile-pill .meta .role { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  padding: 22px 24px 48px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.page-sub   { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-1);
  color: var(--text);
  overflow: hidden;
}
.card-pad   { padding: 20px 22px; }
.card-pad-lg{ padding: 28px; }
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3, .card-head h4 { font-size: 14px; font-weight: 600; }
.card-head .sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.card-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-muted);
}

/* Bootstrap card-* compatibility */
.card-header, .card-body, .card-footer { background: transparent !important; color: inherit !important; border-color: var(--border) !important; }
.card-header { border-bottom: 1px solid var(--border) !important; padding: 14px 20px; }
.card-footer { border-top: 1px solid var(--border) !important; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit;
  font-size: 13.5px; font-weight: 600; line-height: 1;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.14s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--brand-600) 0%, var(--brand-700) 100%) !important;
  color: white !important;
  border-color: var(--brand-700) !important;
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255,255,255,0.14);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--brand-700), var(--brand-800)) !important; color: white !important; }

.btn-secondary, .btn-outline-secondary {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-1);
}
.btn-secondary:hover, .btn-outline-secondary:hover { background: var(--bg-soft) !important; border-color: var(--border-strong) !important; color: var(--text) !important; }

.btn-outline-primary {
  background: transparent !important;
  border: 1px solid var(--brand-600) !important;
  color: var(--brand-600) !important;
}
.btn-outline-primary:hover {
  background: var(--brand-600) !important;
  color: white !important;
  border-color: var(--brand-700) !important;
}
.btn-outline-success {
  background: transparent !important;
  border: 1px solid var(--success-600) !important;
  color: var(--success-600) !important;
}
.btn-outline-success:hover { background: var(--success-600) !important; color: white !important; }
.btn-outline-warning {
  background: transparent !important;
  border: 1px solid var(--warning-600) !important;
  color: var(--warning-600) !important;
}
.btn-outline-warning:hover { background: var(--warning-600) !important; color: white !important; }
.btn-outline-danger {
  background: transparent !important;
  border: 1px solid var(--danger-600) !important;
  color: var(--danger-600) !important;
}
.btn-outline-danger:hover { background: var(--danger-600) !important; color: white !important; }
.btn-outline-info {
  background: transparent !important;
  border: 1px solid var(--info-600) !important;
  color: var(--info-600) !important;
}
.btn-outline-info:hover { background: var(--info-600) !important; color: white !important; }
.btn-outline-dark {
  background: transparent !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
}
.btn-outline-dark:hover { background: var(--surface-2) !important; color: var(--text) !important; }

.btn-success { background: var(--success-600) !important; color: white !important; border-color: var(--success-700) !important; }
.btn-success:hover { background: var(--success-700) !important; color: white !important; }
.btn-warning { background: var(--warning-600) !important; color: white !important; border-color: var(--warning-700) !important; }
.btn-warning:hover { background: var(--warning-700) !important; color: white !important; }
.btn-danger { background: var(--danger-600) !important; color: white !important; border-color: var(--danger-700) !important; }
.btn-danger:hover { background: var(--danger-700) !important; color: white !important; }
.btn-info { background: var(--info-600) !important; color: white !important; border-color: var(--info-700) !important; }

.btn-light {
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.btn-light:hover { background: var(--bg-soft) !important; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }

.btn-sm { padding: 6px 10px; font-size: 12.5px; gap: 6px; border-radius: 6px; }
.btn-lg { padding: 12px 18px; font-size: 14.5px; }
.btn-block, .w-100 { width: 100%; }

/* ============================================================
   INPUTS / FORMS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.label, .form-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted) !important;
}
.input, .form-control, .form-select, .textarea, textarea.form-control {
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  padding: 9px 12px;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--text) !important;
  transition: border-color 0.14s, box-shadow 0.14s;
  line-height: 1.4;
}
.input:hover, .form-control:hover, .form-select:hover { border-color: var(--border-strong) !important; }
.input:focus, .form-control:focus, .form-select:focus, .textarea:focus {
  outline: none !important;
  border-color: var(--brand-500) !important;
  box-shadow: 0 0 0 3px hsl(var(--accent-h) var(--accent-s) 50% / 0.18) !important;
}
.input.lg, .form-control-lg { font-size: 15px; padding: 12px 14px; }
.form-control-sm, .form-select-sm { font-size: 12.5px; padding: 6px 10px; }
.input.mono, input.mono { font-family: var(--font-mono); letter-spacing: 0.04em; }
.textarea, textarea.form-control { min-height: 84px; resize: vertical; }

.input-with-icon { position: relative; }
.input-with-icon > i, .input-with-icon > svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none; font-size: 14px;
}
.input-with-icon input, .input-with-icon select, .input-with-icon .input { padding-left: 40px !important; }
.input-with-icon input.lg, .input-with-icon .input.lg { padding-left: 44px !important; }

.form-check-input {
  background-color: var(--surface) !important;
  border: 1px solid var(--border-strong) !important;
}
.form-check-input:checked {
  background-color: var(--brand-600) !important;
  border-color: var(--brand-700) !important;
}
.form-check-label { color: var(--text); }

.input-group-text {
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}

::placeholder { color: var(--text-dim); opacity: 0.8; }

/* ============================================================
   TABLES — also override Bootstrap
   ============================================================ */
.table, table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  color: var(--text);
  margin: 0;
  background: transparent;
}
.table thead th, .table-light thead th, thead.table-light th {
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted) !important;
  padding: 12px 16px;
  background: var(--surface-2) !important;
  border-bottom: 1px solid var(--border) !important;
  border-top: none !important;
  white-space: nowrap;
}
.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border) !important;
  background: transparent !important;
  color: var(--text);
  vertical-align: middle;
  border-top: none !important;
}
.table tbody tr:hover td, .table-hover tbody tr:hover td, .table-hover tbody tr:hover {
  background: var(--surface-2) !important;
  --bs-table-hover-bg: var(--surface-2);
  color: var(--text);
}
.table tbody tr:last-child td { border-bottom: none !important; }
.table .num { font-variant-numeric: tabular-nums; }
.table-responsive { background: transparent; }

/* ============================================================
   BADGES (incl. Bootstrap variants)
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.5;
}
.badge-dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

.badge-success, .bg-success-subtle.text-success {
  background: var(--success-50) !important;
  color: var(--success-700) !important;
  border-color: hsl(140 50% 35% / 0.25) !important;
}
.badge-warning, .bg-warning-subtle.text-warning {
  background: var(--warning-50) !important;
  color: var(--warning-700) !important;
  border-color: hsl(40 80% 40% / 0.25) !important;
}
.badge-danger, .bg-danger-subtle.text-danger {
  background: var(--danger-50) !important;
  color: var(--danger-700) !important;
  border-color: hsl(0 60% 45% / 0.25) !important;
}
.badge-info, .bg-info-subtle.text-info {
  background: var(--info-50) !important;
  color: var(--info-700) !important;
  border-color: hsl(200 60% 40% / 0.25) !important;
}
.badge-brand, .badge.bg-primary-subtle.text-primary, .bg-primary-subtle {
  background: var(--brand-50) !important;
  color: var(--brand-700) !important;
  border-color: hsl(var(--accent-h) var(--accent-s) 50% / 0.22) !important;
}
.badge-neutral, .bg-secondary-subtle, .bg-secondary-subtle.text-secondary {
  background: var(--bg-soft) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
}

/* solid Bootstrap badges */
.badge.bg-success { background: var(--success-600) !important; color: white !important; }
.badge.bg-warning { background: var(--warning-600) !important; color: white !important; }
.badge.bg-danger  { background: var(--danger-600)  !important; color: white !important; }
.badge.bg-primary { background: var(--brand-600)   !important; color: white !important; }
.badge.bg-info    { background: var(--info-600)    !important; color: white !important; }
.badge.bg-secondary { background: var(--text-muted) !important; color: white !important; }
.badge.bg-light   { background: var(--bg-soft) !important; color: var(--text) !important; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 14px;
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--text);
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-info    { background: var(--info-50)    !important; border-color: hsl(200 60% 40% / 0.25) !important; color: var(--info-700) !important; }
.alert-success { background: var(--success-50) !important; border-color: hsl(140 50% 35% / 0.25) !important; color: var(--success-700) !important; }
.alert-warning { background: var(--warning-50) !important; border-color: hsl(40 80% 40% / 0.25) !important;  color: var(--warning-700) !important; }
.alert-danger, .alert-error { background: var(--danger-50)  !important; border-color: hsl(0 60% 45% / 0.25) !important;  color: var(--danger-700) !important; }
.alert-secondary { background: var(--surface-2) !important; border-color: var(--border) !important; color: var(--text) !important; }

/* ============================================================
   STAT CARD
   ============================================================ */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-value {
  font-size: 30px; font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-delta {
  font-size: 12px; font-weight: 600;
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.stat-delta.up   { color: var(--success-600); }
.stat-delta.down { color: var(--danger-600); }
.stat-icon {
  position: absolute;
  top: 18px; right: 18px;
  width: 36px; height: 36px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 14px;
}
.stat.success .stat-icon { background: var(--success-50); color: var(--success-700); }
.stat.warning .stat-icon { background: var(--warning-50); color: var(--warning-700); }
.stat.danger  .stat-icon { background: var(--danger-50);  color: var(--danger-700); }
.stat.info    .stat-icon { background: var(--info-50);    color: var(--info-700); }

/* Bootstrap card stat-card pattern in their templates */
.stat-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-1);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
/* Recolor Bootstrap's border-start primary/success/etc. */
.border-primary { border-color: var(--brand-600) !important; }
.border-success { border-color: var(--success-600) !important; }
.border-warning { border-color: var(--warning-600) !important; }
.border-danger  { border-color: var(--danger-600) !important; }
.border-info    { border-color: var(--info-600) !important; }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress {
  width: 100%; height: 8px;
  background: var(--bg-soft) !important;
  border-radius: 999px;
  overflow: hidden;
}
.progress > div, .progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-700)) !important;
  color: white;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress.success > div, .progress.success .progress-bar { background: linear-gradient(90deg, hsl(140 60% 45%), var(--success-600)) !important; }
.progress.warning > div, .progress.warning .progress-bar { background: linear-gradient(90deg, hsl(40 85% 55%), var(--warning-600)) !important; }
.progress.thin { height: 5px; }
.progress.thick { height: 12px; }

/* ============================================================
   ITEM LIST (list-group too)
   ============================================================ */
.item-list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.item:last-child { border-bottom: none; }
.item-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-50);
  color: var(--brand-700);
  flex-shrink: 0; font-size: 14px;
}
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; font-size: 14px; line-height: 1.3; color: var(--text); }
.item-sub   { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

/* Bootstrap list-group dark-mode fix */
.list-group { border-radius: 10px; }
.list-group-item, .list-group-item-action {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.list-group-flush .list-group-item { border-left: 0 !important; border-right: 0 !important; }
.list-group-item-action:hover { background: var(--surface-2) !important; color: var(--text) !important; }

/* ============================================================
   ACCORDION (Bootstrap) — dark mode safe
   ============================================================ */
.accordion {
  --bs-accordion-bg: transparent;
  --bs-accordion-color: var(--text);
  --bs-accordion-border-color: var(--border);
  --bs-accordion-btn-color: var(--text);
  --bs-accordion-btn-bg: var(--surface);
  --bs-accordion-active-bg: var(--brand-50);
  --bs-accordion-active-color: var(--brand-700);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 3px hsl(var(--accent-h) var(--accent-s) 50% / 0.15);
  background: transparent;
}
.accordion-item {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.accordion-button {
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}
.accordion-button:not(.collapsed) {
  background: var(--brand-50) !important;
  color: var(--brand-700) !important;
}
.accordion-button::after { filter: var(--accordion-caret-filter, none); }
[data-theme="dark"] .accordion-button::after { filter: brightness(2); }
.accordion-body { background: var(--surface) !important; color: var(--text); }

/* ============================================================
   DROPDOWN (Bootstrap)
   ============================================================ */
.dropdown-menu {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-3);
  border-radius: 10px !important;
  padding: 6px;
}
.dropdown-item {
  color: var(--text) !important;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13.5px;
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--bg-soft) !important; color: var(--text) !important; }
.dropdown-item.active { background: var(--brand-50) !important; color: var(--brand-700) !important; }
.dropdown-divider { border-top: 1px solid var(--border) !important; }
.dropdown-header { color: var(--text-muted) !important; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; padding: 8px 10px 4px; }
.dropdown-item.text-danger { color: var(--danger-600) !important; }
.dropdown-item.text-danger:hover { background: var(--danger-50) !important; color: var(--danger-700) !important; }

/* ============================================================
   MODAL (Bootstrap)
   ============================================================ */
.modal-content {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--text);
  box-shadow: var(--shadow-3);
}
.modal-header, .modal-footer { border-color: var(--border) !important; }
.modal-title { color: var(--text); }
.btn-close { filter: var(--btn-close-filter, none); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(2); }

/* ============================================================
   BACKGROUND OVERRIDES (Bootstrap)
   ============================================================ */
.bg-white  { background: var(--surface) !important; }
.bg-light  { background: var(--surface-2) !important; }
.bg-body   { background: var(--bg) !important; }
.bg-transparent { background: transparent !important; }
.text-white { color: white !important; } /* keep */
.border, .border-bottom, .border-top, .border-start, .border-end { border-color: var(--border) !important; }

/* ============================================================
   TABS (custom)
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 14px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }

/* ============================================================
   SEGMENTED control
   ============================================================ */
.segmented {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--border);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty-art {
  width: 120px; height: 120px;
  margin: 0 auto 16px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 30%, var(--brand-50) 0%, transparent 50%),
    repeating-linear-gradient(45deg, var(--surface-2) 0 8px, transparent 8px 16px);
  display: grid; place-items: center;
  border: 1px dashed var(--border-strong);
  color: var(--brand-600);
}
.empty h4 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 360px; margin: 0 auto 16px; color: var(--text-muted); }

/* ============================================================
   APPEARANCE POPOVER (the new feature)
   ============================================================ */
.appearance-popover {
  position: absolute;
  top: calc(var(--topbar-h) + 4px);
  right: 24px;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-3);
  z-index: 50;
  padding: 16px;
  animation: popIn 0.18s cubic-bezier(0.2, 0, 0.2, 1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }

.ap-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ap-title { font-size: 14px; font-weight: 700; color: var(--text); }
.ap-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

.ap-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 600;
  margin: 16px 0 8px;
}
.ap-section-label:first-child { margin-top: 0; }

.color-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.swatch {
  aspect-ratio: 1;
  border-radius: 9px;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.selected {
  border-color: var(--surface);
  box-shadow: 0 0 0 2px var(--text), 0 4px 12px rgba(0,0,0,0.15);
}
.swatch.selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.theme-card {
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}
.theme-card:hover { border-color: var(--border-strong); color: var(--text); }
.theme-card.active { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); }
.theme-card .preview {
  width: 100%; height: 38px; border-radius: 6px;
  border: 1px solid var(--border-strong);
  overflow: hidden;
  display: flex;
}
.theme-card .preview .side { width: 30%; }
.theme-card .preview .body { flex: 1; }
.theme-card.light .preview { border-color: #cbd5e1; }
.theme-card.light .preview .side { background: #0a2855; }
.theme-card.light .preview .body { background: #f4f6fa; }
.theme-card.dark  .preview .side { background: #0a1320; }
.theme-card.dark  .preview .body { background: #0c1118; }
.theme-card.auto  .preview .side { background: linear-gradient(180deg, #0a2855 0%, #0a2855 50%, #0a1320 50%, #0a1320 100%); }
.theme-card.auto  .preview .body { background: linear-gradient(180deg, #f4f6fa 0%, #f4f6fa 50%, #0c1118 50%, #0c1118 100%); }

.ap-save-bar {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Toast */
.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast-msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success-600);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-3);
  font-size: 13px;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-msg i { color: var(--success-600); font-size: 15px; }

/* ============================================================
   GRID HELPERS
   ============================================================ */
.grid { display: grid; gap: 16px; }
.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-12 { grid-template-columns: 2fr 1fr; }
@media (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-12 { grid-template-columns: 1fr; }
}
.row-flex, .row { display: flex; gap: 12px; align-items: center; }
.col-flex { display: flex; flex-direction: column; gap: 12px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.divider { height: 1px; background: var(--border); }

/* ============================================================
   AUTH
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 5fr 7fr;
  background: var(--bg);
}
.auth-side {
  background:
    radial-gradient(800px 600px at 80% 20%, hsl(45 90% 50% / 0.10), transparent 60%),
    radial-gradient(600px 400px at 20% 80%, hsl(var(--accent-h) var(--accent-s) 65% / 0.16), transparent 60%),
    linear-gradient(160deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 60%, hsl(var(--accent-h) 70% 28%) 100%);
  color: white;
  padding: 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-side::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(255,255,255,0.04) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(255,255,255,0.04) 39px 40px);
  mask-image: radial-gradient(circle at 50% 50%, black, transparent 80%);
  pointer-events: none;
}
.auth-side > * { position: relative; z-index: 1; }
.auth-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.auth-form { width: 100%; max-width: 400px; }
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* ============================================================
   EXAM FOCUS
   ============================================================ */
.exam-shell { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.exam-bar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 5;
}
.exam-progress-bar { height: 3px; width: 100%; background: var(--bg-soft); }
.exam-progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--brand-600), var(--brand-700)); transition: width 0.3s; }
.exam-body { flex: 1; max-width: 880px; margin: 0 auto; width: 100%; padding: 36px 28px 80px; }
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 36px;
  box-shadow: var(--shadow-2);
}
.choice {
  display: flex; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.14s;
  align-items: flex-start;
}
.choice:hover { border-color: var(--brand-300); background: var(--brand-50); }
.choice.selected {
  border-color: var(--brand-600);
  background: var(--brand-50);
  box-shadow: 0 0 0 3px hsl(var(--accent-h) var(--accent-s) 50% / 0.15);
}
.choice .letter {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.choice.selected .letter { background: var(--brand-700); color: white; border-color: var(--brand-700); }
.choice .choice-text { font-size: 14.5px; padding-top: 4px; }

.question-nav { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.qnav {
  aspect-ratio: 1;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: grid; place-items: center;
}
.qnav.answered { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); }
.qnav.current  { background: var(--brand-700); border-color: var(--brand-700); color: white; }

/* ============================================================
   VIDEO PLAYER (simplified)
   ============================================================ */
.video-frame {
  background: #000;
  aspect-ratio: 16/9;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  position: relative;
  display: grid; place-items: center;
}
.video-poster {
  position: absolute; inset: 0;
  background:
    linear-gradient(135deg, hsl(var(--accent-h) 65% 18% / 0.85), hsl(var(--accent-h) 60% 30% / 0.85)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 12px, transparent 12px 24px);
  display: grid; place-items: center;
}
.play-button {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.5);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  cursor: pointer;
  color: white;
  transition: all 0.2s;
}
.play-button:hover { background: rgba(255,255,255,0.28); transform: scale(1.05); }

.video-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px 20px 12px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.7));
  color: white;
  display: flex; flex-direction: column; gap: 8px;
}
.vc-track { height: 4px; background: rgba(255,255,255,0.2); border-radius: 999px; position: relative; }
.vc-track .filled { position: absolute; top: 0; left: 0; height: 100%; background: var(--brand-500); border-radius: 999px; }
.vc-track .filled::after { content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; border-radius: 50%; background: white; }
.vc-row { display: flex; align-items: center; gap: 14px; font-size: 12.5px; }
.vc-btn { background: transparent; border: 0; color: white; cursor: pointer; font-size: 16px; padding: 4px; }
.vc-time { font-variant-numeric: tabular-nums; opacity: 0.85; }
.vc-spacer { flex: 1; }

/* ============================================================
   DENSITY
   ============================================================ */
.density-tight  { --topbar-h: 56px; }
.density-tight  .main { padding: 16px 20px 32px; }
.density-tight  .card-pad { padding: 16px 18px; }
.density-tight  .table tbody td { padding: 10px 14px; }
.density-tight  .stat { padding: 14px 16px; }
.density-tight  .stat-value { font-size: 26px; }
.density-tight  .sidebar-link { padding: 7px 12px; font-size: 13px; }

.density-comfortable { --topbar-h: 64px; }
.density-relaxed { --topbar-h: 72px; }
.density-relaxed .main { padding: 32px 36px 64px; }
.density-relaxed .card-pad { padding: 24px 26px; }
.density-relaxed .table tbody td { padding: 16px 18px; }
.density-relaxed .stat-value { font-size: 34px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.3s ease both; }
.stagger > * { animation: fadeIn 0.4s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
.stagger > *:nth-child(7) { animation-delay: 0.26s; }
.stagger > *:nth-child(8) { animation-delay: 0.30s; }

/* ============================================================
   UTIL
   ============================================================ */
.opacity-25 { opacity: 0.25; }
.shadow-sm { box-shadow: var(--shadow-1) !important; }
.shadow    { box-shadow: var(--shadow-2) !important; }
.shadow-lg { box-shadow: var(--shadow-3) !important; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 0%, var(--surface-2) 50%, var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
