/* ==========================================================================
   GradLink — Multi-College Alumni Network
   Design System v1.0 (Swiss Modernist Direction)
   ========================================================================== */

:root {
  /* --- Approved Palette A --- */
  --primary: #2457A7;
  --primary-hover: #1b4588;
  --primary-light: #EBF1FA;
  --primary-ink: #FFFFFF;
  
  --secondary-coral: #E8795B;
  --secondary-coral-hover: #d26547;
  --secondary-coral-light: #FDF1EE;
  
  --accent-gold: #F5C66A;
  --accent-gold-light: #FEF8ED;
  
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F1F3F6;
  --surface-3: #E6E9EE;
  
  --text: #1E293B;
  --text-muted: #5B6676;
  --text-dim: #8A94A6;
  
  --border: #E2E6EC;
  --border-subtle: #EDF0F4;
  --border-focus: #2457A7;
  
  /* Functional High-Contrast Accents */
  --functional-coral: #C95F45;
  --functional-amber: #9A5B00;
  
  /* Proposed & Contrast-Verified Semantic Status */
  --success: #166534;
  --success-bg: #DCFCE7;
  --success-border: #86EFAC;
  
  --warning: #92400E;
  --warning-bg: #FEF3C7;
  --warning-border: #FCD34D;
  
  --danger: #B42318;
  --danger-bg: #FEE2E2;
  --danger-border: #FCA5A5;
  
  --info: #1D4ED8;
  --info-bg: #DBEAFE;
  --info-border: #93C5FD;
  
  --neutral-badge: #475569;
  --neutral-bg: #F1F5F9;
  --neutral-border: #CBD5E1;

  /* --- Approved 8-Point Spacing System --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* --- Approved Radii & Heights --- */
  --radius-sm: 6px;
  --radius-btn: 8px;
  --radius-input: 8px;
  --radius: 10px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  --btn-h-compact: 32px;
  --btn-h-standard: 38px;
  --btn-h-prominent: 42px;
  --input-h: 38px;

  /* --- Approved Card & Overlay Elevation --- */
  --shadow-sm: 0 1px 2px rgba(38, 52, 73, 0.04);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 16px -4px rgba(38, 52, 73, 0.10), 0 2px 6px -1px rgba(38, 52, 73, 0.05);
  --shadow-lg: 0 12px 32px -6px rgba(38, 52, 73, 0.16), 0 4px 12px rgba(38, 52, 73, 0.06);

  /* --- Approved Typography: Plus Jakarta Sans --- */
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

/* ==========================================================================
   CSS Reset & Base Rules
   ========================================================================== */

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

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--primary-hover);
}

img, svg {
  vertical-align: middle;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }

/* Compact page header title used at the top of every page */
.page-title { font-size: 22px; font-weight: 700; margin: 2px 0 4px; }
p { margin-bottom: 0.75rem; color: var(--text); }
p:last-child { margin-bottom: 0; }

.text-muted, .muted { color: var(--text-muted); }
.small { font-size: 13px; line-height: 1.45; }
.caption { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* Focus Accessibility */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ==========================================================================
   Top Header (Topbar)
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

/* The mark carries its own blue tile, so the wrapper is just a sizing box */
.brand-symbol-wrap {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.brand-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand-grad { color: #263449; }
.brand-link { color: #2457A7; }

.brand-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 4px;
  margin-left: 2px;
}

.topbar-center {
  flex: 1;
  max-width: 480px;
  margin: 0 var(--space-5);
}

.search-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
  width: 16px;
  height: 16px;
}

.search-box input,
.search-box input[type="search"],
#global-search {
  width: 100%;
  height: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 0 16px 0 42px !important;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.search-box input:focus,
#global-search:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 87, 167, 0.12);
  outline: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-toggle-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

/* ==========================================================================
   App Layout (Sidebar + Fluid Main)
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s ease;
  z-index: 90;
}

.sidebar-nav {
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 6px var(--space-3);
  margin-bottom: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--space-3);
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

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

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

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--primary);
}

.nav-item .badge {
  margin-left: auto;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
}

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Fluid Main Content */
.main-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-6) var(--space-6) var(--space-8);
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 901px) {
  #app-sidebar.collapsed {
    width: 72px;
    padding: var(--space-4) var(--space-2);
  }
  #app-sidebar.collapsed .nav-section-title,
  #app-sidebar.collapsed .nav-item span,
  #app-sidebar.collapsed .nav-item .badge,
  #app-sidebar.collapsed .sidebar-footer {
    display: none;
  }
  #app-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
  }
}

/* Auth Centered Fullscreen Mode */
body.page-auth #app-sidebar,
body.page-auth .sidebar-toggle-btn,
body.page-auth .topbar-center,
body.page-auth .mobile-bottom-nav {
  display: none !important;
}

body.page-auth .topbar {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}

body.page-auth .main-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: var(--space-6) var(--space-4);
}

body.page-auth .main-content > * {
  width: 100%;
}

.sidebar-backdrop {
  display: none;
}

/* ==========================================================================
   Buttons (Sections 6.5 & 8.1)
   ========================================================================== */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  height: var(--btn-h-standard);
  padding: 0 var(--space-4);
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #FFFFFF;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: #d1cfc7;
}

.btn-coral {
  background: var(--secondary-coral);
  color: #FFFFFF;
  border-color: var(--secondary-coral);
}

