/* ============================================================
   NTIT Student Portal - Master Stylesheet
   Nursing Training Institute of Technology
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ============================================================
   CSS VARIABLES (BRAND TOKENS)
   ============================================================ */
:root {
  /* Brand Colors */
  --primary:        #1a3a6e;
  --primary-dark:   #122b52;
  --primary-light:  #2c5090;
  --primary-pale:   #e8edf6;
  --accent:         #c0392b;
  --accent-dark:    #962d22;
  --accent-light:   #e74c3c;
  --accent-pale:    #fdf0ef;

  /* Neutral Palette */
  --white:          #ffffff;
  --gray-50:        #f8fafc;
  --gray-100:       #f1f5f9;
  --gray-200:       #e2e8f0;
  --gray-300:       #cbd5e1;
  --gray-400:       #94a3b8;
  --gray-500:       #64748b;
  --gray-600:       #475569;
  --gray-700:       #334155;
  --gray-800:       #1e293b;
  --gray-900:       #0f172a;

  /* Status Colors */
  --success:        #16a34a;
  --success-bg:     #f0fdf4;
  --warning:        #d97706;
  --warning-bg:     #fffbeb;
  --danger:         #dc2626;
  --danger-bg:      #fef2f2;
  --info:           #0284c7;
  --info-bg:        #f0f9ff;

  /* Typography */
  --font-display:   'Libre Baskerville', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;

  /* Sizing */
  --sidebar-w:      260px;
  --topbar-h:       64px;
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --radius-full:    9999px;

  /* Shadows */
  --shadow-xs:      0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:      0 2px 8px rgba(26,58,110,0.08);
  --shadow:         0 4px 16px rgba(26,58,110,0.12);
  --shadow-md:      0 8px 24px rgba(26,58,110,0.14);
  --shadow-lg:      0 16px 48px rgba(26,58,110,0.16);

  /* Transitions */
  --transition:     all 0.2s ease;
  --transition-slow:all 0.35s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }
img { max-width: 100%; display: block; }
button { font-family: var(--font-body); cursor: pointer; }
input, select, textarea { font-family: var(--font-body); }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); color: var(--primary); line-height: 1.25; }
p { line-height: 1.7; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.text-display { font-family: var(--font-display); }
.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 1.875rem; }
.text-4xl  { font-size: 2.25rem; }
.font-light   { font-weight: 300; }
.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--gray-500); }
.text-white   { color: var(--white); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* ============================================================
   LAYOUT - PORTAL WRAPPER
   ============================================================ */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.48);
  z-index: 150;
}

.sidebar-overlay.show { display: block; }

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-logo {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--white);
  padding: 3px;
  flex-shrink: 0;
  object-fit: contain;
}

.sidebar-brand-text {}
.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.sidebar-brand-sub {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-section {
  padding: 12px 0;
}
.sidebar-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.35);
  padding: 8px 20px 4px;
  font-weight: 600;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--white);
  background: rgba(255,255,255,0.1);
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--white);
  font-weight: 700;
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.2;
}
.sidebar-user-role {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  text-transform: capitalize;
}
.sidebar-campus-meta {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-campus-meta svg {
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,0.8);
  flex-shrink: 0;
}
.sidebar-campus-label {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.58);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}
.sidebar-campus-name {
  margin-top: 2px;
  font-size: 0.76rem;
  color: var(--white);
  line-height: 1.3;
  font-weight: 600;
}

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

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-menu-btn {
  display: none;
  background: none; border: none;
  color: var(--gray-600);
  padding: 6px;
  border-radius: var(--radius-sm);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.topbar-breadcrumb {
  font-size: 0.8rem;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-breadcrumb span { color: var(--gray-600); }

.topbar-spacer { flex: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar-campus-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.topbar-campus-shell.all-campuses {
  border-color: var(--gray-300);
  background: var(--gray-50);
}
.topbar-campus-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(26,58,110,0.12);
  background: rgba(26,58,110,0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-campus-icon svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}
.topbar-campus-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.topbar-campus-title {
  font-size: 0.62rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}
.topbar-campus-value {
  margin-top: 0;
  font-size: 0.8rem;
  color: var(--gray-800);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 220px;
}
.topbar-campus-switch {
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}
.topbar-campus-switch::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-42%) rotate(45deg);
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--gray-500);
  border-bottom: 2px solid var(--gray-500);
  pointer-events: none;
}
.topbar-campus-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-700);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0 28px 0 10px;
  width: 218px;
  max-width: 32vw;
  transition: var(--transition);
}
.topbar-campus-switch:hover .topbar-campus-select {
  border-color: var(--primary);
}
.topbar-campus-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,58,110,0.12);
}

