/* =========================
   LIGHTHOUSE — THEME VARIABLES
   Dark = default
========================= */

:root {
  --bg1: #1a1040;
  --bg2: #2d1657;

  --text: #f8fafc;
  --muted: rgba(248,250,252,.90);

  --card-bg: rgba(255,255,255,.07);
  --card-bg-hover: rgba(255,255,255,.11);
  --stroke: rgba(255,255,255,.12);

  --btn-bg: rgba(255,255,255,.08);
  --btn-hover: rgba(255,255,255,.14);

  --input-bg: rgba(255,255,255,.08);
  --input-focus: rgba(255,255,255,.18);

  --ok-bg:    rgba(34,197,94,.20);
  --ok-text:  #bbf7d0;
  --ok-border:rgba(34,197,94,.30);

  --warn-bg:    rgba(245,158,11,.18);
  --warn-text:  #fde68a;
  --warn-border:rgba(245,158,11,.30);

  --error-bg:    rgba(239,68,68,.16);
  --error-text:  #fca5a5;
  --error-border:rgba(239,68,68,.32);

  --info-bg:    rgba(99,102,241,.22);
  --info-text:  #c7d2fe;
  --info-border:rgba(99,102,241,.38);

  --topbar-bg: rgba(255,255,255,.06);
  --sidebar-bg: rgba(20,10,50,.80);

  --primary-bg:     linear-gradient(135deg,#c084fc,#6366f1);
  --primary-border: rgba(167,139,250,.40);
  --primary-text:   #ffffff;

  --danger-bg:     rgba(239,68,68,.18);
  --danger-border: rgba(239,68,68,.35);
  --danger-text:   #fca5a5;

  --nav-active-bg:    rgba(192,132,252,.18);
  --nav-active-text:  #c084fc;
  --nav-active-border:rgba(192,132,252,.32);
  --nav-hover-bg:     rgba(255,255,255,.06);

  --shadow: 0 8px 32px rgba(0,0,0,.40);
  --shadow-sm: 0 4px 16px rgba(0,0,0,.28);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --radius-full: 999px;
}

[data-theme="light"] {
  --bg1: #e8d5f5;
  --bg2: #fde8d8;

  --text: #0f172a;
  --muted: #475569;

  --card-bg: rgba(255,255,255,.75);
  --card-bg-hover: rgba(255,255,255,.97);
  --stroke: rgba(15,23,42,.13);

  --btn-bg: rgba(255,255,255,.55);
  --btn-hover: rgba(255,255,255,.80);

  --input-bg: rgba(255,255,255,.93);
  --input-focus: #ffffff;

  --ok-bg:    rgba(34,197,94,.12);
  --ok-text:  #166534;
  --ok-border:rgba(34,197,94,.25);

  --warn-bg:    rgba(245,158,11,.12);
  --warn-text:  #92400e;
  --warn-border:rgba(245,158,11,.30);

  --error-bg:    rgba(220,38,38,.10);
  --error-text:  #991b1b;
  --error-border:rgba(220,38,38,.28);

  --info-bg:    rgba(99,102,241,.12);
  --info-text:  #3730a3;
  --info-border:rgba(99,102,241,.25);

  --topbar-bg: rgba(255,255,255,.93);
  --sidebar-bg: rgba(255,255,255,.93);

  --primary-bg:     linear-gradient(135deg,#c084fc,#6366f1);
  --primary-border: rgba(167,139,250,.45);
  --primary-text:   #ffffff;

  --danger-bg:     rgba(220,38,38,.14);
  --danger-border: rgba(220,38,38,.30);
  --danger-text:   #991b1b;

  --nav-active-bg:    rgba(99,102,241,.14);
  --nav-active-text:  #4338ca;
  --nav-active-border:rgba(99,102,241,.30);
  --nav-hover-bg:     rgba(15,23,42,.05);

  --shadow: 0 8px 32px rgba(15,23,42,.12);
  --shadow-sm: 0 4px 16px rgba(15,23,42,.08);
}

/* =========================
   RESET & BASE
========================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: 'Nunito', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 600px at 15% 20%, rgba(168,85,247,.35) 0%, transparent 60%),
    radial-gradient(700px 500px at 82% 25%, rgba(99,102,241,.30) 0%, transparent 55%),
    radial-gradient(500px 400px at 50% 80%, rgba(236,72,153,.18) 0%, transparent 60%),
    linear-gradient(145deg, var(--bg1) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  min-height: 100vh;
}

[data-theme="light"] body,
body[data-theme="light"] {
  background:
    radial-gradient(1000px 500px at 10% 15%, #c084fc 0%, transparent 55%),
    radial-gradient(800px 400px at 85% 20%, #fb923c 0%, transparent 50%),
    radial-gradient(600px 400px at 50% 85%, #f472b6 0%, transparent 55%),
    linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 100%);
}

/* Floating blobs (decorative background) */
.bg-blobs {
  position: fixed;
  inset: -40px;
  z-index: -1;
  filter: blur(60px);
  opacity: .28;
  background:
    radial-gradient(480px 300px at 15% 70%, #a855f7 0%, transparent 60%),
    radial-gradient(380px 260px at 75% 25%, #6366f1 0%, transparent 60%),
    radial-gradient(340px 240px at 88% 78%, #ec4899 0%, transparent 60%);
  pointer-events: none;
}

[data-theme="light"] .bg-blobs {
  opacity: .22;
  background:
    radial-gradient(420px 260px at 15% 70%, #818cf8 0%, transparent 60%),
    radial-gradient(360px 240px at 72% 28%, #fb923c 0%, transparent 60%),
    radial-gradient(440px 280px at 88% 78%, #ec4899 0%, transparent 60%);
}

/* =========================
   DECORATIVE ELEMENTS
========================= */

.deco-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.deco-star {
  position: absolute;
  color: rgba(255,255,255,.55);
  animation: deco-twinkle var(--dur, 3s) ease-in-out infinite alternate var(--delay, 0s);
  font-style: normal;
  user-select: none;
}
[data-theme="light"] .deco-star {
  color: rgba(99,102,241,.35);
}
@keyframes deco-twinkle {
  0%   { opacity: .15; transform: scale(.8)  rotate(0deg); }
  100% { opacity: .85; transform: scale(1.2) rotate(18deg); }
}

.deco-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.07);
  animation: deco-spin var(--dur, 30s) linear infinite;
  opacity: .45;
}
[data-theme="light"] .deco-ring {
  border-color: rgba(99,102,241,.09);
}
@keyframes deco-spin { to { transform: rotate(360deg); } }

.deco-dot {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.45);
  animation: deco-pulse var(--dur, 4s) ease-in-out infinite alternate var(--delay, 0s);
}
[data-theme="light"] .deco-dot {
  background: rgba(99,102,241,.3);
}
@keyframes deco-pulse {
  0%   { opacity: .1; transform: scale(.8); }
  100% { opacity: .45; transform: scale(1.3); }
}

/* =========================
   GLASS UTILITY
========================= */

.glass {
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.glass-sm {
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}

/* =========================
   APP SHELL — SIDEBAR LAYOUT
========================= */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--stroke);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 40;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--stroke);
  cursor: pointer;
  transition: opacity .15s;
}
.sidebar-brand:hover { opacity: .8; }

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.brand-icon:has(img),
img.brand-icon {
  background: transparent !important;
  border-color: transparent !important;
  padding: 0;
}
.brand-icon img, img.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  object-fit: contain;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .2px;
  color: var(--text);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px 4px;
  opacity: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .18s, color .18s, border-color .18s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--nav-hover-bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--nav-active-bg);
  border-color: var(--nav-active-border);
  color: var(--nav-active-text);
  font-weight: 600;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* User info bottom */
.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-text);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--muted);
  text-transform: capitalize;
}

