/**
 * ============================================================================
 * InstituteCRM — AURORA Design System v2
 * Premium SaaS aesthetic: Glass-morphism, violet-indigo gradients,
 * refined micro-animations, and modern card layouts.
 * ============================================================================
 */

:root {
  /* Font Families */
  --font-sans: "DM Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Sizing & Radii */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Base Light Palette */
  --background: #f0f2f8;
  --foreground: #111827;
  --card: #ffffff;
  --card-foreground: #111827;
  --card-subtle: #fafbff;

  /* Brand Primary — Indigo-Violet Fusion */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-active: #4338ca;
  --primary-foreground: #ffffff;
  --primary-subtle: rgba(99, 102, 241, 0.08);
  --primary-glow: rgba(99, 102, 241, 0.25);

  /* Secondary & Muted */
  --secondary: #f1f3f9;
  --secondary-foreground: #1e293b;
  --muted: #f1f3f9;
  --muted-foreground: #6b7280;
  --accent: #f5f3ff;
  --accent-foreground: #111827;

  /* Borders & Inputs */
  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.13);
  --input: rgba(0, 0, 0, 0.08);
  --input-bg: #ffffff;
  --ring: #6366f1;

  /* Status Colors */
  --success: #10b981;
  --success-foreground: #ffffff;
  --success-subtle: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-foreground: #ffffff;
  --warning-subtle: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --destructive-subtle: #fef2f2;
  --destructive-border: #fecaca;
  --destructive-text: #991b1b;

  --brand-foreground: #ffffff;

  /* Navigation & Sidebar — Deep Charcoal + Indigo accent */
  --sidebar: #111827;
  --sidebar-hover: #1f2937;
  --sidebar-foreground: #f9fafb;
  --sidebar-muted: #9ca3af;
  --sidebar-accent: rgba(255, 255, 255, 0.06);
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.06);

  /* Gradients & Shadows */
  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  --gradient-surface: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 8px 30px rgba(99, 102, 241, 0.25);
  --shadow-panel: var(--shadow-xl);
}

/* ========================================================================== */
/* Base Reset                                                                 */
/* ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
}

html, body { margin: 0; padding: 0; min-height: 100vh; }

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--foreground);
  margin-top: 0;
}

p { margin-top: 0; }
a { color: inherit; text-decoration: none; }

button, input, optgroup, select, textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}

.hidden { display: none !important; }

/* Layout Utilities */
.min-h-screen { min-height: 100vh; }
.center { display: flex; align-items: center; justify-content: center; }
.container-xl { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.muted { color: var(--muted-foreground); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.flex-center-gap { display: flex; align-items: center; gap: 0.5rem; }

/* ========================================================================== */
/* Buttons System                                                             */
/* ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.15rem;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 50%);
  pointer-events: none;
  border-radius: inherit;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn svg { flex-shrink: 0; }

/* Button Variants */
.btn-primary {
  background: var(--gradient-brand);
  color: var(--primary-foreground);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  border: none;
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--muted);
  border-color: var(--border-strong);
}

.btn-outline {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border-strong);
}
.btn-outline:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  border: none;
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--primary-subtle);
  color: var(--primary);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: var(--success-foreground);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  border: none;
}
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }

.btn-destructive, .btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: var(--destructive-foreground);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
  border: none;
}
.btn-destructive:hover:not(:disabled), .btn-danger:hover:not(:disabled) { filter: brightness(1.08); }

.btn-sidebar {
  background: var(--sidebar-accent);
  color: var(--sidebar-foreground);
  border-color: transparent;
}
.btn-sidebar:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-block { width: 100%; }

/* Fee Filter Pill Buttons */
.btn-paid {
  background: var(--success-subtle);
  color: var(--success-text);
  border-color: var(--success-border);
}
.btn-paid:hover:not(:disabled), .btn-paid.active {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}
.btn-paid.active { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }

.btn-due {
  background: var(--destructive-subtle);
  color: var(--destructive-text);
  border-color: var(--destructive-border);
}
.btn-due:hover:not(:disabled), .btn-due.active {
  background: var(--destructive);
  color: #ffffff;
  border-color: var(--destructive);
}
.btn-due.active { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

/* ========================================================================== */
/* Inputs & Forms                                                             */
/* ========================================================================== */
.field { margin-bottom: 1.25rem; }

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.45rem;
  letter-spacing: 0;
}

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field textarea,
.field select,
.table-search,
select.table-search,
.time12-input,
.input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--input);
  background: var(--input-bg);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: var(--shadow-xs);
}

.field input::placeholder,
.field textarea::placeholder,
.table-search::placeholder {
  color: var(--muted-foreground);
  opacity: 0.7;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.table-search:focus,
select.table-search:focus,
.time12-input:focus,
.input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: var(--input-bg);
}

.field textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.5;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.field input[type="file"] {
  padding: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--accent);
  cursor: pointer;
}

/* Switch Component */
.switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
  vertical-align: middle;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.25s ease;
}
.switch .track::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.switch input:checked + .track {
  background: var(--gradient-brand);
}
.switch input:checked + .track::before {
  transform: translateX(20px);
}
.switch input:disabled + .track {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Progress Bar */
.progress {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--muted);
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Spinner */
.spinner {
  width: 1.1em;
  height: 1.1em;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  vertical-align: -0.15em;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================================== */
/* Badges                                                                     */
/* ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: var(--radius-full);
  padding: 0.25rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success-text);
  border-color: var(--success-border);
}

.badge-destructive {
  background: var(--destructive-subtle);
  color: var(--destructive-text);
  border-color: var(--destructive-border);
}

.badge-sidebar {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.2);
}

/* ========================================================================== */
/* Brandmark                                                                  */
/* ========================================================================== */
.brandmark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brandmark .glyph {
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--gradient-brand);
  box-shadow: var(--shadow-glow);
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brandmark.lg .glyph { width: 48px; height: 48px; border-radius: var(--radius-xl); }
.brandmark.sm .glyph { width: 32px; height: 32px; border-radius: var(--radius-md); }

.brandmark .glyph svg { width: 58%; height: 58%; stroke: #ffffff; fill: none; }
.brandmark .leading-none { line-height: 1; }

.brandmark .name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-size: 1.05rem;
  margin: 0;
  color: var(--foreground);
}

.brandmark.lg .name { font-size: 1.45rem; }
.brandmark.sm .name { font-size: 0.95rem; }

.brandmark .sub {
  margin: 0.25rem 0 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted-foreground);
}

.brandmark.inverted .name { color: #ffffff; }
.brandmark.inverted .sub { color: rgba(255, 255, 255, 0.55); }

/* ========================================================================== */
/* App Shell & Navigation Layout                                              */
/* ========================================================================== */
.shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--background);
}

.sidebar {
  width: 270px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.15rem 0.25rem 0.75rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sb-brand { min-width: 0; overflow: hidden; }

.sb-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: var(--sidebar-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sb-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sb-role {
  align-self: flex-start;
  margin: 0 0.25rem 0.35rem;
  letter-spacing: 0.1em;
  font-size: 0.65rem;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.15rem;
  flex: 1;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--sidebar-muted);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  position: relative;
}

.side-link .ico {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.side-link:hover {
  color: #ffffff;
  background: var(--sidebar-accent);
}

.side-link.active {
  background: var(--gradient-brand);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
  border-color: transparent;
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-bottom .who { padding: 0 0.35rem; }

.sidebar-bottom .who p {
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ffffff;
}

.sidebar-bottom .who p.sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--sidebar-muted);
  margin-top: 0.15rem;
}

.sb-signout {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Collapsed Sidebar */
.shell.collapsed .sidebar {
  width: 72px;
  align-items: center;
  padding: 1rem 0.6rem;
}

.shell.collapsed .sidebar .txt,
.shell.collapsed .sb-brand .name,
.shell.collapsed .sb-brand .sub,
.shell.collapsed .sb-role,
.shell.collapsed .sidebar-bottom .who { display: none; }

.shell.collapsed .side-link {
  justify-content: center;
  padding: 0.65rem 0;
  width: 44px;
  margin: 0 auto;
}

.shell.collapsed .sb-signout {
  justify-content: center;
  padding: 0.55rem;
  width: 44px;
}

.shell.collapsed .sb-toggle {
  transform: rotate(180deg);
  margin: 0;
}

.shell.collapsed .sidebar-top {
  justify-content: center;
  width: 100%;
}

/* Topbar Header */
.shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 68px;
  padding: 0 2rem;
  background: rgba(240, 242, 248, 0.75);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--foreground);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sb-open {
  display: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s;
}

.sb-open:hover { background: var(--accent); }

.app-main {
  max-width: 1360px;
  margin: 0;
  width: 100%;
  padding: 2rem 2rem 4rem;
}

/* ========================================================================== */
/* Cards & Containers                                                         */
/* ========================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.surface {
  background: var(--gradient-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* ========================================================================== */
/* Dashboard Stat KPI Cards                                                   */
/* ========================================================================== */
.stat-grid {
  display: grid;
  gap: 1.15rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.75rem;
}

@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) {
  .stat-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .stat-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  padding: 1.35rem 1.45rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.25s ease;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.stat-card .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.stat-card .label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}