.btn-coral:hover {
  background: var(--secondary-coral-hover);
  color: #FFFFFF;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #991b1b;
}

.btn-outline-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-outline-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-outline-success {
  background: var(--surface);
  color: var(--success);
  border-color: var(--success-border);
}

.btn-outline-success:hover {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.btn-sm {
  height: var(--btn-h-compact);
  padding: 0 var(--space-3);
  font-size: 13px;
}

.btn-lg {
  height: var(--btn-h-prominent);
  padding: 0 var(--space-5);
  font-size: 15px;
}

.icon-btn {
  width: var(--btn-h-standard);
  height: var(--btn-h-standard);
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-btn);
}

button:disabled, .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   Cards & Surfaces (Sections 6.4 & 8.2)
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  box-shadow: var(--shadow-md);
  border-color: #CBD2DC;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h2, .card-header h3 {
  margin: 0;
}

/* ==========================================================================
   Hero Banner (Swiss Modernist)
   ========================================================================== */

.hero-banner {
  background: linear-gradient(135deg, #2457A7 0%, #1A3E78 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-6);
  margin-bottom: var(--space-5);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero-banner::after {
  content: '';
  position: absolute;
  right: -50px;
  bottom: -50px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 198, 106, 0.2) 0%, rgba(232, 121, 91, 0.1) 60%, transparent 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #FFFFFF;
  margin-bottom: var(--space-4);
}

.hero-title {
  color: #FFFFFF;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: var(--space-3);
}

.hero-desc {
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: var(--space-5);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.btn-hero-primary {
  background: var(--accent-gold);
  color: #263449;
  border-color: var(--accent-gold);
  font-weight: 700;
}

.btn-hero-primary:hover {
  background: #f7d28b;
  color: #263449;
}

.btn-hero-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
}

.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}

/* ==========================================================================
   Grids & Layout Containers
   ========================================================================== */

.grid {
  display: grid;
  gap: var(--space-4);
}

/* KPI row: as many 200px+ tiles as fit */
.grid-stats { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

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

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

/* Stat Cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--primary);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   Badges, Chips & Status Pills (Section 4.3 & 8.6)
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-success, .badge.VERIFIED, .badge.ACTIVE, .badge.SUCCESS {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.badge-warning, .badge.PENDING, .badge.WAITLISTED {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.badge-danger, .badge.REJECTED, .badge.SUSPENDED, .badge.FAILED {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.badge-info, .badge.OPEN, .badge.INFO {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}

.badge-neutral {
  background: var(--neutral-bg);
  color: var(--neutral-badge);
  border-color: var(--neutral-border);
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ==========================================================================
   Form Controls (Sections 6.6 & 8.3)
   ========================================================================== */

.field {
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
}

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.input, .select, select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"]:not(#global-search), input[type="date"] {
  height: var(--input-h);
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 0 var(--space-3);
  transition: all 0.15s ease;
}

textarea, .textarea {
  min-height: 104px;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: var(--space-3);
  resize: vertical;
  line-height: 1.5;
  transition: all 0.15s ease;
}

.input:focus, .select:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 87, 167, 0.12);
}

.field-error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

.segmented-control {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: var(--radius-btn);
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented-control button {
  flex: 1 0 auto;
  padding: 0 14px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Progress Bar (Section 8.6)
   ========================================================================== */

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

.progress-fill.coral {
  background: var(--secondary-coral);
}

/* ==========================================================================
   Tables & Data Lists (Section 8.5)
   ========================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

thead th {
  background: var(--surface-2);
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #F8FAFC;
}

/* Last column holds row actions: one line, pinned to the right edge while the table scrolls */
tbody td:last-child { white-space: nowrap; }
.table-wrap thead th:last-child,
.table-wrap tbody td:last-child {
  position: sticky;
  right: 0;
  box-shadow: inset 1px 0 0 var(--border-subtle);
}
.table-wrap tbody td:last-child { background: var(--surface); }
.table-wrap tbody tr:hover td:last-child { background: #F8FAFC; }
.nowrap { white-space: nowrap; }

/* ==========================================================================
   Modals & Dialogs (Section 8.4)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(38, 52, 73, 0.48);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.15s ease-out;
}

.modal-card,
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-6);
  position: relative;
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalScale { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ==========================================================================
   Toasts & Alerts
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: slideUp 0.25s ease-out;
}

.toast-error {
  background: var(--danger);
}

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

/* ==========================================================================
   Mobile Bottom Navigation & Breakpoints (Section 6.1 & 7)
   ========================================================================== */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--space-2);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  flex: 1;
  padding: 6px 0;
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 900px) {
  .topbar-center { display: none; }
  .sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.active {
    display: block;
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(38, 52, 73, 0.4);
    z-index: 85;
  }
  .main-content {
    padding: var(--space-4) var(--space-4) 80px;
  }
  .mobile-bottom-nav {
    display: flex;
  }
}

@media (max-width: 768px) {
  #dir-filter-form {
    grid-template-columns: 1fr !important;
  }
}

.topbar-user-text { display: flex; flex-direction: column; }

/* Phones: the top bar keeps logo, bell, avatar and logout; the name and tag would push logout off-screen */
@media (max-width: 600px) {
  .topbar-user-text,
  .brand-tag {
    display: none;
  }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { padding: 12px 14px; }
}