.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: var(--transition);
}
.topbar-icon-btn:hover { background: var(--primary-pale); color: var(--primary); border-color: var(--primary); }
.topbar-icon-btn svg { width: 17px; height: 17px; }
.notification-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--white);
}

.topbar-divider {
  width: 1px; height: 28px;
  background: var(--gray-200);
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: var(--transition);
}
.topbar-profile:hover { background: var(--gray-100); }
.topbar-profile-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--white);
  font-weight: 700;
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.topbar-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-profile-info {}
.topbar-profile-name { font-size: 0.8rem; font-weight: 600; color: var(--gray-800); }
.topbar-profile-role { font-size: 0.7rem; color: var(--gray-500); text-transform: capitalize; }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  padding: 28px;
  flex: 1;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-header > * { min-width: 0; }
.page-header h1 {
  font-size: 1.75rem;
  color: var(--primary);
}
.page-header p {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h2, .card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}
.card-header .card-header-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}

.card-body { padding: 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* STAT CARDS */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4px; height: 100%;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.stat-card.blue::after  { background: var(--primary); }
.stat-card.red::after   { background: var(--accent); }
.stat-card.green::after { background: var(--success); }
.stat-card.orange::after{ background: var(--warning); }

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-pale); color: var(--primary); }
.stat-icon.red    { background: var(--accent-pale); color: var(--accent); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon svg { width: 24px; height: 24px; }

.stat-info {
  min-width: 0;
  flex: 1;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  font-family: var(--font-display);
}
.stat-value-money {
  display: block;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: clamp(0.98rem, 1.25vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--gray-900);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 4px;
  font-weight: 500;
}
.stat-change {
  font-size: 0.75rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--accent); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); }

table.ntit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.ntit-table thead tr {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}
.ntit-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  font-weight: 600;
  white-space: nowrap;
}
.ntit-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.ntit-table tbody tr:last-child td { border-bottom: none; }
.ntit-table tbody tr:hover td { background: var(--primary-pale); }
.ntit-table .avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ============================================================
   BADGES / STATUS TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-pale); color: var(--primary); }
.badge-neutral { background: var(--gray-100); color: var(--gray-600); }
.badge-accent  { background: var(--accent-pale); color: var(--accent); }
.badge svg     { width: 10px; height: 10px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.form-label .required { color: var(--accent); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,58,110,0.1);
}
.form-control:read-only { background: var(--gray-50); color: var(--gray-500); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.form-hint { font-size: 0.78rem; color: var(--gray-400); margin-top: 5px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 5px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* Toggle Switch */
.toggle-wrapper { display: flex; align-items: center; gap: 10px; }
.toggle-input { display: none; }
.toggle-slider {
  width: 44px; height: 24px;
  background: var(--gray-300);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.toggle-input:checked + .toggle-slider { background: var(--primary); }
.toggle-input:checked + .toggle-slider::after { transform: translateX(20px); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }

.btn-accent {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-dark); color: var(--white); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-pale); }

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

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-200);
}
.btn-secondary:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-success {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
}
.btn-success:hover { background: #15803d; border-color: #15803d; color: var(--white); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.875rem;
  border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }
.alert-error   { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #fed7aa; }
.alert-info    { background: var(--info-bg); color: var(--info); border-color: #bae6fd; }

/* Fee locked banner */
.fee-locked-banner {
  background: linear-gradient(135deg, var(--accent-pale), #fff5f5);
  border: 1.5px solid #fca5a5;
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  margin: 20px 0;
}
.fee-locked-banner .lock-icon {
  width: 56px; height: 56px;
  background: var(--accent-pale);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--accent);
}
.fee-locked-banner .lock-icon svg { width: 28px; height: 28px; }
.fee-locked-banner h3 { color: var(--accent); font-size: 1.1rem; margin-bottom: 8px; }
.fee-locked-banner p { color: var(--gray-600); font-size: 0.9rem; max-width: 480px; margin: 0 auto; }

/* ============================================================
   SEARCH & FILTERS
   ============================================================ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--gray-400);
}
.search-input-wrap input {
  width: 100%;
  padding: 9px 14px 9px 38px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}
.page-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.page-btn:hover { background: var(--primary-pale); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   NOTIFICATIONS PANEL
   ============================================================ */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--primary-pale); margin: 0 -24px; padding: 14px 24px; }
