/**
 * Qimora SchoolOS — Complete App Redesign tokens (EJS port)
 * Light / dark + fixed shell (220px sidebar, 64px topbar)
 */
:root,
[data-theme='light'] {
  --background: #f1f5f9;
  --foreground: #0f172a;
  --bg: var(--background);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --card: #ffffff;
  --border: rgba(0, 0, 0, 0.06);
  --primary: #1565c0;
  --primary-strong: #0d47a1;
  --primary-soft: #42a5f5;
  --accent: #ffa726;
  --accent-soft: rgba(255, 167, 38, 0.12);
  --success: #66bb6a;
  --success-soft: rgba(102, 187, 106, 0.12);
  --warning: #ffa726;
  --warning-soft: rgba(255, 167, 38, 0.12);
  --danger: #ef5350;
  --danger-soft: rgba(239, 83, 80, 0.1);
  --info: #42a5f5;
  --info-soft: rgba(66, 165, 245, 0.1);
  --violet: #ab47bc;
  --violet-soft: rgba(171, 71, 188, 0.1);
  --text-1: #0f172a;
  --text-2: #64748b;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --muted: var(--text-3);
  --sidebar-bg: #0a1929;
  --sidebar-border: rgba(144, 202, 249, 0.08);
  --sidebar-fg: #e3f2fd;
  --sidebar-muted: rgba(227, 242, 253, 0.55);
  --sidebar-hover: rgba(144, 202, 249, 0.06);
  --sidebar-active-bg: linear-gradient(90deg, #1e3a5f 0%, rgba(30, 58, 95, 0.7) 100%);
  --sidebar-active-bar: #90caf9;
  --sidebar-active-fg: #90caf9;
  --topbar-bg: #ffffff;
  --topbar-border: rgba(0, 0, 0, 0.06);
  --table-header-bg: #f8fafc;
  --input-border: rgba(0, 0, 0, 0.08);
  --input-focus: #1565c0;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-card: 10px;
  --radius-button: 6px;
  --radius-input: 6px;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-brand: 0 4px 14px rgba(66, 165, 245, 0.35);
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fs-body: 15px;
  --fs-small: 13px;
  --fs-label: 12px;
  --fs-table: 14px;
  --fs-card-title: 15px;
  --fs-section: 19px;
  --fs-page: 26px;
  --shell-sidebar-w: 220px;
  --shell-topbar-h: 64px;
  --brand-gradient: linear-gradient(135deg, #1565c0 0%, #42a5f5 100%);
}

[data-theme='dark'] {
  --background: #0a1929;
  --foreground: #e3f2fd;
  --bg: var(--background);
  --surface: #1e293b;
  --surface-2: #1e293b;
  --card: #1e293b;
  --border: rgba(144, 202, 249, 0.12);
  --primary: #90caf9;
  --primary-strong: #64b5f6;
  --primary-soft: rgba(144, 202, 249, 0.15);
  --accent: #ffa726;
  --accent-soft: rgba(255, 167, 38, 0.12);
  --success: #66bb6a;
  --success-soft: rgba(102, 187, 106, 0.12);
  --warning: #ffa726;
  --warning-soft: rgba(255, 167, 38, 0.12);
  --danger: #ef5350;
  --danger-soft: rgba(239, 83, 80, 0.12);
  --info: #90caf9;
  --info-soft: rgba(144, 202, 249, 0.1);
  --violet: #ce93d8;
  --violet-soft: rgba(171, 71, 188, 0.15);
  --text-1: #e3f2fd;
  --text-2: #94a3b8;
  --text-3: #94a3b8;
  --text-4: #64748b;
  --muted: var(--text-3);
  --sidebar-bg: #0a1929;
  --sidebar-border: rgba(144, 202, 249, 0.08);
  --sidebar-fg: #e3f2fd;
  --sidebar-muted: rgba(227, 242, 253, 0.55);
  --sidebar-hover: rgba(144, 202, 249, 0.06);
  --sidebar-active-bg: linear-gradient(90deg, #1e3a5f 0%, rgba(30, 58, 95, 0.7) 100%);
  --sidebar-active-bar: #90caf9;
  --sidebar-active-fg: #90caf9;
  --topbar-bg: #0a1929;
  --topbar-border: rgba(144, 202, 249, 0.1);
  --table-header-bg: rgba(144, 202, 249, 0.04);
  --input-border: rgba(144, 202, 249, 0.12);
  --input-focus: #90caf9;
  --shadow-sm: 0 1px 0 rgba(144, 202, 249, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-brand: 0 4px 14px rgba(66, 165, 245, 0.25);
}

html {
  font-size: var(--fs-body);
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
}

.app-body {
  min-height: 100vh;
}

/* Shell: fixed sidebar + main column */
.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  width: var(--shell-sidebar-w);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 0;
  transition:
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.28s ease;
  will-change: transform;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--brand-gradient);
  box-shadow: 0 4px 12px rgba(66, 165, 245, 0.35);
  color: #fff;
  font-size: 1rem;
}

.sidebar-brand-mark i {
  font-size: 1rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: var(--brand-gradient);
  font-size: 15px;
}
.brand-mark.sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 14px;
}

.sidebar-brand .fw-semibold,
.sidebar-brand-title {
  color: var(--sidebar-fg);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}
.sidebar-brand .brand-subtitle,
.sidebar-brand-sub {
  color: rgba(144, 202, 249, 0.6);
  font-size: 10px;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px 12px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.sidebar-nav .nav-section {
  color: rgba(144, 202, 249, 0.4);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 18px 8px 8px;
  font-weight: 700;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar-nav .nav-link i {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
  opacity: 0.95;
}
.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-fg);
}
.sidebar-nav .nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-fg);
  box-shadow: inset 3px 0 0 var(--sidebar-active-bar);
}
.sidebar-nav .nav-link .nav-label {
  flex: 1;
  text-align: left;
}
.sidebar-nav .nav-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1;
}
.sidebar-nav .nav-badge--new {
  background: rgba(66, 165, 245, 0.2);
  color: #90caf9;
  border: 1px solid rgba(144, 202, 249, 0.25);
}
.sidebar-nav .nav-badge--count {
  background: rgba(144, 202, 249, 0.12);
  color: rgba(144, 202, 249, 0.7);
}
.sidebar-nav .nav-link.active .nav-chevron {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.5;
  color: var(--sidebar-active-fg);
}

