@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* =================================================================
   AllCan — Design System
   Identity: "Ignition Orange & Brushed Graphite"
   - Light, silver-cool workspace (the chrome swoosh of the logo)
   - Dark graphite navigation rail (the black "CAN")
   - Ignition-orange accent (the orange "ALL")
   ================================================================= */

:root {
  /* ---- Brand: ignition orange ---- */
  --brand:          oklch(0.683 0.176 46);   /* vibrant — accents, indicators, focus */
  --brand-bright:   oklch(0.735 0.168 52);   /* highlights on dark */
  --brand-fill:     oklch(0.645 0.175 45);   /* button fill (white text passes AA-large) */
  --brand-fill-hov: oklch(0.585 0.165 44);   /* button hover (darker, more contrast) */
  --brand-ink:      oklch(0.52  0.15  42);   /* orange used as text on light */
  --brand-soft:     oklch(0.955 0.030 60);   /* soft tint background */
  --brand-soft-bd:  oklch(0.88  0.075 58);   /* soft tint border */
  --brand-glow:     oklch(0.683 0.176 46 / 0.30);

  /* ---- Workspace (light, cool silver) ---- */
  --bg:           oklch(0.978 0.002 255);
  --surface:      oklch(1 0 0);
  --surface-2:    oklch(0.962 0.003 258);
  --surface-3:    oklch(0.945 0.004 258);
  --border:       oklch(0.912 0.004 260);
  --border-strong:oklch(0.860 0.006 260);

  --ink:          oklch(0.245 0.010 262);   /* primary text */
  --ink-soft:     oklch(0.470 0.013 262);   /* secondary text (~6:1 on white) */
  --ink-muted:    oklch(0.520 0.012 262);   /* labels/captions (~4.7:1 on white) */

  /* ---- Navigation rail (graphite) ---- */
  --rail:         oklch(0.205 0.009 265);
  --rail-2:       oklch(0.255 0.010 265);
  --rail-bd:      oklch(0.305 0.010 265);
  --rail-ink:     oklch(0.965 0.003 258);
  --rail-ink-soft:oklch(0.700 0.008 262);   /* ~5:1 on rail */
  --rail-hover:   oklch(1 0 0 / 0.05);
  --rail-active:  oklch(0.683 0.12 46 / 0.16);

  /* ---- Semantic ---- */
  --success: oklch(0.605 0.135 155);  --success-soft: oklch(0.955 0.035 158);
  --danger:  oklch(0.575 0.180 26);   --danger-soft:  oklch(0.955 0.030 26);
  --warning: oklch(0.660 0.140 72);   --warning-soft: oklch(0.957 0.045 80);
  --info:    oklch(0.580 0.170 258);  --info-soft:    oklch(0.955 0.030 258);

  /* ---- Geometry ---- */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-pill: 999px;
  --sidebar-w: 256px;
  --topbar-h: 64px;

  /* ---- Elevation (light theme: soft, layered) ---- */
  --shadow-sm: 0 1px 2px rgba(18,20,26,.06), 0 1px 1px rgba(18,20,26,.04);
  --shadow-md: 0 6px 16px rgba(18,20,26,.08), 0 2px 6px rgba(18,20,26,.04);
  --shadow-lg: 0 24px 56px rgba(18,20,26,.18);

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 130ms var(--ease);
  --t: 190ms var(--ease);

  /* ---- z-index scale ---- */
  --z-sticky: 1100;
  --z-sidebar: 1200;
  --z-backdrop: 1300;
  --z-modal: 1400;
  --z-toast: 1500;

  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--brand-glow); color: var(--ink); }

.app-layout { display: flex; min-height: 100vh; }

/* =================================================================
   SIDEBAR — graphite rail
   ================================================================= */
.sidebar {
  width: var(--sidebar-w);
  background: var(--rail);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-sidebar);
  transition: transform var(--t);
}

.sidebar-header {
  position: relative;
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--rail-bd);
  overflow: hidden;
}

/* the AllCan swoosh — echoes the elliptical chrome arc of the logo */
.sidebar-header::after {
  content: '';
  position: absolute;
  right: -54px;
  top: -42px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--brand);
  border-right-color: var(--brand-bright);
  opacity: 0.45;
  transform: rotate(-32deg);
  pointer-events: none;
}

.sidebar-logo { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }

.logo-mark {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--brand-bright), var(--brand-fill));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px var(--brand-glow);
  flex-shrink: 0;
}
.logo-mark svg { color: #fff; }

/* Wordmark: ALL (orange) + CAN (light) — matches the logo lockup */
.logo-text { line-height: 1; }
.logo-text .wordmark {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--rail-ink);
}
.logo-text .wordmark b { color: var(--brand-bright); font-weight: 800; }
.logo-text .tagline {
  display: block;
  margin-top: 5px;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--rail-ink-soft);
}