.stat-card .icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  background: var(--muted);
  color: var(--muted-foreground);
  transition: transform 0.25s ease;
}

.stat-card .icon svg { width: 20px; height: 20px; }

.stat-card .icon.brand {
  background: var(--primary-subtle);
  color: var(--primary);
}

.stat-card .icon.success {
  background: var(--success-subtle);
  color: var(--success);
}

.stat-card .icon.warning {
  background: var(--warning-subtle);
  color: var(--warning);
}

.stat-card .icon.destructive {
  background: var(--destructive-subtle);
  color: var(--destructive);
}

.stat-card .value {
  margin-top: 0.9rem;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}

.stat-card .hint {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted-foreground);
}

/* Clickable Stat Cards */
.stat-card.stat-clickable { cursor: pointer; }

.stat-card.stat-clickable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(99, 102, 241, 0.2);
}

.stat-card.stat-clickable:hover::before {
  background: var(--gradient-brand);
}

.stat-card.stat-clickable:hover .icon { transform: scale(1.1) rotate(-3deg); }
.stat-card.stat-clickable:active { transform: translateY(-1px); }

.stat-card.stat-clickable:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ========================================================================== */
/* Section Cards, Tabs & Controls                                             */
/* ========================================================================== */
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 2rem;
}

.section-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 1.15rem 1.5rem;
  background: var(--card);
  gap: 1rem;
}

.section-card h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.list-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted-foreground);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: all 0.18s ease;
  user-select: none;
}

.tab:hover {
  background: var(--accent);
  border-color: var(--primary);
  color: var(--primary);
}

