:root {
  --primary: #1a3a5c;
  --primary-light: #2563eb;
  --accent: #e8a020;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --sidebar-width: 260px;
  --header-height: 60px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f0f4f8;
  margin: 0;
  color: #1e293b;
}

/* ── AUTH ── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url('/pic.jpg') center center / cover no-repeat;
  position: relative;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 60, 0.55);
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  position: relative;
  z-index: 1;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo h1 { font-size: 1.4rem; color: var(--primary); font-weight: 700; margin: 0; }
.auth-logo p  { color: #64748b; font-size: .85rem; margin: 4px 0 0; }

/* ── LAYOUT ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--primary);
  color: #fff;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width .25s ease, transform .3s;
}

.sidebar-brand {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-shrink: 0;
}

.sidebar-brand h5 { margin: 0; font-size: .95rem; font-weight: 700; line-height: 1.3; }
.sidebar-brand small { opacity: .7; font-size: .75rem; }

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  padding: .3rem .4rem;
  border-radius: 5px;
  line-height: 1;
  flex-shrink: 0;
  transition: color .2s, background .2s, transform .25s;
}
.sidebar-collapse-btn:hover { color: #fff; background: rgba(255,255,255,.12); }

.sidebar-nav { padding: .5rem 0; flex: 1; }

.nav-section {
  padding: .4rem 1.5rem .2rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .5;
  font-weight: 600;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.5rem;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: all .2s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,.1);
  border-left-color: var(--accent);
}

.sidebar-nav a i { width: 18px; text-align: center; opacity: .8; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .8rem;
  opacity: .6;
}

/* ── SIDEBAR COLLAPSED ── */
.sidebar.collapsed { width: 64px; }

.sidebar.collapsed .sidebar-brand {
  padding: .9rem 0;
  justify-content: center;
}
.sidebar.collapsed .sidebar-brand-text { display: none; }
.sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

.sidebar.collapsed .nav-section {
  font-size: 0;
  padding: .4rem 0 .2rem;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: .15rem;
}

.sidebar.collapsed .sidebar-nav a {
  font-size: 0;          /* hides text node */
  justify-content: center;
  padding: .65rem 0;
  gap: 0;
  border-left-width: 2px;
}
.sidebar.collapsed .sidebar-nav a i {
  font-size: 1rem;
  width: auto;
  opacity: .85;
}
.sidebar.collapsed .sidebar-nav a:hover i,
.sidebar.collapsed .sidebar-nav a.active i { opacity: 1; }

.sidebar.collapsed .sidebar-footer { display: none; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}

.sidebar.collapsed + .main-content { margin-left: 64px; }