/* keep legacy markup working */
.logo-icon { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--rail-ink-soft);
  padding: 12px 16px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  color: var(--rail-ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px; height: 20px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
  transition: transform var(--t);
}

.nav-item:hover { background: var(--rail-hover); color: var(--rail-ink); }

.nav-item.active {
  background: var(--rail-active);
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before { transform: translateY(-50%) scaleY(1); }
.nav-item.active .nav-icon { color: var(--brand-bright); }

.nav-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: currentColor;
  transition: color var(--t-fast);
}

.sidebar-footer { padding: 14px 12px; border-top: 1px solid var(--rail-bd); }

.sidebar-footer-info {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: oklch(1 0 0 / 0.03);
}

.footer-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--brand-bright), var(--brand-fill));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.footer-text { min-width: 0; }
.footer-text p {
  font-size: 13px; font-weight: 600; color: var(--rail-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.footer-text span { font-size: 11px; color: var(--rail-ink-soft); }

/* =================================================================
   MAIN
   ================================================================= */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- Topbar ----- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 26px;
  background: oklch(1 0 0 / 0.82);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-greeting { min-width: 0; }
.topbar-greeting h1 {
  font-size: 15px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-greeting h1 b { color: var(--brand-ink); font-weight: 700; }
.topbar-greeting p { font-size: 12px; color: var(--ink-muted); }

.topbar-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.topbar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
}
.topbar-user .name { font-size: 13px; font-weight: 600; color: var(--ink); }
.topbar-user .ava {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(150deg, var(--brand-bright), var(--brand-fill));
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.content-scroll { padding: 24px 26px 40px; }

/* ===== Page header ===== */
.page-header { margin-bottom: 20px; }
.page-header h2 {
  display: flex; align-items: center; gap: 11px;
  font-size: 23px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.5px; margin-bottom: 4px;
}
.page-header h2 svg { color: var(--brand); }
.page-header p { color: var(--ink-muted); font-size: 14px; }

/* ===== Sections ===== */
.section-page { display: none; }
.section-page.active { display: block; animation: pageIn var(--t); }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =================================================================
   STATS
   ================================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.stat-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.students   { background: var(--brand-soft);   color: var(--brand-ink); }
.stat-icon.courses    { background: var(--info-soft);    color: var(--info); }
.stat-icon.records    { background: var(--surface-3);    color: var(--ink-soft); }
.stat-icon.attendance { background: var(--success-soft); color: var(--success); }

.stat-trend {
  font-size: 11px; font-weight: 600;
  color: var(--ink-muted);
  display: flex; align-items: center; gap: 4px;
}

.stat-value {
  font-size: 32px; font-weight: 800; line-height: 1;
  margin-bottom: 4px; letter-spacing: -1px; color: var(--ink);
}
.stat-label {
  font-size: 12px; color: var(--ink-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
}

/* attendance gets a progress bar so the strip isn't four identical tiles */
.stat-bar {
  margin-top: 12px; height: 6px; border-radius: var(--radius-pill);
  background: var(--surface-3); overflow: hidden;
}
.stat-bar > span {
  display: block; height: 100%; width: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--brand-fill), var(--brand-bright));
  transition: width 700ms var(--ease);
}

/* =================================================================
   PANELS (content cards)
   ================================================================= */
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.content-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 12px;
}
.content-card-header h3 {
  font-size: 14px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.content-card-header h3 .icon,
.content-card-header h3 svg { color: var(--brand); display: inline-flex; }

.content-card-body { padding: 20px; }

.header-actions { display: flex; align-items: center; gap: 10px; }

/* ===== Filter tabs (segmented control) ===== */
.filter-tabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.filter-tab {
  padding: 6px 18px;
  font-family: var(--font);
  font-size: 12px; font-weight: 600;
  background: transparent; color: var(--ink-muted);
  border: none; cursor: pointer; border-radius: var(--radius-pill);
  transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.filter-tab:hover { color: var(--ink); }
.filter-tab.active {
  background: var(--surface);
  color: var(--brand-ink);
  box-shadow: var(--shadow-sm);
}

/* =================================================================
   FORMS
   ================================================================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
}
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-group label {
  font-size: 11px; font-weight: 700; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13.5px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--ink-muted); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-group input::placeholder { color: var(--ink-muted); }
.form-group select { cursor: pointer; }
.form-group select option { background: var(--surface); color: var(--ink); }

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* =================================================================
   BUTTONS
   ================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), color var(--t-fast);
  text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-glow); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand-fill); color: #fff; box-shadow: 0 2px 8px var(--brand-glow); }
.btn-primary:hover { background: var(--brand-fill-hov); box-shadow: 0 6px 18px var(--brand-glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--surface); color: var(--ink-soft); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-muted); }

.btn-danger  { background: var(--danger-soft);  color: var(--danger); }
.btn-danger:hover  { background: oklch(0.575 0.18 26 / 0.16); }
.btn-success { background: var(--success-soft); color: var(--success); }
.btn-success:hover { background: oklch(0.605 0.135 155 / 0.18); }
.btn-warning { background: var(--warning-soft); color: oklch(0.52 0.13 70); }
.btn-warning:hover { background: oklch(0.66 0.14 72 / 0.20); }

.btn-icon { padding: 9px; width: 38px; }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-xs { padding: 5px 10px; font-size: 11.5px; border-radius: 7px; }

.action-btns { display: flex; gap: 6px; flex-wrap: nowrap; }

/* =================================================================
   TABLES
   ================================================================= */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-xs); }
table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 11px 14px; text-align: left;
  font-size: 10.5px; font-weight: 700;
  color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.8px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background var(--t-fast); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--brand-soft); }