.notif-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-icon.info   { background: var(--info-bg); color: var(--info); }
.notif-icon.success{ background: var(--success-bg); color: var(--success); }
.notif-icon.warning{ background: var(--warning-bg); color: var(--warning); }
.notif-icon.fee    { background: var(--accent-pale); color: var(--accent); }
.notif-icon svg { width: 16px; height: 16px; }
.notif-content h4 { font-size: 0.85rem; font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
.notif-content p  { font-size: 0.8rem; color: var(--gray-500); }
.notif-time       { font-size: 0.72rem; color: var(--gray-400); margin-top: 4px; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar-wrap {
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}
.progress-bar-fill.primary { background: var(--primary); }
.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger  { background: var(--accent); }

/* ============================================================
   FILE ITEMS
   ============================================================ */
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  transition: var(--transition);
}
.file-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.file-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--primary-pale);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.file-icon svg { width: 20px; height: 20px; }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta { font-size: 0.75rem; color: var(--gray-400); margin-top: 2px; }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-slow);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: var(--transition-slow);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal.modal-lg { max-width: 720px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; color: var(--primary); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: var(--gray-100);
  border: none;
  color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state-icon {
  width: 72px; height: 72px;
  background: var(--gray-100);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  color: var(--gray-400);
}
.empty-state-icon svg { width: 32px; height: 32px; }
.empty-state h3 { font-size: 1.1rem; color: var(--gray-700); margin-bottom: 8px; }
.empty-state p  { color: var(--gray-400); font-size: 0.9rem; max-width: 360px; margin: 0 auto 20px; }

/* ============================================================
   MARKS DISPLAY
   ============================================================ */
.marks-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.marks-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  padding: 16px 20px;
}
.marks-header h4 { font-size: 0.95rem; color: var(--white); }
.marks-header p  { font-size: 0.78rem; color: rgba(255,255,255,0.7); }
.marks-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); padding: 20px; gap: 16px; }
.mark-item { text-align: center; }
.mark-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); font-family: var(--font-display); }
.mark-label { font-size: 0.72rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.mark-grade-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  overflow: hidden;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--gray-700);
  transition: var(--transition);
  cursor: pointer;
}
.dropdown-item:hover { background: var(--gray-50); color: var(--primary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-bg); }
.dropdown-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }
.dropdown-item svg { width: 15px; height: 15px; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--gray-500);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.responsive-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.responsive-grid-main-aside { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.quick-links-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.inline-split.wrap { flex-wrap: wrap; }
.dashboard-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  position: relative;
}
.dashboard-hero::before,
.dashboard-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.dashboard-hero::before {
  right: -20px;
  top: -20px;
  width: 160px;
  height: 160px;
}
.dashboard-hero::after {
  right: 60px;
  bottom: -40px;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.04);
}
.dashboard-hero-content,
.dashboard-hero-aside {
  position: relative;
  z-index: 1;
}
.dashboard-hero-content {
  min-width: 0;
}
.dashboard-hero-eyebrow {
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.dashboard-hero-title {
  color: var(--white);
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.dashboard-hero-meta {
  color: rgba(255,255,255,0.75);
  font-size: 0.875rem;
}
.dashboard-hero-aside {
  text-align: right;
}
.dashboard-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 3px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  margin-left: auto;
  overflow: hidden;
}
.dashboard-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dashboard-avatar-meta {
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
  margin-top: 8px;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.list-row:last-child { border-bottom: none; }
.list-row-main {
  min-width: 0;
  flex: 1;
}
.list-row-main .title {
  font-weight: 600;
  font-size: 0.88rem;
}
.list-row-main .meta {
  font-size: 0.75rem;
  color: var(--gray-400);
}
.list-row-aside {
  flex-shrink: 0;
  text-align: right;
}
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end { display: flex; justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-0  { padding: 0 !important; }
.hidden { display: none !important; }
.separator { height: 1px; background: var(--gray-200); margin: 20px 0; }
.avatar-initial {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-initial.sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-initial.lg { width: 56px; height: 56px; font-size: 1.125rem; }
.avatar-initial.accent { background: var(--accent); }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .topbar { padding: 0 20px; }
  .page-content { padding: 24px; }
  .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .responsive-grid-main-aside { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  body.sidebar-open { overflow: hidden; }
  .sidebar {
    width: min(86vw, 320px);
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar-menu-btn { display: flex; }
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    padding: 10px 16px;
    gap: 12px;
  }
  .topbar-title {
    max-width: min(42vw, 220px);
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-actions { gap: 6px; }
  .topbar-campus-shell {
    gap: 7px;
    padding: 4px 6px;
    border-radius: 10px;
    max-width: 56vw;
  }
  .topbar-campus-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
  }
  .topbar-campus-title {
    display: none;
  }
  .topbar-campus-value {
    max-width: 19vw;
    font-size: 0.73rem;
  }
  .topbar-campus-shell.switch-enabled .topbar-campus-meta {
    display: none;
  }
  .topbar-campus-switch::after {
    right: 8px;
    width: 6px;
    height: 6px;
  }
  .topbar-campus-select {
    height: 34px;
    width: 158px;
    max-width: 32vw;
    font-size: 0.72rem;
    padding-left: 8px;
    padding-right: 22px;
  }
  .topbar-divider,
  .topbar-profile > [data-lucide="chevron-down"] { display: none; }
  .topbar-profile-info { display: none; }
  .page-content { padding: 16px; }
  .page-header {
    margin-bottom: 20px;
  }
  .page-header h1 { font-size: 1.45rem; }
  .card,
  .stat-card,
  .modal { border-radius: var(--radius); }
  .card-header,
  .card-body,
  .card-footer,
  .modal-header,
  .modal-body,
  .modal-footer { padding-left: 16px; padding-right: 16px; }
  .stat-cards,
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
  .stat-card { padding: 18px; }
  .table-wrapper { margin: 0 -16px; border-radius: 0; }
  table.ntit-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .file-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .file-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .notif-item.unread {
    margin: 0 -16px;
    padding: 14px 16px;
  }
  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .search-bar {
    align-items: stretch;
  }
  .search-input-wrap {
    min-width: 100%;
  }
  .pagination {
    flex-wrap: wrap;
  }
  .form-row,
  .grid-2,
  .grid-3,
  .grid-4,
  .responsive-grid-2,
  .quick-links-grid { grid-template-columns: 1fr; }
  [style*="display:grid"][style*="grid-template-columns:1fr 1fr"],
  [style*="display:grid"][style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="display:grid"][style*="grid-template-columns:2fr 1fr"],
  [style*="display:grid"][style*="grid-template-columns:repeat(auto-fit,minmax(280px,1fr))"],
  [style*="display:grid"][style*="grid-template-columns:repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }
  [style*="display:flex"][style*="justify-content:space-between"] {
    flex-wrap: wrap;
  }
  .dashboard-hero {
    padding: 20px;
    align-items: flex-start;
    flex-direction: column;
  }
  .dashboard-hero::before {
    width: 120px;
    height: 120px;
    right: -30px;
    top: -18px;
  }
  .dashboard-hero::after {
    right: 24px;
    bottom: -32px;
  }
  .dashboard-hero-aside {
    width: 100%;
    text-align: left;
  }
  .dashboard-avatar {
    margin-left: 0;
  }
  .inline-split,
  .list-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .list-row-aside {
    width: 100%;
    text-align: left;
  }
  .modal-overlay {
    padding: 12px;
  }
  .modal-footer {
    justify-content: stretch;
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .stat-cards,
  .stats-grid { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar-title { font-size: 1rem; }
  .topbar-icon-btn,
  .topbar-profile-avatar { width: 34px; height: 34px; }
  .topbar-campus-shell {
    max-width: 52vw;
  }
  .topbar-campus-value {
    max-width: 24vw;
  }
  .topbar-campus-select {
    width: 132px;
    max-width: 26vw;
  }
  .btn-group {
    width: 100%;
  }
}