.tab.active {
  background: var(--gradient-brand);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.tab-count {
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-full);
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.tab.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Quick Date Range */
.quick-range-btns {
  display: flex;
  gap: 0.2rem;
  background: var(--muted);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.btn.quick-range {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.btn.quick-range:hover { color: var(--foreground); background: rgba(0,0,0,0.03); }

.btn.quick-range.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

/* ========================================================================== */
/* Data Tables & Excel-Style Data Sheets                                      */
/* ========================================================================== */
.sheet-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  max-height: 38rem;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.sheet-wrap::-webkit-scrollbar { width: 7px; height: 7px; }
.sheet-wrap::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

table.sheet {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

table.sheet th, table.sheet td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.9rem;
  text-align: left;
  white-space: nowrap;
  max-width: 20rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

table.sheet th:last-child, table.sheet td:last-child { border-right: none; }

table.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f3f4f8;
  color: #4b5563;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
}

table.sheet tbody tr:nth-child(even) td { background: #fafbfe; }
table.sheet tbody tr:hover td { background: rgba(99, 102, 241, 0.04); }

table.sheet .rownum {
  width: 3.25rem;
  text-align: center;
  color: var(--muted-foreground);
  background: #f8f9fc;
  font-size: 0.75rem;
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid var(--border);
}

table.sheet thead .rownum { z-index: 6; background: #f3f4f8; }
table.sheet td.num, table.sheet th.num { text-align: right; }

/* Status-specific row treatments */
table.sheet tbody tr.row-paid td { background: rgba(16, 185, 129, 0.05); }
table.sheet tbody tr.row-paid td.rownum { border-left: 3px solid var(--success); color: var(--success); }

table.sheet tbody tr.row-due td { background: rgba(239, 68, 68, 0.05); }
table.sheet tbody tr.row-due td.rownum { border-left: 3px solid var(--destructive); color: var(--destructive); }

table.sheet tbody tr.row-new td { background: rgba(99, 102, 241, 0.04); }
table.sheet tbody tr.row-new td.rownum { border-left: 3px solid var(--primary); }

table.sheet tbody tr.row-interested td { background: rgba(245, 158, 11, 0.05); }
table.sheet tbody tr.row-interested td.rownum { border-left: 3px solid var(--warning); }

table.sheet tbody tr.row-converted td { background: rgba(16, 185, 129, 0.05); }
table.sheet tbody tr.row-converted td.rownum { border-left: 3px solid var(--success); }

table.sheet tbody tr.row-notint td { background: rgba(107, 114, 128, 0.05); }
table.sheet tbody tr.row-notint td.rownum { border-left: 3px solid var(--muted-foreground); }

table.sheet tfoot td {
  position: sticky;
  bottom: 0;
  background: #f3f4f8;
  font-weight: 700;
  border-top: 2px solid var(--border);
  z-index: 4;
}

table.sheet .actions-col { text-align: right; white-space: nowrap; }

.row-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
}

/* Expandable Record Detail */
table.sheet tbody tr.rec-expand { cursor: pointer; }

table.sheet tbody tr.rec-expand .rec-caret {
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  color: var(--muted-foreground);
}

table.sheet tbody tr.rec-expanded .rec-caret { transform: rotate(90deg); }

table.sheet tbody tr.rec-detail-row td {
  background: var(--accent);
  padding: 1rem 1.25rem;
  border-top: none;
}

.rec-detail-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rec-detail-data {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  column-gap: 1.5rem;
  row-gap: 0.85rem;
}

.rec-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.rec-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.rec-detail-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--foreground);
  overflow-wrap: anywhere;
}

.rec-detail-actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Standard Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  font-weight: 700;
  background: var(--muted);
}

.data-table tbody tr:hover { background: var(--accent); }

/* ========================================================================== */
/* Modal Dialogs                                                              */
/* ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 100;
  animation: modal-fade 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 28rem;
  width: 100%;
  padding: 1.75rem 2rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.15);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: modal-pop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal.modal-wide { max-width: 48rem; }

.modal.modal-wide #modal-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

.modal.modal-wide #modal-form .field:last-child { grid-column: 1 / -1; }

@media (max-width: 680px) {
  .modal.modal-wide #modal-form { grid-template-columns: 1fr; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-head .desc {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: 0.35rem 0 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--destructive-subtle);
  color: var(--destructive);
  border-color: var(--destructive-border);
}

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.35rem;
}

.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ========================================================================== */
/* Fee Management Styles                                                      */
/* ========================================================================== */
.fee-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.fee-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.fee-box::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-brand);
  opacity: 0.4;
}

.fee-box .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--muted-foreground);
}

.fee-box .value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0.4rem 0 0;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}

.fee-box.due .value { color: var(--destructive); }
.fee-box.due::after { background: linear-gradient(135deg, #ef4444, #dc2626); }

.pay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

.pay-table th, .pay-table td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  text-align: left;
}

.pay-table th {
  background: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}

.pay-table td.num, .pay-table th.num { text-align: right; }

/* Fee Hero Grid: Left Filters + Right Chart */
.fee-hero-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  align-items: stretch;
}

@media (max-width: 960px) {
  .fee-hero-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Filter Panel */
.fee-filter-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}

