/* public/css/style.css */

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

:root {
  --primary:       #4f46e5;
  --primary-dark:  #4338ca;
  --primary-light: #e0e7ff;
  --secondary:     #6366f1;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --info:          #0891b2;
  --gray-50:       #f8f9fc;
  --gray-100:      #eef1f8;
  --gray-200:      #dbe1ee;
  --gray-300:      #c6cede;
  --gray-400:      #98a4bb;
  --gray-500:      #67748f;
  --gray-600:      #4a5670;
  --gray-700:      #2d374b;
  --gray-800:      #1d2433;
  --gray-900:      #111726;
  --sidebar-width: 276px;
  --topbar-height: 92px;
  --shadow-sm:     0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow:        0 12px 28px rgb(17 23 38 / .08);
  --shadow-md:     0 18px 38px rgb(17 23 38 / .12);
  --shadow-lg:     0 28px 60px rgb(17 23 38 / .2);
  --radius:        0.8rem;
  --radius-lg:     1.1rem;
  --font:          'Plus Jakarta Sans', 'Segoe UI', sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: radial-gradient(circle at 12% 20%, #ede9ff 0%, #f6f7fb 45%, #eceffd 100%);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}
.dashboard-body { background: #fff; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

/* ── AUTH PAGES ───────────────────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 16%, #f4f2ef 0%, transparent 42%),
    linear-gradient(160deg, #e6e4e1 0%, #f0eeeb 52%, #e2dfda 100%);
  padding: 1rem;
}
.auth-card {
  background: #f7f5f2;
  border: 1px solid #d5d2cd;
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px rgb(17 23 38 / 0.12);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2329;
}
.auth-logo p { color: var(--gray-500); font-size: 0.875rem; }
.auth-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--gray-900);
}
.auth-body .btn-primary {
  background: linear-gradient(135deg, #2c3138 0%, #171b21 100%);
  border-color: #171b21;
}
.auth-body .btn-primary:hover {
  background: #171b21;
  border-color: #171b21;
}

/* ── APP LAYOUT ───────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  margin: 0;
  border-radius: 0;
  overflow: visible;
  border: 0;
  box-shadow: none;
  background: #fff;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 58%, #3730a3 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  padding: 1.4rem 1.35rem 1.2rem;
  border-bottom: 1px solid rgb(255 255 255 / .14);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-brand img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  object-fit: cover;
}
.sidebar-brand span {
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
  line-height: 1.3;
}
.sidebar-brand small {
  display: block;
  font-size: 0.7rem;
  color: var(--gray-400);
  font-weight: 400;
}
.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 1rem 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-plan-footer {
  margin-top: auto;
  margin: auto 0.75rem 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 0.9rem;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.2);
  position: sticky;
  bottom: 0.7rem;
  backdrop-filter: blur(3px);
}
.sidebar-plan-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}
.sidebar-plan-students {
  margin-top: 0.22rem;
  font-size: 0.72rem;
  color: rgb(255 255 255 / 0.9);
}
.sidebar-plan-upgrade-btn {
  width: 100%;
  border: 1px solid #fff;
  background: #fff;
  color: #312e81;
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.sidebar-plan-upgrade-btn:hover {
  background: #eef2ff;
  border-color: #eef2ff;
}
.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgb(255 255 255 / .58);
  padding: 0.75rem 1.5rem 0.25rem;
  font-weight: 600;
}
.nav-item { display: block; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.95rem;
  margin: 0.2rem 0.8rem;
  color: rgb(255 255 255 / .82);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.85rem;
  transition: all 0.15s;
  text-decoration: none;
}
.nav-link:hover { color: white; background: rgb(255 255 255 / .13); text-decoration: none; }
.nav-link.active {
  color: #fff;
  background: rgb(255 255 255 / .22);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16);
}
.nav-link .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link .badge {
  margin-left: auto;
  background: rgb(255 255 255 / .95);
  color: #4f46e5;
  font-size: 0.65rem;
  min-width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.36rem;
  border-radius: 99px;
}

/* Main content */
.main-content {
  margin-left: 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #fff;
  margin-left: var(--sidebar-width);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.6rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: none;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-school { font-weight: 600; color: var(--gray-800); font-size: 0.9rem; }
.topbar-term { font-size: 0.75rem; color: var(--gray-500); }
.topbar-planline {
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
}
.topbar-planline-right {
  margin-top: 0;
  justify-content: flex-end;
}
.topbar-plan-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.topbar-upgrade-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  text-decoration: none;
}
.topbar-upgrade-link:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
}
.global-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: min(340px, 42vw);
  padding: 0.2rem 0.55rem 0.2rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  background: var(--gray-50);
  color: var(--gray-400);
}
.global-search .form-control {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0.45rem 0.2rem 0.45rem 0;
  font-size: 0.85rem;
}
.global-search .form-control:focus {
  border: none;
  box-shadow: none;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--gray-600);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 0.62rem;
  border-radius: var(--radius);
  position: relative;
  border: 1px solid var(--gray-200);
}
.user-menu:hover { background: var(--gray-100); }
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 0.875rem; font-weight: 500; }
.user-role { font-size: 0.7rem; color: var(--gray-500); text-transform: capitalize; }

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-md);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--gray-100); text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { border-top: 1px solid var(--gray-200); margin: 0.25rem 0; }
.dropdown-user {
  padding: 0.7rem 1rem;
}
.dropdown-user-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--gray-800);
}
.dropdown-user-meta {
  margin-top: 0.12rem;
  font-size: 0.72rem;
  color: var(--gray-500);
}