.sidebar-user {
  flex-shrink: 0;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(144, 202, 249, 0.05);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.sidebar-user-card:hover {
  background: rgba(144, 202, 249, 0.1);
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-gradient);
  flex-shrink: 0;
}
.sidebar-user-meta {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--sidebar-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 10px;
  color: rgba(144, 202, 249, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-card .sidebar-user-settings {
  color: rgba(144, 202, 249, 0.35);
  font-size: 13px;
}

.sidebar-toggle {
  display: none;
}

.sidebar-collapse-toggle {
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.sidebar-collapse-toggle:hover {
  background: var(--surface-2);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.sidebar-collapse-toggle i {
  font-size: 0.8rem;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-main {
  margin-left: var(--shell-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: var(--shell-topbar-h);
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
  position: fixed;
  top: 0;
  left: var(--shell-sidebar-w);
  right: 0;
  z-index: 30;
  height: var(--shell-topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px 0 20px;
  border-bottom: 1px solid var(--topbar-border);
  background: color-mix(in srgb, var(--topbar-bg) 92%, transparent);
  backdrop-filter: saturate(1.25) blur(14px);
  -webkit-backdrop-filter: saturate(1.25) blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, var(--shadow-sm);
  transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 993px) {
  .app-shell.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    pointer-events: none;
  }

  .app-shell.sidebar-collapsed .app-main {
    margin-left: 0;
  }

  .app-shell.sidebar-collapsed .topbar {
    left: 0;
  }

  .rtl-ready[dir='rtl'] .app-shell.sidebar-collapsed .sidebar {
    transform: translateX(100%);
  }

  .rtl-ready[dir='rtl'] .app-shell.sidebar-collapsed .app-main {
    margin-right: 0;
  }

  .rtl-ready[dir='rtl'] .app-shell.sidebar-collapsed .topbar {
    right: 0;
  }
}
[data-theme='dark'] .topbar {
  background: color-mix(in srgb, var(--topbar-bg) 94%, transparent);
  box-shadow: 0 1px 0 rgba(144, 202, 249, 0.04) inset, 0 8px 28px rgba(0, 0, 0, 0.35);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 1;
}
.topbar-breadcrumb .crumb-sep {
  font-size: 12px;
  color: var(--text-4);
  opacity: 0.5;
}
.topbar-breadcrumb .crumb {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-breadcrumb .crumb:last-child {
  color: var(--primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}
[data-theme='dark'] .topbar-breadcrumb .crumb:last-child {
  color: #90caf9;
}
.topbar-breadcrumb a.crumb {
  color: var(--text-2);
  text-decoration: none;
}
.topbar-breadcrumb a.crumb:hover {
  color: var(--text-1);
}

.topbar-center {
  flex: 1;
  max-width: min(440px, 38vw);
  margin: 0 auto;
  min-width: 0;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.search-shell:focus-within {
  border-color: rgba(66, 165, 245, 0.45);
  box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.12);
  background: var(--card);
}
.search-shell i.search-icon {
  color: var(--text-4);
  font-size: 13px;
  flex-shrink: 0;
}
.search-shell input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
  width: 100%;
}
.search-shell input::placeholder {
  color: var(--text-3);
  opacity: 0.75;
}
.search-shell-kbd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
[data-theme='dark'] .search-shell-kbd {
  background: rgba(144, 202, 249, 0.08);
  border-color: rgba(144, 202, 249, 0.1);
  color: rgba(144, 202, 249, 0.45);
}

.topbar-spacer {
  flex: 1;
  min-width: 8px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* Academic year + org context */
.topbar-year-chip {
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: linear-gradient(135deg, rgba(66, 165, 245, 0.08), var(--surface-2));
  border: 1px solid var(--input-border);
  color: var(--text-2);
  max-width: 220px;
}
.topbar-year-chip-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(66, 165, 245, 0.12);
  color: var(--primary-strong);
  flex-shrink: 0;
}
.topbar-year-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.topbar-year-chip-org {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  max-width: 140px;
}
.topbar-year-chip-year {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
[data-theme='dark'] .topbar-year-chip-year {
  color: #90caf9;
}

/* Insights entry — icon only */
.topbar-insight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--primary-strong);
  border: 1px solid rgba(66, 165, 245, 0.28);
  background: linear-gradient(145deg, rgba(21, 101, 192, 0.12), rgba(66, 165, 245, 0.06));
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.topbar-insight > i {
  font-size: 16px;
  line-height: 1;
}
.topbar-insight:hover {
  color: var(--primary);
  border-color: rgba(66, 165, 245, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(66, 165, 245, 0.18);
}
.topbar-insight.is-active {
  color: #fff;
  background: linear-gradient(145deg, var(--primary-strong), #1565c0);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(25, 118, 210, 0.35);
}
[data-theme='dark'] .topbar-insight.is-active {
  box-shadow: 0 4px 18px rgba(100, 181, 246, 0.25);
}

.topbar-actions-cluster .topbar-insight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  margin-right: 2px;
}
.topbar-actions-cluster .topbar-insight > i {
  font-size: 15px;
}

.topbar-actions-cluster {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--input-border);
}
[data-theme='dark'] .topbar-actions-cluster {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(144, 202, 249, 0.1);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--input-border);
  color: var(--text-2);
  white-space: nowrap;
}
.chip strong,
.chip .chip-accent {
  font-weight: 600;
  color: var(--primary);
}
[data-theme='dark'] .chip .chip-accent {
  color: #90caf9;
}

.btn-gradient {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(66, 165, 245, 0.25);
  background: linear-gradient(135deg, rgba(21, 101, 192, 0.15) 0%, rgba(66, 165, 245, 0.1) 100%);
  color: var(--primary);
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-gradient:hover {
  color: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-brand);
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.topbar-actions-cluster .icon-btn:hover {
  background: rgba(66, 165, 245, 0.1);
}
.icon-btn .notify-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface-2);
}

.lang-toggle {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid transparent;
  font-size: 11px;
}
.topbar-actions-cluster .lang-toggle {
  border: none;
}
.lang-toggle button {
  padding: 7px 11px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  cursor: default;
}
.lang-toggle button.active {
  background: rgba(66, 165, 245, 0.14);
  color: var(--primary-strong);
}
.lang-toggle button + button {
  border-left: 1px solid var(--input-border);
}
.topbar-actions-cluster .lang-toggle button + button {
  border-left-color: rgba(0, 0, 0, 0.06);
}
[data-theme='dark'] .topbar-actions-cluster .lang-toggle button + button {
  border-left-color: rgba(144, 202, 249, 0.12);
}

.topbar-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: var(--surface-2);
  color: var(--text-1);
  max-width: 220px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.topbar-user-btn:hover {
  background: var(--card);
  border-color: rgba(66, 165, 245, 0.28);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
[data-theme='dark'] .topbar-user-btn:hover {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}
.topbar-user-meta {
  text-align: start;
  line-height: 1.25;
  max-width: 132px;
}
.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}
.topbar-user-role {
  font-size: 10px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text-3);
}
.topbar-user-chevron {
  font-size: 10px;
  opacity: 0.45;
  margin-left: 2px;
}
.topbar-user-btn.dropdown-toggle::after {
  display: none;
}
.topbar-user-btn .avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--brand-gradient);
  box-shadow: 0 2px 8px rgba(66, 165, 245, 0.35);
  flex-shrink: 0;
}

.app-content {
  padding: 24px;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.app-content.student-form-page {
  max-width: none;
  padding-left: 16px;
  padding-right: 16px;
}

.student-application-form {
  width: 100%;
  max-width: none;
}

.app-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  font-size: var(--fs-small);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Page header (in-page title row) */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.page-subtitle {
  font-size: var(--fs-small);
  color: var(--text-2);
  margin: 0;
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.page-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(21, 101, 192, 0.1) 0%, rgba(66, 165, 245, 0.08) 100%);
  border: 1px solid rgba(66, 165, 245, 0.2);
  color: var(--primary-soft);
}
[data-theme='dark'] .page-status-chip {
  color: #90caf9;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 12px;
}

.surface-card,
.card-surface {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.surface-card.elevated {
  box-shadow: var(--shadow-md);
}

/* KPI grid + gradient stat cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.kpi-card {
  grid-column: span 3;
  padding: 18px 20px;
}
.kpi-card.gradient {
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.kpi-card.gradient .kpi-gradient-head {
  padding: 16px;
  color: #fff;
}
.kpi-card.gradient .kpi-gradient-head--blue {
  background: linear-gradient(135deg, #1565c0, #42a5f5);
}
.kpi-card.gradient .kpi-gradient-head--emerald {
  background: linear-gradient(135deg, #2e7d32, #66bb6a);
}
.kpi-card.gradient .kpi-gradient-head--amber {
  background: linear-gradient(135deg, #f57c00, #ffb74d);
}
.kpi-card.gradient .kpi-gradient-head--violet {
  background: linear-gradient(135deg, #5e35b1, #ab47bc);
}
.kpi-card.gradient .kpi-gradient-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}
.kpi-card.gradient .kpi-gradient-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}
.kpi-card.gradient .kpi-gradient-unit {
  font-size: 1rem;
  opacity: 0.75;
  font-weight: 500;
}
.kpi-card.gradient .kpi-gradient-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}
.kpi-card.gradient .kpi-gradient-body {
  padding: 12px 16px 14px;
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}
.kpi-trend {
  font-size: var(--fs-label);
  color: var(--text-3);
  margin-top: 6px;
}

.stat-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-tile-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}
.stat-tile-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2px;
}

@media (max-width: 1200px) {
  .kpi-card {
    grid-column: span 6;
  }
}
@media (max-width: 720px) {
  .kpi-card {
    grid-column: span 12;
  }
}

/* Toolbar / filters */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.filter-bar .form-control,
.filter-bar .form-select {
  border-color: var(--input-border);
  border-radius: var(--radius-input);
  font-size: var(--fs-small);
  background: var(--surface);
  color: var(--text-1);
}

/* Data tables */
.data-table-wrap {
  overflow-x: auto;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-table);
  margin-bottom: 0;
}
table.data-table thead th {
  text-align: left;
  padding: 12px 18px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
table.data-table tbody tr:hover {
  background: var(--surface-2);
}
.table.data-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-1);
  --bs-table-border-color: var(--border);
}
.table.data-table thead th {
  background: var(--table-header-bg);
  color: var(--text-2);
}

.table-darkish {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-1);
  --bs-table-border-color: var(--border);
}