.fee-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.fee-card-title {
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.fee-select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.fee-mini-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fee-select-compact {
  padding: 0.5rem 0.65rem !important;
  font-size: 0.82rem !important;
  height: 2.35rem;
  width: 100% !important;
  box-sizing: border-box;
}

.fee-filter-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.fee-filter-row .btn {
  padding: 0.4rem 0.2rem;
  font-size: 0.78rem;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.fee-quick-range-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
}

.fee-quick-range-grid .qr-btn {
  padding: 0.45rem 0.2rem !important;
  font-size: 0.77rem !important;
  font-weight: 600;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: var(--radius-md);
}

.fee-quick-range-grid .qr-all { grid-column: span 2; }
.fee-quick-range-grid .qr-today { grid-column: span 2; }
.fee-quick-range-grid .qr-week { grid-column: span 2; }
.fee-quick-range-grid .qr-month { grid-column: span 3; }
.fee-quick-range-grid .qr-year { grid-column: span 3; }

.fee-search-compact {
  padding: 0.5rem 0.75rem !important;
  font-size: 0.825rem !important;
  height: 2.35rem;
  width: 100% !important;
  box-sizing: border-box;
}

.fee-export-btn {
  width: 100%;
  justify-content: center;
  margin-top: auto;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Right Chart Card */
.fee-chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.fee-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.fee-chart-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.fee-chart-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.fee-chart-sub {
  font-size: 0.73rem;
  color: var(--muted-foreground);
}

.fee-chart-tabs {
  display: inline-flex;
  background: var(--muted);
  border-radius: var(--radius-md);
  padding: 0.2rem;
  gap: 0.25rem;
  border: 1px solid var(--border);
}

.fee-chart-tab-btn {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.32rem 0.7rem;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: all 0.2s ease;
}

.fee-chart-tab-btn:hover {
  color: var(--foreground);
}

.fee-chart-tab-btn.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

/* Quick Metrics Row Inside Chart Card */
.fee-chart-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.55rem 0.75rem;
  background: var(--muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.fee-metric-item {
  display: flex;
  flex-direction: column;
}

.fee-metric-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--muted-foreground);
}

.fee-metric-val {
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--foreground);
  margin-top: 0.1rem;
  font-variant-numeric: tabular-nums;
}

.fee-metric-val.collected {
  color: #10b981;
}

.fee-metric-val.due {
  color: #ef4444;
}

/* Chart Canvas / Visual Bars Container */
.fee-bars-container {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 155px;
  padding: 0.35rem 0.25rem 0;
  overflow-x: auto;
  position: relative;
  scrollbar-width: thin;
}

.fee-bar-col {
  flex: 1;
  min-width: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}

.fee-bar-amt {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted-foreground);
  margin-bottom: 0.3rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s ease;
}

.fee-bar-amt.has-val {
  color: var(--foreground);
}

.fee-bar-amt.zero {
  opacity: 0.6;
}

.fee-bar-col:hover .fee-bar-amt {
  color: var(--primary);
  font-weight: 800;
}

.fee-bar-track {
  width: 100%;
  max-width: 30px;
  height: 95px;
  background: var(--muted);
  border-radius: var(--radius-sm) var(--radius-sm) 2px 2px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.fee-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #6366f1 0%, #3b82f6 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.fee-bar-fill.has-val {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.fee-bar-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-top: 0.4rem;
  text-align: center;
  white-space: nowrap;
}

.fee-bar-col:hover .fee-bar-label {
  color: var(--foreground);
  font-weight: 700;
}

/* Tooltip for bar */
.fee-bar-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #f8fafc;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: nowrap;
  z-index: 30;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.fee-bar-col:hover .fee-bar-tooltip {
  display: block;
}

/* ========================================================================== */
/* Student ID Card                                                            */
/* ========================================================================== */
.idcard-stage {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem 0;
}

.idcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.idcard-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-sm);
}

.idcard-cell .idcard-stage { padding: 0; }

.idcard-cell .idcard {
  transform: scale(0.72);
  transform-origin: top center;
  margin-bottom: -10rem;
}

.idcard-cell-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
}