.logout-btn {
  color: var(--muted);
  text-decoration: none;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: color .18s, background .18s;
}

.logout-btn:hover {
  color: var(--error-text);
  background: var(--error-bg);
}

/* ---- Mobile overlay ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 30;
  backdrop-filter: blur(2px);
}

/* ---- Main content area ---- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Mobile topbar */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hamburger {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
}

.hamburger:hover { color: var(--text); }

.mobile-brand { font-weight: 700; font-size: 15px; cursor: pointer; transition: opacity .15s; }
.mobile-brand:hover { opacity: .8; }

/* Scroll area */
.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* =========================
   PAGE HEADER
========================= */

.page-header {
  margin-bottom: 22px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* =========================
   CARDS
========================= */

.card {
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card:hover {
  background: var(--card-bg-hover);
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform .18s, box-shadow .18s;
}
.card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* =========================
   STAT CARD
========================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-icon { font-size: 22px; margin-bottom: 10px; display: block; }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* =========================
   GRID LAYOUTS
========================= */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* =========================
   FORMS
========================= */

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: background .18s, border-color .18s, box-shadow .18s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted);
  opacity: .7;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background: var(--input-focus);
  border-color: rgba(110,231,255,.45);
  box-shadow: 0 0 0 3px rgba(110,231,255,.12);
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus {
  border-color: rgba(99,102,241,.45);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

/* Select dropdown — option elements need solid colors (rgba ignored by browsers) */
select.form-select,
select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Dark theme — solid background for option elements */
select.form-select option,
select option {
  background-color: #1e293b;
  color: #fafbff;
}

/* Light theme — solid background for option elements */
[data-theme="light"] select.form-select option,
[data-theme="light"] select option {
  background-color: #ffffff;
  color: #0f172a;
}

/* Override select background with solid color for dark (option dropdown needs solid bg) */
select.form-select,
select {
  background-color: #1e293b;
  color: #fafbff;
  border: 1px solid rgba(255,255,255,.15);
}

[data-theme="light"] select.form-select,
[data-theme="light"] select {
  background-color: #f8fafc;
  color: #0f172a;
  border: 1px solid rgba(15,23,42,.18);
}

select.form-select:focus,
select:focus {
  background-color: #263548;
  border-color: rgba(110,231,255,.45);
  box-shadow: 0 0 0 3px rgba(110,231,255,.12);
}

[data-theme="light"] select.form-select:focus,
[data-theme="light"] select:focus {
  background-color: #ffffff;
  border-color: rgba(99,102,241,.45);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-group { margin-bottom: 14px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
}

/* =========================
   BUTTONS
========================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--btn-bg);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: .2px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s, border-color .18s, transform .15s, box-shadow .18s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  appearance: none;
  -webkit-appearance: none;
}

.btn:hover {
  background: var(--btn-hover);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn-sm {
  padding: 7px 13px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 15px;
  border-radius: var(--radius);
}

.btn-block { width: 100%; }

/* Primary */
.btn-primary {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.btn-primary:hover {
  background: var(--primary-bg);
  filter: brightness(1.15);
  box-shadow: 0 6px 20px rgba(110,231,255,.25);
}

[data-theme="light"] .btn-primary {
  box-shadow: 0 4px 16px rgba(99,102,241,.30);
}
[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 8px 24px rgba(99,102,241,.40);
  filter: brightness(1.05);
}

/* Danger */
.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

/* Success */
.btn-success {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
}

/* ── Butoane prezenta parinte: stari clare selectat/neselectat ── */
.btn-attendance {
  opacity: .55;
  border-color: var(--stroke);
  background: var(--btn-bg);
  color: var(--muted);
  font-weight: 600;
  transition: all .2s;
}
.btn-attendance:hover {
  opacity: .8;
}

.btn-attendance.btn-success {
  opacity: 1;
  background: #c6f6d5;
  border-color: #9ae6b4;
  color: #1a5c36;
  box-shadow: 0 3px 10px rgba(134,239,172,.30);
}
.btn-attendance.btn-danger {
  opacity: 1;
  background: #fde8c8;
  border-color: #fcd099;
  color: #8a3010;
  box-shadow: 0 3px 10px rgba(253,186,116,.30);
}

[data-theme="dark"] .btn-attendance.btn-success {
  background: rgba(134,239,172,.12);
  border-color: rgba(134,239,172,.30);
  color: #a7f3c0;
  box-shadow: none;
}
[data-theme="dark"] .btn-attendance.btn-danger {
  background: rgba(253,186,116,.12);
  border-color: rgba(253,186,116,.30);
  color: #fcd4a0;
  box-shadow: none;
}

/* =========================
   BADGES / CHIPS
========================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .2px;
  border: 1px solid var(--stroke);
  background: var(--card-bg);
  color: var(--muted);
}

.badge-ok      { background: var(--ok-bg);    color: var(--ok-text);    border-color: var(--ok-border); }
.badge-warn    { background: var(--warn-bg);   color: var(--warn-text);  border-color: var(--warn-border); }
.badge-error   { background: var(--error-bg);  color: var(--error-text); border-color: var(--error-border); }
.badge-info    { background: var(--info-bg);   color: var(--info-text);  border-color: var(--info-border); }
.badge-primary { background: var(--primary-bg); color: var(--primary-text); border-color: var(--primary-border); }

/* =========================
   ALERTS
========================= */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-close { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: none; color: inherit; font-size: 14px; }
.alert-close:hover { opacity: 1; }

.alert-ok    { background: var(--ok-bg);    color: var(--ok-text);    border-color: var(--ok-border); }
.alert-warn  { background: var(--warn-bg);  color: var(--warn-text);  border-color: var(--warn-border); }
.alert-error { background: var(--error-bg); color: var(--error-text); border-color: var(--error-border); }
.alert-info  { background: var(--info-bg);  color: var(--info-text);  border-color: var(--info-border); }

/* =========================
   TABLE
========================= */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.03); }

[data-theme="light"] tbody tr:hover { background: rgba(15,23,42,.03); }

/* =========================
   THEME TOGGLE
========================= */

.theme-toggle {
  background: var(--btn-bg);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-full);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: background .18s;
}

.theme-toggle:hover { background: var(--btn-hover); color: var(--text); }

/* =========================
   AUTH PAGES
========================= */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 14px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -.3px;
}