.attendance-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}
.attendance-bar-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.attendance-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s;
}
.attendance-bar-pct {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
}

.pagination-pro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface-2);
}

.chart-box {
  height: 260px;
}

/* Empty / placeholder */
.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  color: var(--text-3);
  background: var(--surface-2);
}

.empty-state-pro {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.empty-state-pro .empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  background: rgba(66, 165, 245, 0.1);
  border: 1px solid rgba(66, 165, 245, 0.2);
  display: grid;
  place-items: center;
  color: var(--primary-soft);
  font-size: 28px;
}
.empty-state-pro h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 8px;
}
.empty-state-pro p {
  font-size: var(--fs-small);
  color: var(--text-2);
  max-width: 360px;
  margin: 0 auto 16px;
  line-height: 1.5;
}
.empty-coming-soon {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  background: rgba(66, 165, 245, 0.08);
  border: 1px solid rgba(66, 165, 245, 0.18);
  color: var(--primary-soft);
}

/* AI insight cards */
.ai-insight-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.ai-insight-card--warning {
  background: rgba(255, 167, 38, 0.08);
  border-color: rgba(255, 167, 38, 0.2);
}
.ai-insight-card--academic {
  background: rgba(66, 165, 245, 0.08);
  border-color: rgba(66, 165, 245, 0.2);
}
.ai-insight-card--finance {
  background: rgba(102, 187, 106, 0.08);
  border-color: rgba(102, 187, 106, 0.2);
}
.ai-insight-card--ops {
  background: rgba(171, 71, 188, 0.08);
  border-color: rgba(171, 71, 188, 0.2);
}
.ai-insight-card-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 14px;
}