.idcard {
  width: 340px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.1);
  font-family: var(--font-sans);
  color: #111827;
}

.idc-head {
  padding: 1.2rem 1rem 1.25rem;
  text-align: center;
  color: #ffffff;
  background: linear-gradient(135deg, #312e81 0%, #6366f1 55%, #8b5cf6 100%);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.idc-badge {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.65rem;
  border-radius: 50%;
  background: #ffffff;
  color: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.idc-badge img { width: 100%; height: 100%; object-fit: contain; }

.idc-inst {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.2;
}

.idc-branch {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

.idc-body {
  padding: 1.25rem 1.35rem 0.65rem;
  text-align: center;
}

.idc-photo {
  width: 104px;
  height: 104px;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #6366f1;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #6b7280;
  box-shadow: var(--shadow-md);
}

.idc-photo img { width: 100%; height: 100%; object-fit: cover; }

.idc-name { margin: 0; font-size: 1.1rem; font-weight: 800; letter-spacing: -0.01em; }
.idc-course { margin: 0.25rem 0 0.95rem; font-size: 0.8125rem; font-weight: 700; color: #6366f1; }

.idc-fields { text-align: left; }

.idc-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.idc-row:last-child { border-bottom: 0; }
.idc-label { width: 96px; flex: none; font-weight: 600; color: #6b7280; }
.idc-value { flex: 1; font-weight: 700; word-break: break-word; color: #111827; }

.idc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.35rem 0.75rem;
  background: #f8f9fc;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.72rem;
}

.idc-no { color: #6b7280; font-weight: 600; }
.idc-sign { color: #6366f1; font-weight: 700; font-style: italic; }

/* ========================================================================== */
/* Charts & Analytics                                                         */
/* ========================================================================== */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  padding: 1.25rem;
}

.chart-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.chart-card.wide { grid-column: 1 / -1; }
.chart-card h3 { margin: 0 0 1rem; font-size: 0.95rem; font-weight: 700; }

.chart-donut-wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.chart-donut { width: 160px; height: 160px; flex: none; }
.donut-value { font-size: 22px; font-weight: 800; fill: var(--foreground); }
.donut-label { font-size: 9px; font-weight: 700; fill: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.08em; }

.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  font-size: 0.8125rem;
  min-width: 0;
  flex: 1;
}

.chart-legend li { display: flex; align-items: center; gap: 0.5rem; }
.chart-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.chart-legend .pct { color: var(--muted-foreground); font-size: 0.75rem; min-width: 2.5rem; text-align: right; }
.chart-legend .dot { width: 0.65rem; height: 0.65rem; border-radius: var(--radius-full); flex: none; }

.chart-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }
.chart-bars li { display: grid; grid-template-columns: 8rem 1fr auto; align-items: center; gap: 0.75rem; font-size: 0.8125rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); font-weight: 500; }
.bar-track { background: var(--muted); border-radius: var(--radius-full); height: 0.6rem; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: var(--radius-full); transition: width 0.6s ease; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ========================================================================== */
/* Login Page                                                                 */
/* ========================================================================== */
.login-grid {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr;
  background: var(--background);
}

@media (min-width: 1024px) { .login-grid { grid-template-columns: 1.15fr 0.85fr; } }

.login-hero {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
  background: linear-gradient(135deg, #111827 0%, #1f2937 40%, #312e81 80%, #6366f1 100%);
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

@media (min-width: 1024px) { .login-hero { display: flex; } }

.login-hero h1 {
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #ffffff;
  max-width: 28rem;
}

.login-hero p {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 28rem;
  line-height: 1.65;
}

.login-hero ul { list-style: none; padding: 0; margin: 2rem 0 0; font-size: 0.9rem; }
.login-hero li { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.85rem; color: rgba(255, 255, 255, 0.88); }

.login-hero.has-slides { position: relative; padding: 0; }
.hero-slider { position: absolute; inset: 0; }
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.03);
  transition: opacity 0.8s ease, transform 4s ease-out, visibility 0.8s;
}
.hero-slide.active { opacity: 1; visibility: visible; transform: scale(1); }
.hero-slide img, .hero-slide video { width: 100%; height: 100%; object-fit: cover; display: block; }

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.5) 0%, rgba(17, 24, 39, 0.25) 40%, rgba(17, 24, 39, 0.9) 100%);
}

.hero-caption { position: absolute; left: 3rem; right: 3rem; bottom: 6.5rem; color: #ffffff; }
.hero-caption h1 { font-size: 2.15rem; font-weight: 800; line-height: 1.15; margin: 0; color: #ffffff; }
.hero-caption p { margin-top: 0.65rem; font-size: 0.95rem; color: rgba(255, 255, 255, 0.8); max-width: 32rem; }

.hero-layer { position: absolute; left: 3rem; right: 3rem; z-index: 3; color: #ffffff; }
.hero-layer.top { top: 3rem; }
.hero-layer.bottom { bottom: 2.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.hero-dots { display: flex; gap: 0.45rem; }
.hero-dot {
  width: 26px; height: 4px; border: none; border-radius: var(--radius-full);
  cursor: pointer; background: rgba(255, 255, 255, 0.3); transition: all 0.3s ease;
}
.hero-dot.active { background: #ffffff; width: 44px; }

.hero-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(17, 24, 39, 0.45);
  color: #ffffff; font-size: 1.4rem; display: grid; place-items: center;
  opacity: 0; transition: opacity 0.2s, background 0.2s;
}

.login-hero.has-slides:hover .hero-nav { opacity: 1; }
.hero-nav:hover { background: rgba(17, 24, 39, 0.85); }
.hero-nav.prev { left: 1.25rem; }
.hero-nav.next { right: 1.25rem; }

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: var(--background);
}

.login-form-side .inner {
  width: 100%;
  max-width: 26rem;
}

/* ========================================================================== */
/* Toasts & Screen Bubbles                                                    */
/* ========================================================================== */
#toast-root {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 120;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Follow-up reminder bubble */
.fup-bubbles {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: min(92vw, 24rem);
}

.fup-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-xl);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-xl);
  animation: fupIn 0.3s ease-out;
}

@keyframes fupIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.fup-bubble-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  margin-bottom: 0.35rem;
}