tbody td {
  padding: 11px 14px; font-size: 13px; color: var(--ink-soft); white-space: nowrap;
}
tbody td:first-child { color: var(--ink-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
tbody td:nth-child(2) { color: var(--ink); font-weight: 600; }

/* =================================================================
   BADGES
   ================================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
  border: 1px solid transparent;
}
.badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge-presente, .badge-ativo { background: var(--success-soft); color: oklch(0.50 0.13 155); border-color: oklch(0.605 0.135 155 / 0.2); }
.badge-ausente,  .badge-inativo { background: var(--danger-soft);  color: oklch(0.50 0.17 26);  border-color: oklch(0.575 0.18 26 / 0.2); }
.badge-admin { background: var(--brand-soft);  color: var(--brand-ink); border-color: var(--brand-soft-bd); }
.badge-user  { background: var(--surface-3);   color: var(--ink-soft);  border-color: var(--border-strong); }

/* =================================================================
   MODAL
   ================================================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: oklch(0.20 0.01 265 / 0.55);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; animation: fadeIn var(--t-fast); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 600px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 220ms var(--ease);
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--ink); }

.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); color: var(--ink-muted);
  border: none; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); }

.modal-body { padding: 22px; overflow-y: auto; }
.modal-body .form-grid { grid-template-columns: 1fr 1fr; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.confirm-text {
  font-size: 14.5px; color: var(--ink-soft); line-height: 1.7;
  text-align: center; padding: 12px 0;
}
.confirm-text strong { color: var(--ink); font-weight: 700; }

/* =================================================================
   TOAST
   ================================================================= */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: var(--z-toast);
  display: flex; flex-direction: column-reverse; gap: 10px;
}
.toast {
  padding: 13px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 380px;
  border-left: 1px solid var(--border);
  animation: toastIn 320ms var(--ease);
}
.toast::before {
  content: ''; width: 4px; align-self: stretch; border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.toast-success::before { background: var(--success); }
.toast-error::before { background: var(--danger); }
.toast.removing { animation: toastOut 220ms var(--ease) forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* =================================================================
   EMPTY + SKELETON
   ================================================================= */
.empty-state { text-align: center; padding: 44px 20px; color: var(--ink-muted); }
.empty-state .icon, .empty-state svg {
  display: inline-flex; margin-bottom: 12px; color: var(--border-strong);
}
.empty-state .icon { font-size: 36px; opacity: 0.5; }
.empty-state p { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.empty-state .hint { font-size: 12.5px; color: var(--ink-muted); margin-top: 4px; font-weight: 400; }

.skeleton-row td { padding: 13px 14px; }
.skeleton-bar {
  height: 12px; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== Spinner ===== */
.spinner {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid oklch(1 0 0 / 0.35);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-secondary .spinner, .btn-xs .spinner { border-color: var(--border-strong); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* =================================================================
   MOBILE
   ================================================================= */
.mobile-menu-btn {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: calc(var(--z-sidebar) + 1);
  width: 40px; height: 40px;
  background: var(--rail); border: 1px solid var(--rail-bd);
  border-radius: var(--radius-xs); color: var(--rail-ink);
  cursor: pointer; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
}

.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: oklch(0.20 0.01 265 / 0.5);
  z-index: var(--z-backdrop);
}
.sidebar-backdrop.show { display: block; }

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

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { padding: 0 16px 0 60px; }
  .topbar-greeting h1 { font-size: 14px; }
  .content-scroll { padding: 18px 16px 32px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .modal-body .form-grid { grid-template-columns: 1fr; }
  .page-header h2 { font-size: 20px; }
  .content-card-header { align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-user .name { display: none; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--rail-bd); border-color: var(--rail); }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