.skeleton {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer {
  0% {
    background-position: 0% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Badges */
.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-soft-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(102, 187, 106, 0.25);
}
.badge-soft-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid rgba(255, 167, 38, 0.25);
}
.badge-soft-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 83, 80, 0.2);
}
.badge-soft-info {
  background: var(--info-soft);
  color: var(--info);
  border: 1px solid rgba(66, 165, 245, 0.2);
}
.badge-soft-primary {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border: 1px solid rgba(66, 165, 245, 0.2);
}
.badge-soft-slate {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-soft-gold {
  background: var(--accent-soft);
  color: #e65100;
  border: 1px solid rgba(255, 167, 38, 0.2);
}
[data-theme='dark'] .badge-soft-gold {
  color: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.status-pill.success {
  background: rgba(102, 187, 106, 0.12);
  color: var(--success);
  border: 1px solid rgba(102, 187, 106, 0.25);
}
.status-pill.warning {
  background: rgba(255, 167, 38, 0.12);
  color: var(--warning);
  border: 1px solid rgba(255, 167, 38, 0.25);
}
.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Buttons */
.btn {
  border-radius: var(--radius-button);
  font-weight: 600;
  font-size: 14px;
  padding: 0.45rem 0.9rem;
}
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-strong);
  --bs-btn-hover-border-color: var(--primary-strong);
  --bs-btn-color: #fff;
}
.btn-gradient-lg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  background: var(--brand-gradient);
  color: #fff !important;
  text-decoration: none;
  box-shadow: var(--shadow-brand);
  transition: transform 0.12s;
}
.btn-gradient-lg:hover {
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-secondary,
.btn-outline-secondary {
  --bs-btn-color: var(--text-1);
  --bs-btn-border-color: var(--border);
  --bs-btn-bg: var(--surface);
  --bs-btn-hover-bg: var(--surface-2);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-hover-color: var(--text-1);
  --bs-btn-active-bg: var(--surface-2);
  --bs-btn-active-border-color: var(--border);
  --bs-btn-active-color: var(--text-1);
  --bs-btn-disabled-color: var(--text-3);
  --bs-btn-disabled-bg: var(--surface);
  --bs-btn-disabled-border-color: var(--border);
}
.btn-outline-light,
.btn-light {
  --bs-btn-color: var(--text-1);
  --bs-btn-border-color: var(--border);
  --bs-btn-bg: var(--surface);
  --bs-btn-hover-bg: var(--surface-2);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-hover-color: var(--text-1);
  --bs-btn-active-bg: var(--surface-2);
  --bs-btn-active-border-color: var(--border);
  --bs-btn-active-color: var(--text-1);
}
[data-theme='dark'] .btn-outline-light,
[data-theme='dark'] .btn-light {
  --bs-btn-color: var(--text-1);
  --bs-btn-hover-color: var(--text-1);
  --bs-btn-active-color: var(--text-1);
}
/* Bootstrap defaults white hover text on secondary — enforce contrast on light fills */
.btn-secondary:hover,
.btn-secondary:focus-visible,
.btn-secondary:active,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible,
.btn-outline-secondary:active,
.btn-light:hover,
.btn-light:focus-visible,
.btn-light:active,
.btn-outline-light:hover,
.btn-outline-light:focus-visible,
.btn-outline-light:active {
  color: var(--text-1);
}
/* Tab-style btn-group: active outline tab uses primary tint, not white-on-gray */
.btn-group > .btn-outline-secondary.active,
.btn-group > .btn-outline-secondary:active,
.btn-check:checked + .btn-outline-secondary {
  color: var(--primary);
  background-color: rgba(21, 101, 192, 0.1);
  border-color: var(--primary);
}
[data-theme='dark'] .btn-group > .btn-outline-secondary.active,
[data-theme='dark'] .btn-group > .btn-outline-secondary:active,
[data-theme='dark'] .btn-check:checked + .btn-outline-secondary {
  color: var(--primary);
  background-color: rgba(144, 202, 249, 0.12);
  border-color: var(--primary);
}
.btn-danger {
  --bs-btn-bg: var(--danger);
  --bs-btn-border-color: var(--danger);
  --bs-btn-color: #fff;
}
.btn-warning {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-color: #0f172a;
}

/* Forms */
.form-control,
.form-select {
  border-color: var(--input-border);
  border-radius: var(--radius-input);
  background: var(--surface);
  color: var(--text-1);
  font-size: var(--fs-small);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.2);
}
.form-label {
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--text-2);
}