.fup-bubble-head strong { flex: 1; }

.fup-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--warning);
  animation: fupPulse 1.4s infinite;
}

@keyframes fupPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  70% { box-shadow: 0 0 0 0.5rem rgba(245, 158, 11, 0); }
}

.fup-x {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted-foreground);
}

.fup-name { font-weight: 700; font-size: 1rem; color: var(--foreground); }
.fup-meta { font-size: 0.8125rem; color: var(--muted-foreground); }
.fup-note { font-size: 0.8125rem; margin-top: 0.35rem; }
.fup-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.65rem; }

/* ========================================================================== */
/* List Row                                                                   */
/* ========================================================================== */
.list-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--accent); }

.list-row .main { flex: 1; min-width: 0; }
.list-row .name { font-weight: 700; font-size: 0.95rem; margin: 0; }
.list-row .name-row { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.list-row .email { font-size: 0.8rem; color: var(--muted-foreground); margin: 0.15rem 0 0; }

.list-row .actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.switch-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

/* ========================================================================== */
/* Responsive Rules                                                           */
/* ========================================================================== */
@media (max-width: 860px) {
  .sb-open { display: grid; }
  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
  }
  .shell.mobile-open .sidebar { transform: translateX(0); }
  .shell.collapsed .sidebar {
    width: 270px;
    align-items: stretch;
  }
  .shell.collapsed .sidebar .txt,
  .shell.collapsed .sb-role,
  .shell.collapsed .sidebar-bottom .who { display: block; }
  .shell.collapsed .side-link {
    justify-content: flex-start;
    padding: 0.65rem 0.85rem;
    width: 100%;
  }
  .topbar { padding: 0 1rem; }
  .app-main { padding: 1.25rem 1rem 3rem; }
  .chart-grid { grid-template-columns: 1fr; padding: 1rem; }
}