/* Page content */
.page-content { padding: 1.5rem; flex: 1; min-width: 0; width: 100%; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep::before { content: '/'; }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  max-width: 100%;
  min-width: 0;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-900);
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.payroll-stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: #fef3c7; color: var(--warning); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.purple { background: #ede9fe; color: var(--secondary); }
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}
.admin-stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.admin-stats-grid .finance-wide-stat {
  grid-column: 1 / -1;
}
.admin-stats-grid .finance-wide-stat > div {
  min-width: 0;
}
.admin-stats-grid .finance-wide-stat .stat-value {
  white-space: nowrap;
  font-size: clamp(1.1rem, 2.2vw, 1.65rem);
}

/* ── TABLES ───────────────────────────────────────────────── */
.table-container {
  width: 100%;
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: visible;
  overflow-y: hidden;
  border-radius: var(--radius);
}
table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: auto;
}
thead th {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
.table-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
}
label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 0.62rem 0.9rem;
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--gray-800);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / .1);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-control:disabled { background: var(--gray-100); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 100px; border-radius: 1rem; }
.form-text { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.25rem; }
.invalid-feedback { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input { width: 16px; height: 16px; cursor: pointer; }
.form-check label { margin: 0; cursor: pointer; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; }
.btn-primary   { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success   { background: var(--success); color: white; border-color: var(--success); }
.btn-danger    { background: var(--danger); color: white; border-color: var(--danger); }
.btn-warning   { background: var(--warning); color: white; border-color: var(--warning); }
.btn-info      { background: var(--info); color: white; border-color: var(--info); }
.btn-outline   { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost     { background: transparent; color: var(--gray-600); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-blue    { background: var(--primary-light); color: var(--primary); }
.badge-green   { background: #dcfce7; color: var(--success); }
.badge-yellow  { background: #fef9c3; color: #854d0e; }
.badge-red     { background: #fee2e2; color: var(--danger); }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-purple  { background: #ede9fe; color: var(--secondary); }

/* ── ALERTS ───────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }
.alert-info    { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }
.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  color: inherit;
}
.alert-close:hover { opacity: 1; }

/* ── MODALS ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / .5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem;
}
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 1.25rem; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.875rem;
}
.pagination-info { color: var(--gray-500); }
.pagination-links { display: flex; gap: 0.25rem; }
.page-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--gray-200);
  background: white;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--gray-600);
}
.page-btn:hover { background: var(--gray-50); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── SEARCH & FILTERS ─────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 350px;
}
.search-box input { padding-left: 2.25rem; }
.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

/* ── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
  gap: 0;
  overflow-x: auto;
}
.tab-btn {
  padding: 0.8rem 1.05rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.reports-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: .75rem;
  padding: .25rem;
  margin-bottom: 1rem;
}
.reports-tabs .tab-btn {
  border-radius: .55rem;
  border-bottom: none;
  margin-bottom: 0;
}
.reports-tabs .tab-btn.active {
  border-bottom-color: transparent;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.reports-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 0 0 .75rem;
}
.reports-finance-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.invoice-stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.reports-kpi-card {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--gray-200);
  border-radius: .8rem;
  padding: .75rem .85rem;
}
.reports-kpi-value {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--gray-900);
}
.reports-kpi-label {
  font-size: .76rem;
  color: var(--gray-500);
  margin-top: .2rem;
}
.reports-kpi-hint {
  font-size: .7rem;
  color: var(--gray-400);
  margin-top: .15rem;
}
.reports-mini-bars {
  display: flex;
  align-items: end;
  gap: .5rem;
  min-height: 84px;
}
.reports-mini-bar-wrap {
  display: grid;
  gap: .2rem;
  justify-items: center;
}
.reports-mini-bar {
  width: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
}
.reports-mini-bar-label {
  max-width: 52px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .65rem;
  color: var(--gray-500);
}
.reports-mini-bar-value {
  font-size: .66rem;
  font-weight: 700;
  color: var(--gray-700);
}

/* ── AVATAR & PROFILE ─────────────────────────────────────── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 80px; height: 80px; font-size: 1.5rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 2rem; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-500);
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}
.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}
.empty-state p { font-size: 0.875rem; }

/* ── REPORT CARD (print) ──────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print, .btn { display: none !important; }
  .main-content { margin: 0; }
  .page-content { padding: 0; }
  .print-card { break-inside: avoid; }
}
.report-card-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem;
  border-bottom: 3px solid var(--primary);
  margin-bottom: 1rem;
}
.report-card-logo { width: 80px; height: 80px; object-fit: contain; }
.report-card-school h2 { font-size: 1.25rem; font-weight: 700; }
.report-card-school p { font-size: 0.8rem; color: var(--gray-500); }
.report-table th, .report-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  font-size: 0.875rem;
}
.report-table th { background: var(--gray-100); font-weight: 600; }

/* ── UTILITY ──────────────────────────────────────────────── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-100 { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.hidden { display: none; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 1rem 0; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-layout { min-height: 100vh; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    border-radius: 0;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .global-search { display: none; }
  .topbar-planline { gap: 0.25rem 0.35rem; }
  .topbar-plan-pill, .topbar-upgrade-link {
    font-size: 0.65rem;
  }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-container table { min-width: 600px; }
  .table-actions { flex-wrap: wrap; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .d-flex {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }
  .page-header .btn {
    max-width: 100%;
  }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .5);
    z-index: 99;
  }
  .sidebar-overlay.show { display: block; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 1rem; }
}

/* Settings Page */
.settings-general-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1rem;
}

.settings-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem 1rem;
}

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

.profile-upload-card {
  border: 1px solid var(--gray-200);
  background: linear-gradient(180deg, #fbfcff 0%, #f4f7ff 100%);
  border-radius: 1rem;
  padding: 1rem;
}

.profile-upload-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-900);
}

.profile-upload-subtitle {
  margin-top: 0.25rem;
  color: var(--gray-500);
  font-size: 0.78rem;
}

.profile-upload-preview-wrap {
  margin-top: 0.9rem;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--gray-300);
  border-radius: 0.9rem;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.profile-upload-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.7rem;
}

.profile-upload-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.profile-upload-image.is-visible { display: block; }

.profile-upload-actions {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.profile-upload-note {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.profile-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 768px) {
  .settings-general-grid {
    grid-template-columns: 1fr;
  }

  .settings-two-col {
    grid-template-columns: 1fr;
  }

  .subscription-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .payroll-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reports-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reports-finance-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .invoice-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .subscription-stats-grid {
    grid-template-columns: 1fr;
  }
  .payroll-stats-grid {
    grid-template-columns: 1fr;
  }

  .reports-kpi-grid {
    grid-template-columns: 1fr;
  }
  .reports-finance-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .invoice-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== Dashboard Theme Override: Aether-style ===== */
.dashboard-body {
  background:
    radial-gradient(1200px 500px at 5% 5%, #afc7d9 0%, transparent 60%),
    radial-gradient(900px 480px at 100% 100%, #b9b4e8 0%, transparent 58%),
    linear-gradient(135deg, #b2c7dd 0%, #b6b4e4 100%);
}

.dashboard-body .app-layout {
  min-height: 100vh;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #f2f0ed;
}

.dashboard-body .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 264px;
  height: 100vh;
  padding: 1rem 0.85rem;
  overflow: hidden;
  background: #f4f2ef;
  color: #1d1b1a;
  border-right: 1px solid #e2ddd7;
}

.dashboard-body .sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

.dashboard-body .sidebar-nav::-webkit-scrollbar-thumb {
  background: #d1c9bf;
  border-radius: 999px;
}

.dashboard-body .sidebar-brand {
  padding: 0.6rem 0.7rem 0.9rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid #e1dbd5;
}

.dashboard-body .sidebar-brand .avatar {
  background: linear-gradient(140deg, #6d5ef9 0%, #7d71ff 100%);
}

.dashboard-body .sidebar-brand span,
.dashboard-body .sidebar-brand small {
  color: #26231f;
}

.dashboard-body .nav-section-title {
  color: #91877b;
  font-size: 0.66rem;
  padding: 0.8rem 0.75rem 0.35rem;
}

.dashboard-body .nav-link {
  color: #645f57;
  font-weight: 600;
  font-size: 0.82rem;
  margin: 0.14rem 0.45rem;
  padding: 0.6rem 0.75rem;
  border-radius: 999px;
}

.dashboard-body .nav-link:hover {
  color: #1f1b19;
  background: #ece8e3;
}

.dashboard-body .nav-link.active {
  color: #fff;
  background: #0f1115;
  box-shadow: inset 0 0 0 1px #0f1115;
}

.dashboard-body .nav-link .badge {
  background: #ece8e3;
  color: #28231d;
}
.dashboard-body .sidebar-plan-footer {
  background: #ece8e3;
  border: 1px solid #ded7cf;
  box-shadow: 0 4px 12px rgb(15 17 21 / 0.08);
}
.dashboard-body .sidebar-plan-label {
  color: #181411;
}
.dashboard-body .sidebar-plan-students {
  color: #4e463f;
}
.dashboard-body .sidebar-plan-upgrade-btn {
  background: #0f1115;
  border-color: #0f1115;
  color: #fff;
}
.dashboard-body .sidebar-plan-upgrade-btn:hover {
  background: #1a1f27;
  border-color: #1a1f27;
}

.dashboard-body .main-content {
  margin-left: 264px;
  min-height: 100vh;
  background: #f2f0ed;
}

.dashboard-body .topbar {
  height: 74px;
  background: #f2f0ed;
  border-bottom: 1px solid #e0dbd5;
  padding: 0 1.15rem;
}

.dashboard-body .topbar-school {
  font-size: 1.58rem;
  font-weight: 700;
  color: #141210;
  line-height: 1;
}

.dashboard-body .topbar-term {
  font-size: 0.74rem;
  color: #8f8579;
}

.dashboard-body .global-search {
  width: min(360px, 46vw);
  border: 1px solid #ded9d2;
  background: #f8f6f4;
  border-radius: 999px;
  padding: 0.22rem 0.58rem 0.22rem 0.74rem;
  color: #8f8579;
}

.dashboard-body .global-search .form-control {
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  color: #4b453e;
}

.dashboard-body .user-menu {
  border: 1px solid #ddd7cf;
  background: #f8f6f3;
}

.dashboard-body .page-content {
  padding: 1rem 1.15rem 1.15rem;
  background: #f2f0ed;
}

.dashboard-body .card {
  border: 1px solid #e3ddd6;
  border-radius: 1rem;
  box-shadow: 0 2px 6px rgb(15 17 21 / 0.04);
  background: #f8f6f3;
}

.dashboard-body .card-header {
  border-bottom: 1px solid #e6e0d8;
}

.dashboard-body thead th {
  background: #f3efea;
  border-bottom: 1px solid #e3ddd6;
  color: #7e7368;
}

.dashboard-body tbody tr:hover {
  background: #f3efe9;
}

.dashboard-body .form-control {
  border: 1px solid #ddd7cf;
  background: #fbf9f6;
  border-radius: 0.86rem;
}

.dashboard-body .form-control:focus {
  border-color: #9a8dff;
  box-shadow: 0 0 0 3px rgb(125 113 255 / 0.14);
}

.dashboard-body .btn {
  border-radius: 999px;
  font-weight: 600;
}

.dashboard-body .btn-primary {
  background: #0f1115;
  border-color: #0f1115;
  color: #fff;
}

.dashboard-body .btn-primary:hover {
  background: #1a1f27;
  border-color: #1a1f27;
}

.dashboard-body .btn-secondary {
  background: #ece8e3;
  border-color: #ddd6ce;
  color: #2a241e;
}

.dashboard-body .btn-secondary:hover {
  background: #e2ddd7;
  border-color: #d3cbc2;
}

.dashboard-body .btn-outline {
  background: #f8f6f3;
  border-color: #d8d2ca;
  color: #3a332c;
}

.dashboard-body .btn-outline:hover {
  background: #efebe6;
}

.dashboard-body .btn-success {
  background: #2f7a57;
  border-color: #2f7a57;
  color: #fff;
}

.dashboard-body .btn-success:hover {
  background: #276448;
  border-color: #276448;
}

.dashboard-body .btn-warning {
  background: #b17a2d;
  border-color: #b17a2d;
  color: #fff;
}

.dashboard-body .btn-warning:hover {
  background: #956522;
  border-color: #956522;
}

.dashboard-body .btn-danger {
  background: #b04b4b;
  border-color: #b04b4b;
  color: #fff;
}

.dashboard-body .btn-danger:hover {
  background: #933f3f;
  border-color: #933f3f;
}

.dashboard-body .pagination {
  border-top: 1px solid #e3ddd6;
  background: #f5f2ee;
}

.dashboard-body .pagination-info {
  color: #7f7469;
  font-weight: 600;
}

.dashboard-body .pagination-links {
  gap: 0.4rem;
}

.dashboard-body .page-btn {
  border: 1px solid #d9d2ca;
  background: #f8f5f1;
  color: #564f48;
  font-weight: 700;
  border-radius: 999px;
}

.dashboard-body .page-btn:hover {
  background: #ece6df;
  border-color: #cec5bc;
}

.dashboard-body .page-btn.active {
  background: #0f1115;
  color: #fff;
  border-color: #0f1115;
}

.dashboard-body .user-avatar {
  background: linear-gradient(145deg, #201c19 0%, #3a332c 100%);
  border: 2px solid #e1d9d0;
  color: #f7f3ef;
}

.dashboard-body .avatar {
  background: linear-gradient(145deg, #2a241f 0%, #433a33 100%);
  border: 2px solid #e3dbd2;
  color: #f7f3ef;
}

.dashboard-body .avatar img,
.dashboard-body .user-avatar img {
  border-radius: 50%;
}

.dashboard-body .profile-upload-card {
  background: linear-gradient(180deg, #f7f4f0 0%, #efebe6 100%);
  border: 1px solid #ddd5cc;
}

.dashboard-body .profile-upload-preview-wrap {
  background: #f8f5f1;
  border: 1px dashed #cfc5ba;
}

.dashboard-body .profile-upload-avatar {
  background: linear-gradient(145deg, #1c1916 0%, #3b342d 100%);
  color: #f8f5f1;
}

.dashboard-body .tab-btn.active {
  color: #6f61f7;
  border-bottom-color: #6f61f7;
}

@media (max-width: 992px) {
  .dashboard-body .global-search {
    width: min(290px, 45vw);
  }
}

@media (max-width: 768px) {
  .dashboard-body .sidebar {
    transform: translateX(-100%);
    width: 264px;
    box-shadow: 0 20px 50px rgb(15 17 21 / 0.28);
    z-index: 110;
  }

  .dashboard-body .sidebar.open {
    transform: translateX(0);
  }

  .dashboard-body .main-content {
    margin-left: 0;
  }

  .dashboard-body .topbar {
    padding: 0 0.9rem;
    gap: 0.75rem;
  }

  .dashboard-body .topbar-left {
    flex: 0 1 auto;
    min-width: 0;
    margin-right: 0.75rem;
  }

  .dashboard-body .topbar-school {
    font-size: 1.1rem;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }

  .dashboard-body .topbar-right {
    flex-shrink: 0;
  }

  .dashboard-body .global-search {
    display: none;
  }

  .dashboard-body .page-content {
    padding: 0.85rem;
  }
}

/* Modern Form + Stepper */
.modern-form .modal-body {
  padding-top: 0.95rem;
}

.form-stepper {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.step-item {
  border: 1px solid var(--gray-300);
  background: #f7f8fb;
  color: var(--gray-600);
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.step-item span {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #e7eaf1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
}

.step-item.active {
  color: #fff;
  background: linear-gradient(130deg, #6e5ff7 0%, #7d71ff 100%);
  border-color: #7367fb;
}

.step-item.active span {
  background: rgb(255 255 255 / 0.2);
}

.step-pane {
  display: none;
}

.step-pane.active {
  display: block;
}

.modern-upload-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.import-upload-card {
  border: 1px dashed var(--gray-300);
  border-radius: 0.95rem;
  background: #fafbff;
  padding: 1rem;
  text-align: center;
}

.import-upload-card.dragging {
  border-color: var(--primary);
  background: #eef2ff;
}

.import-upload-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  margin: 0 auto 0.6rem;
  background: #eceffd;
  color: #5f54d8;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.import-upload-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-800);
}

.import-upload-help {
  margin: 0.35rem 0 0.8rem;
  font-size: 0.78rem;
  color: var(--gray-500);
}

.import-upload-filename {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--gray-600);
}

@media (max-width: 900px) {
  .modern-upload-grid {
    grid-template-columns: 1fr;
  }
}

/* Student Profile Responsiveness */
.student-profile-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.student-info-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.8rem;
}

.student-info-value {
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  overflow-wrap: anywhere;
}

.student-attendance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  text-align: center;
}

.student-doc-upload {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.student-doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 992px) {
  .student-profile-layout {
    grid-template-columns: 1fr;
  }

  .student-profile-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .student-doc-upload {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
  .student-attendance-grid {
    grid-template-columns: 1fr;
  }

  .student-info-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .student-info-value {
    max-width: 100%;
    text-align: left;
  }

  .student-doc-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .student-profile-layout .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .student-profile-layout .table-container table.responsive-table {
    min-width: 0 !important;
    width: 100%;
    table-layout: fixed;
  }

  .student-profile-layout .responsive-table thead {
    display: none;
  }

  .student-profile-layout .responsive-table,
  .student-profile-layout .responsive-table tbody,
  .student-profile-layout .responsive-table tr,
  .student-profile-layout .responsive-table td {
    display: block;
    width: 100%;
  }

  .student-profile-layout .responsive-table tr {
    border-bottom: 1px solid var(--gray-100);
    padding: 0.5rem 0;
  }

  .student-profile-layout .responsive-table td {
    border: 0;
    padding: 0.35rem 0.75rem;
    text-align: left;
    overflow-wrap: anywhere;
  }

  .student-profile-layout .responsive-table td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--gray-600);
  }
}