/* Dense “enterprise” forms (modals + long pages) */
.form-pro-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.form-pro .form-pro-section-title + .row {
  margin-top: 0;
}
.form-pro .form-label {
  margin-bottom: 0.35rem;
}
.form-pro .form-text {
  margin-top: 0.35rem;
  font-size: 12px;
  color: var(--text-4);
  line-height: 1.35;
}
.form-pro-input-group .form-control {
  font-variant-numeric: tabular-nums;
}
.form-pro-input-group > .form-control:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.form-pro-input-group > .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* App modals — unified layout: scrollable body, fixed header/footer, centered */
.modal .modal-content {
  background: var(--card);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: min(85vh, calc(100vh - 2rem));
  display: flex;
  flex-direction: column;
}
.modal .modal-content.surface-card.elevated {
  box-shadow: var(--shadow-md);
}
/* When header/body/footer live inside <form>, the form must be the flex column
   or the body grows unbounded and the footer is clipped below max-height. */
.modal .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.modal .modal-header,
.modal .modal-footer {
  flex-shrink: 0;
  border-color: var(--border);
  background: var(--card);
  padding: 14px 20px;
}
.modal .modal-header {
  border-bottom: 1px solid var(--border);
}
.modal .modal-footer {
  border-top: 1px solid var(--border);
  gap: 8px;
}
.modal .modal-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-1);
  margin: 0;
  line-height: 1.3;
}
.modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  scrollbar-gutter: stable both-edges;
}
/* Let Bootstrap’s scrollable dialog control height chain; avoid double max-height on body */
.modal-dialog-scrollable .modal-body {
  max-height: none;
}
/* Bootstrap scrollable dialog: dialog caps height; body still scrolls inside flex column */
.modal-dialog-scrollable .modal-content {
  max-height: 100%;
}
.modal-dialog.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 2rem);
}
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0;
    max-width: 100%;
    min-height: calc(100% - 1rem);
  }
  .modal-dialog.modal-dialog-centered {
    min-height: 100%;
    align-items: stretch;
  }
  .modal .modal-content {
    max-height: 100vh;
    min-height: 100%;
    border-radius: 0;
  }
  .modal .modal-body {
    flex: 1 1 auto;
  }
}
.app-content .modal-content.surface-card {
  border-radius: var(--radius) !important;
}
@media (max-width: 575.98px) {
  .app-content .modal-content.surface-card {
    border-radius: 0 !important;
  }
}