.topbar {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.topbar-title { font-weight: 600; font-size: 1rem; color: var(--primary); }

.topbar-right { display: flex; align-items: center; gap: 1rem; }

.page-body { padding: 1.5rem; flex: 1; }

/* ── STAT CARDS ── */
.stat-card {
  position: relative;
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  border-left: 4px solid var(--primary-light);
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.stat-card.green  { border-left-color: var(--success); }
.stat-card.red    { border-left-color: var(--danger); }
.stat-card.yellow { border-left-color: var(--accent); }

.stat-card .label { font-size: .8rem; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 1.7rem; font-weight: 700; color: var(--primary); margin: .2rem 0 0; }
.stat-card .sub   { font-size: .78rem; color: #94a3b8; margin-top: .1rem; }
.stat-card .icon  { font-size: 2rem; opacity: .15; position: absolute; right: 1.2rem; top: 50%; transform: translateY(-50%); }

/* ── CARDS / PANELS ── */
.panel {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-shrink: 0;
}

.panel-header h6 { margin: 0; font-weight: 600; font-size: .9rem; color: var(--primary); }
.panel-body { padding: 1.25rem; flex: 1; }

/* ── TABLE ── */
.table-responsive { border-radius: 0; }
.table { font-size: .85rem; margin: 0; }
.table th { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #475569; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.table td { vertical-align: middle; color: #334155; }
.table tbody tr:hover { background: #f8fafc; }

/* ── STATUS BADGES ── */
.badge-paid    { background: #dcfce7; color: #166534; }
.badge-unpaid  { background: #fef2f2; color: #991b1b; }
.badge-partial { background: #fef9c3; color: #854d0e; }
.badge-overdue { background: #fee2e2; color: #7f1d1d; }
.badge-pending { background: #f1f5f9; color: #475569; }
.badge-active  { background: #dbeafe; color: #1e40af; }

/* ── FORMS ── */
.form-label { font-weight: 500; font-size: .85rem; color: #374151; margin-bottom: .3rem; }
.form-control, .form-select {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: .875rem;
  padding: .5rem .75rem;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  outline: none;
}

/* ── BUTTONS ── */
.btn { font-size: .85rem; border-radius: 6px; font-weight: 500; }
.btn-primary   { background: var(--primary-light); border-color: var(--primary-light); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-success   { background: var(--success); border-color: var(--success); }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }

/* ── CHARTS ── */
.chart-container { position: relative; height: 280px; }

/* ── PAGINATION ── */
.page-link { font-size: .82rem; }

/* ── LOADING ── */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ── TOAST ── */
.toast-container { z-index: 9999; }

/* ── SCROLLBARS ── */
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }

/* Chromium / Safari */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-corner { background: transparent; }

/* Sidebar gets a slightly darker thumb so it shows on the dark bg */
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.45); }
.sidebar { scrollbar-color: rgba(255,255,255,.25) transparent; }

/* ── MOBILE ── */
.sidebar-toggle { display: none; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .sidebar-toggle { display: block; }
  .stat-card .value { font-size: 1.3rem; }
  .sidebar-collapse-btn { display: none; }
}

/* ── RECEIPT PREVIEW ── */
.receipt-preview {
  border: 2px dashed #e2e8f0;
  border-radius: 8px;
  padding: 1.5rem;
  background: #fafafa;
  font-size: .85rem;
}

/* ── SEARCH BAR ── */
.search-bar { position: relative; }
.search-bar input { padding-left: 2.4rem; }
.search-bar i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }

/* ── OVERDUE HIGHLIGHT ── */
tr.overdue-row { background: #fff5f5 !important; }
tr.paid-row    { background: #f0fdf4 !important; }

/* ── BREADCRUMB ── */
.breadcrumb { background: none; padding: 0; margin-bottom: .5rem; font-size: .82rem; }
.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }

/* ── ADMISSION SUMMARY CARD ── */
.admission-card .panel-header {
  justify-content: center;
  padding: .75rem 1rem;
}
.admission-card .panel-header h6 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
  margin: 0;
}
.adm-section { padding: .55rem 0; }
.adm-labels {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .3rem;
}
.adm-value-center {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}
.adm-psa-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.adm-psa-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}
.adm-currency-label { font-size: .65rem; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; margin-top: .1rem; }
.settings-group-header {
  display: flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--primary);
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--primary-light);
  opacity: .85;
}
.adm-divider { margin: .2rem 0; border-color: #f1f5f9; }
.adm-loading { color: #94a3b8; font-size: .8rem; text-align: center; padding: .5rem 0; }
.adm-section-label {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #94a3b8;
  text-align: center;
  display: block;
  margin-bottom: .1rem;
}

/* ── COLORED PANEL HEADERS ── */
.ph-blue   { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.ph-purple { background: linear-gradient(135deg, #5b21b6, #8b5cf6); }
.ph-green  { background: linear-gradient(135deg, #065f46, #059669); }
.ph-amber  { background: linear-gradient(135deg, #92400e, #d97706); }
.ph-cyan   { background: linear-gradient(135deg, #0369a1, #0ea5e9); }
.ph-rose   { background: linear-gradient(135deg, #9f1239, #e11d48); }
.ph-indigo { background: linear-gradient(135deg, #3730a3, #6366f1); }
.ph-teal   { background: linear-gradient(135deg, #134e4a, #0d9488); }
.ph-pink   { background: linear-gradient(135deg, #831843, #db2777); }
.ph-violet { background: linear-gradient(135deg, #581c87, #9333ea); }
.ph-slate  { background: linear-gradient(135deg, #0f172a, #334155); }
.ph-navy   { background: linear-gradient(135deg, #1e3a5f, #1d4ed8); }
.ph-orange { background: linear-gradient(135deg, #7c2d12, #ea580c); }

[class*="ph-"] { border-bottom: none !important; }
[class*="ph-"] h6 { color: #fff !important; }
[class*="ph-"] i  { color: rgba(255,255,255,.9) !important; }
[class*="ph-"] span { color: rgba(255,255,255,.82) !important; }
[class*="ph-"] .btn-sm {
  color: #fff;
  border-color: rgba(255,255,255,.4);
  background: transparent;
}
[class*="ph-"] .btn-sm:hover { background: rgba(255,255,255,.15); }

/* ── TINTED CARD BODIES ── */
.body-blue   { background: #eff6ff; }
.body-purple { background: #f5f3ff; }
.body-green  { background: #ecfdf5; }
.body-amber  { background: #fffbeb; }
.body-cyan   { background: #e0f2fe; }
.body-rose   { background: #fff1f2; }
.body-indigo { background: #eef2ff; }
.body-teal   { background: #f0fdfa; }
.body-pink   { background: #fdf2f8; }
.body-violet { background: #faf5ff; }
.body-slate  { background: #f1f5f9; }
.body-navy   { background: #eff6ff; }
.body-orange { background: #fff7ed; }

/* Table headers inherit the card's colour tint */
.body-cyan   .table th { background: #bae6fd; color: #0c4a6e; border-bottom-color: #7dd3fc; }
.body-rose   .table th { background: #fecdd3; color: #9f1239; border-bottom-color: #fda4af; }
.body-navy   .table th { background: #dbeafe; color: #1e3a5f; border-bottom-color: #93c5fd; }

/* ── ATTENDANCE SUMMARY CARD ── */
.att-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .42rem 0;
}
.att-label { font-size: .75rem; color: #475569; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.att-value { font-size: .92rem; font-weight: 700; color: var(--primary); }
.att-divider { margin: .1rem 0; border-color: #f1f5f9; }

/* ── FOOTER ── */
.app-footer {
  padding: .65rem 1.5rem;
  text-align: center;
  font-size: .75rem;
  color: #f1f5f9;
  border-top: 1px solid #4a7ab5;
  background: #2d5a8e;
  margin-top: auto;
  letter-spacing: .01em;
  font-weight: 500;
}