.auth-sub {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-top: 5px;
}

/* Radio role selector */
.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.role-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }

.role-option label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--stroke);
  background: var(--input-bg);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: all .18s;
  margin: 0;
}

.role-option input:checked + label {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  border-color: #7c3aed;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(124,58,237,.4);
}

.role-option label:hover {
  background: rgba(124,58,237,.12);
  border-color: #a78bfa;
  color: var(--text);
}

/* =========================
   SEPARATOR / HR
========================= */

hr {
  border: none;
  border-top: 1px solid var(--stroke);
  margin: 18px 0;
}

/* =========================
   UTILITY
========================= */

.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.items-center  { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.gap-4         { gap: 16px; }
.mt-1          { margin-top: 4px; }
.mt-2          { margin-top: 8px; }
.mt-3          { margin-top: 12px; }
.mt-4          { margin-top: 16px; }
.mb-1          { margin-bottom: 4px; }
.mb-2          { margin-bottom: 8px; }
.mb-3          { margin-bottom: 12px; }
.mb-4          { margin-bottom: 16px; }
.text-sm       { font-size: 12.5px; }
.text-muted    { color: var(--muted); }
.text-center   { text-align: center; }
.font-bold     { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate      { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =========================
   MOBILE RESPONSIVE
========================= */

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 40;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .mobile-topbar { display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 200; height: 56px; }

  .page-scroll { padding: 16px; padding-top: 72px; padding-bottom: 72px; }

  .auth-card { padding: 24px 20px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================
   SMOOTH TRANSITIONS
========================= */

*, *::before, *::after {
  transition:
    background-color .22s ease,
    color .22s ease,
    border-color .22s ease,
    box-shadow .22s ease;
}

/* But not layout transitions */
.sidebar, .app-shell { transition: transform .25s ease; }