.text-secondary {
  color: var(--text-3) !important;
}

.alert {
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.alert-success {
  background: var(--success-soft);
  border-color: rgba(102, 187, 106, 0.25);
  color: var(--text-1);
}
.alert-danger {
  background: var(--danger-soft);
  border-color: rgba(239, 83, 80, 0.25);
  color: var(--text-1);
}

.breadcrumb {
  --bs-breadcrumb-divider-color: var(--text-4);
  font-size: var(--fs-small);
}
.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
}
.breadcrumb-item.active {
  color: var(--text-3);
}

.topbar .dropdown-menu {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--card);
}

.auth-body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-1);
}

.rtl-ready[dir='rtl'] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--sidebar-border);
}
.rtl-ready[dir='rtl'] .app-main {
  margin-left: 0;
  margin-right: var(--shell-sidebar-w);
  transition: margin-right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.rtl-ready[dir='rtl'] .topbar {
  left: 0;
  right: var(--shell-sidebar-w);
  transition:
    right 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.rtl-ready[dir='rtl'] .sidebar {
  transition:
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.28s ease;
}

/* Mobile sidebar */
@media (max-width: 992px) {
  .app-shell {
    position: relative;
  }
  .app-shell.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 41, 0.55);
    z-index: 90;
  }
  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
    width: min(280px, 88vw);
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
    padding-top: var(--shell-topbar-h);
  }
  .topbar {
    left: 0;
    right: 0;
  }
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-button);
    background: var(--surface);
    color: var(--text-1);
  }
}

/* Nav tabs (student profile etc.) */
.nav-tabs-os {
  border-bottom: 1px solid var(--border);
  gap: 4px;
}
.nav-tabs-os .nav-link {
  color: var(--text-3);
  border: none;
  border-radius: 10px 10px 0 0;
  padding: 10px 14px;
  font-weight: 600;
  font-size: var(--fs-small);
}
.nav-tabs-os .nav-link:hover {
  color: var(--text-1);
  background: var(--surface-2);
}
.nav-tabs-os .nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.bg-primary-soft {
  background: rgba(66, 165, 245, 0.12) !important;
}

.actions-dropdown .btn {
  padding: 0.25rem 0.5rem;
}

.ai-chat-bubble {
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: var(--radius);
}
.ai-chat-bubble--user {
  background: var(--primary-soft);
}
.ai-chat-bubble--assistant {
  background: var(--card);
}

.app-content .nav-tabs .nav-link {
  color: var(--text-3);
  border: 1px solid transparent;
}
.app-content .nav-tabs .nav-link:hover {
  color: var(--text-1);
  border-color: var(--border);
}
.app-content .nav-tabs .nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--border) var(--border) transparent;
}

/* Card panel headers (dashboard-style) */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}
.panel-head-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: rgba(66, 165, 245, 0.1);
  color: var(--primary-soft);
  font-size: 14px;
}

.code-pill {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
}

[data-theme='dark'] .modal-content .btn-close {
  filter: invert(1) grayscale(100%) brightness(1.2);
}

/* Classes hub — cards & enrollment meters */
.class-hub-grid {
  align-items: stretch;
}
.class-hub-card {
  border-radius: var(--radius-card);
  padding: 16px 18px;
}
.class-hub-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.class-hub-title {
  font-weight: 600;
  font-size: var(--fs-card-title);
  color: var(--text-1);
}
.class-hub-meta {
  margin-top: 2px;
}
.class-hub-sections {
  min-height: 0;
}
.section-row-os {
  font-size: var(--fs-small);
}
.section-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.section-meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-strong), var(--primary-soft));
  transition: width 0.2s ease;
}
.section-meter-fill--over {
  background: linear-gradient(90deg, #c62828, var(--danger));
}

/* Academic hub — navigation cards */
.academic-hub-card .surface-card {
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  border: 1px solid var(--border);
}
.academic-hub-card:hover .surface-card {
  box-shadow: var(--shadow-md);
  border-color: rgba(66, 165, 245, 0.22);
  transform: translateY(-1px);
}
.academic-hub-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: rgba(66, 165, 245, 0.12);
  color: var(--primary-strong);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.academic-hub-card-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-2);
  line-height: 1;
}

/* Directory / users & teachers */
.directory-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.tag-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  border: 1px solid var(--border);
}
.tag-chip--soft {
  background: var(--surface-2);
  color: var(--text-2);
}
.avatar-initials {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  background: rgba(66, 165, 245, 0.15);
  color: #1565c0;
  border: 1px solid rgba(66, 165, 245, 0.25);
}
.avatar-initials--lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
  border-radius: 14px;
}

/* —— Class detail (academic) — professional overview — */
.class-detail-kpi {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.class-detail-kpi:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(66, 165, 245, 0.2);
}
.class-detail-kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.class-detail-kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.class-detail-kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.15;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.class-detail-kpi-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
  line-height: 1.35;
}

.class-detail-tabnav {
  padding: 6px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.class-detail-tabnav .nav-link {
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-2);
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
}
.class-detail-tabnav .nav-link:hover {
  color: var(--text-1);
  background: rgba(0, 0, 0, 0.04);
}
[data-theme='dark'] .class-detail-tabnav .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
}
.class-detail-tabnav .nav-link.active {
  background: var(--primary-strong);
  color: #fff;
  border-color: transparent;
}

.class-detail-spotlight {
  background: linear-gradient(135deg, rgba(66, 165, 245, 0.06) 0%, var(--card) 42%, var(--card) 100%);
}
.class-detail-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-strong);
  margin: 0;
}
.class-detail-heading {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
}
.class-detail-badge-soft {
  background: rgba(66, 165, 245, 0.12);
  color: var(--primary-strong);
  font-weight: 600;
  border: 1px solid rgba(66, 165, 245, 0.2);
}
.class-detail-badge-outline {
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  border: 1px solid var(--border);
}
.class-detail-badge-cap {
  background: rgba(25, 118, 210, 0.1);
  color: #1565c0;
  font-weight: 600;
  border: 1px solid rgba(25, 118, 210, 0.22);
}
[data-theme='dark'] .class-detail-badge-cap {
  background: rgba(100, 181, 246, 0.12);
  color: #90caf9;
  border-color: rgba(100, 181, 246, 0.25);
}
.class-detail-capacity-pill {
  min-width: 120px;
}
.class-detail-capacity-num {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  line-height: 1.2;
}
.class-detail-capacity-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.class-detail-section-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.class-detail-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.class-detail-profile-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.class-detail-profile-item--wide {
  grid-column: 1 / -1;
}
@media (min-width: 992px) {
  .class-detail-profile-item--wide {
    grid-column: span 2;
  }
}
.class-detail-profile-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(66, 165, 245, 0.1);
  color: var(--primary-strong);
  font-size: 0.95rem;
}
.class-detail-profile-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 2px;
}
.class-detail-profile-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-1);
}
.class-detail-profile-sub {
  margin-top: 2px;
}

.class-detail-att-card {
  background: linear-gradient(180deg, rgba(66, 165, 245, 0.05) 0%, var(--card) 28%);
}
.class-detail-att-donut {
  --att-pct: 0;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--primary-strong) calc(var(--att-pct) * 1%), var(--surface-2) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
[data-theme='dark'] .class-detail-att-donut {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.class-detail-att-donut-inner {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}
.class-detail-att-donut-pct {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
}
.class-detail-att-donut-suffix {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-3);
  margin-top: 2px;
}
.class-detail-att-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.class-detail-att-chip {
  font-weight: 600;
  font-size: 11px;
}
.class-detail-att-chip--present {
  background: rgba(46, 125, 50, 0.12);
  color: #2e7d32;
  border: 1px solid rgba(46, 125, 50, 0.25);
}
.class-detail-att-chip--late {
  background: rgba(239, 108, 0, 0.12);
  color: #e65100;
  border: 1px solid rgba(239, 108, 0, 0.25);
}
.class-detail-att-chip--excused {
  background: rgba(2, 119, 189, 0.1);
  color: #0277bd;
  border: 1px solid rgba(2, 119, 189, 0.22);
}
.class-detail-att-chip--absent {
  background: rgba(198, 40, 40, 0.1);
  color: #c62828;
  border: 1px solid rgba(198, 40, 40, 0.22);
}
.class-detail-att-chip--unmarked {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.class-detail-empty-att {
  background: var(--surface-2);
  border: 1px dashed var(--border);
}

.class-detail-section-att-strip {
  padding: 0;
}
.class-detail-section-att-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.class-detail-section-att-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 120px;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.class-detail-section-att-card:hover {
  border-color: #1565c0;
  box-shadow: var(--shadow-sm);
  color: inherit;
}
.class-detail-section-att-card--active {
  border-color: #1565c0;
  background: rgba(21, 101, 192, 0.06);
  box-shadow: 0 0 0 1px rgba(21, 101, 192, 0.2);
}
.class-detail-section-att-card__grade {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1565c0;
}
.class-detail-section-att-card__name {
  font-weight: 700;
  font-size: 0.875rem;
}
.class-detail-section-att-card__meta,
.class-detail-section-att-card__stats {
  font-size: 0.7rem;
  color: var(--text-2);
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.class-detail-section-att-card__pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: #2e7d32;
  margin-top: 0.15rem;
}
.class-detail-section-att-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: var(--surface-2, #f8fafc);
}
.class-detail-section-att-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.class-detail-section-att-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.class-detail-section-card {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.class-detail-section-card:hover {
  border-color: rgba(66, 165, 245, 0.25);
  box-shadow: var(--shadow-sm);
}
.class-detail-section-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-1);
}
.class-detail-section-card-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.class-detail-teacher-list li {
  border-top: 1px solid var(--border);
}
.class-detail-teacher-list li:first-child {
  border-top: 0;
  padding-top: 0 !important;
}
.class-detail-teacher-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-strong);
  flex-shrink: 0;
}

/* ——— Parent guardian profile ——— */
.parent-profile-page .page-header {
  margin-bottom: 20px;
}
.parent-profile-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.parent-profile-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 0;
  border: 1px solid var(--border);
}
.parent-profile-hero__accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary-strong), #42a5f5);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.parent-profile-hero__body {
  display: flex;
  align-items: stretch;
  gap: 20px;
  flex-wrap: wrap;
  padding: 22px 22px 22px 26px;
}
.parent-profile-hero__avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary-strong);
  background: linear-gradient(145deg, rgba(21, 101, 192, 0.12), rgba(66, 165, 245, 0.08));
  border: 1px solid rgba(66, 165, 245, 0.22);
  box-shadow: var(--shadow-sm);
}
.parent-profile-hero__eyebrow {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.parent-profile-hero__name {
  margin: 0 0 12px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
}
.parent-profile-hero__contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.parent-profile-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  max-width: 100%;
}
.parent-profile-chip__k {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  color: var(--text-3);
}
.parent-profile-chip__v {
  font-weight: 600;
  color: var(--text-1);
}
.parent-profile-chip--action {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.parent-profile-chip--action:hover {
  border-color: rgba(66, 165, 245, 0.45);
  box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.12);
}
.parent-profile-hero__stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: min(100%, 140px);
}
.parent-profile-stat {
  text-align: right;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 120px;
}
.parent-profile-stat__value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
}
.parent-profile-stat__label {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}
.parent-profile-panel,
.parent-profile-aside {
  padding: 20px 22px;
  height: 100%;
}
.parent-profile-panel__title {
  margin: 0 0 16px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.parent-profile-dl {
  margin: 0;
}
.parent-profile-dl__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.parent-profile-dl__row:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.parent-profile-dl dt {
  margin: 0;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}
.parent-profile-dl dd {
  margin: 0;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  min-width: 0;
}
.parent-profile-aside {
  background: linear-gradient(165deg, rgba(21, 101, 192, 0.06) 0%, var(--card) 42%);
  border: 1px solid rgba(66, 165, 245, 0.18);
}
.parent-profile-aside__text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}
.parent-profile-children {
  border: 1px solid var(--border);
}
.parent-profile-children__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--card) 100%);
}
.parent-profile-children__title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
}
.parent-profile-children__sub {
  max-width: 520px;
}
.parent-profile-children__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--primary-strong);
  background: rgba(66, 165, 245, 0.12);
  border: 1px solid rgba(66, 165, 245, 0.25);
}
.parent-profile-empty {
  padding: 40px 22px 44px;
  text-align: center;
}
.parent-profile-empty__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
}
.parent-profile-empty__hint {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.parent-profile-table tbody td {
  vertical-align: middle;
}
.parent-profile-table__name {
  font-weight: 600;
  color: var(--text-1);
}
.parent-profile-table__muted {
  font-size: 13px;
  color: var(--text-2);
}
@media (max-width: 767.98px) {
  .parent-profile-hero__stats {
    margin-left: 0;
    width: 100%;
  }
  .parent-profile-stat {
    width: 100%;
    text-align: left;
  }
}

/* ——— Guardians directory (parents index) ——— */
.parents-directory-page .page-header {
  margin-bottom: 20px;
}
.parents-directory-kpi .stat-tile-value {
  font-variant-numeric: tabular-nums;
}
.parents-directory-card {
  border: 1px solid var(--border);
}
.parents-directory-toolbar {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--card) 100%);
}
.parents-directory-search {
  min-width: 200px;
  max-width: 420px;
}
.parents-directory-search .form-control {
  padding-left: 2.25rem;
  border-color: var(--input-border);
  border-radius: var(--radius-input);
  font-size: var(--fs-small);
  background: var(--surface);
  color: var(--text-1);
}
.parents-directory-search__icon {
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  pointer-events: none;
  opacity: 0.65;
}
.parents-directory-select {
  max-width: 160px;
  border-color: var(--input-border);
  border-radius: var(--radius-input);
  font-size: var(--fs-small);
  background: var(--surface);
  color: var(--text-1);
}
.parents-directory-meta strong {
  font-weight: 700;
}
.parents-directory-empty {
  padding: 2.5rem 1.5rem 3rem;
}
.parents-directory-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary-strong);
  background: linear-gradient(145deg, rgba(21, 101, 192, 0.12), rgba(66, 165, 245, 0.08));
  border: 1px solid rgba(66, 165, 245, 0.2);
}
.parents-directory-name:hover {
  color: var(--primary-strong) !important;
}
.parents-directory-table__row:hover td {
  background: rgba(66, 165, 245, 0.04);
}
.parents-directory-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.parents-directory-pager .pagination .page-link {
  border-radius: var(--radius);
}
[data-theme='dark'] .parents-directory-table__row:hover td {
  background: rgba(66, 165, 245, 0.08);
}

.class-detail-students-panel .class-detail-students-table tbody tr.collapse td {
  padding-top: 0;
  border-top: none;
}
.class-detail-student-expand {
  background: var(--surface-2);
  border: 1px solid var(--border);
}
[data-theme='dark'] .class-detail-student-expand {
  background: rgba(255, 255, 255, 0.03);
}
