.admin-dashboard-compact .academic-performance-card { height: 100%; }
.admin-dashboard-compact .dashboard-finance-section h5 { font-size: 0.98rem; }
.admin-dashboard-compact .academic-performance-card .table-responsive > .table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.admin-dashboard-compact .academic-performance-card th,
.admin-dashboard-compact .academic-performance-card td {
  overflow-wrap: anywhere;
  white-space: normal;
}
/* ============================================================
   Beloved Junior Academy – Accounting System
   Main Stylesheet
   ============================================================ */

:root {
  --primary: #1a4fa0;
  --primary-dark: #0f3070;
  --primary-light: #e8f0fc;
  --accent: #f59e0b;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;
  --sidebar-width: 220px;
  --topbar-height: 60px;
  --sidebar-bg: #0f1e3c;
  --sidebar-text: #c8d3e8;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: rgba(255,255,255,0.15);
  --body-bg: #f0f4f8;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-muted: #64748b;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; }

img, svg, canvas { max-width: 100%; }

button, input, select, textarea { max-width: 100%; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--body-bg);
  margin: 0;
  color: #1e293b;
  font-size: 0.9rem;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100dvh;
  background: var(--sidebar-bg);
  z-index: 1000;
  overflow-y: auto;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

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

.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: white;
  flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { color: white; font-weight: 700; font-size: 0.9rem; }
.brand-sub  { color: var(--sidebar-text); font-size: 0.72rem; }

.sidebar-nav { padding: 12px 0 20px; flex: 1; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(200, 211, 232, 0.45);
  padding: 14px 18px 5px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  transition: var(--transition);
  font-size: 0.875rem;
  position: relative;
}

.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item-disabled { color: var(--sidebar-text); cursor: default; opacity: 0.72; }
.nav-item.active {
  background: var(--sidebar-active);
  color: white;
  border-right: 3px solid var(--accent);
}
.nav-item i { width: 18px; font-size: 0.9rem; flex-shrink: 0; }

/* ---- MAIN WRAPPER ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* ---- TOPBAR ---- */
.topbar {
  min-height: var(--topbar-height);
  height: auto;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  padding: 6px 8px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 1.1rem;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--body-bg); }

.topbar-title {
  font-weight: 600;
  font-size: 1rem;
  color: #1e293b;
  flex: 1;
  min-width: 0;
}

.topbar-right {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.notification-button {
  position: relative;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
}
.notification-button:hover { background: var(--body-bg); color: var(--primary); }
.notification-count {
  position: absolute;
  top: -2px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #dc2626;
  color: #fff;
  font-size: 0.64rem;
  line-height: 17px;
  text-align: center;
}
.notification-dropdown { width: min(360px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.notification-heading { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notification-heading small { color: var(--text-muted); }
.notification-item { display: flex; gap: 10px; width: 100%; padding: 11px 14px; color: var(--text); text-decoration: none; border: 0; border-bottom: 1px solid var(--border); background: transparent; font: inherit; text-align: left; cursor: pointer; }
.notification-item:hover { background: var(--body-bg); }
.notification-item strong, .notification-item small { display: block; }
.notification-item strong { font-size: 0.82rem; }
.notification-item small { color: var(--text-muted); margin-top: 2px; }
.notification-icon { width: 24px; flex: 0 0 24px; text-align: center; }
.notification-detail-dialog { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; width: 100%; height: 100%; padding: 1rem; background: rgba(15, 23, 42, .45); }
.notification-detail-dialog[hidden] { display: none; }
.notification-detail-dialog .notification-detail-body { width: min(92vw, 420px); border-radius: 12px; background: #fff; box-shadow: 0 20px 60px rgba(15, 23, 42, .25); }
.notification-detail-body { padding: 24px; }
.notification-detail-body h2 { margin: 0 0 8px; font-size: 1.1rem; }
.notification-detail-body p { margin: 0 0 20px; color: var(--text-muted); }
.notification-detail-actions { display: flex; justify-content: flex-end; gap: 8px; }
.notification-detail-actions button, .notification-detail-actions a { border: 0; border-radius: 6px; padding: 9px 14px; text-decoration: none; cursor: pointer; }
.notification-detail-actions button { background: var(--body-bg); color: var(--text); }
.notification-detail-actions a { background: var(--primary); color: #fff; }
.notification-empty { display: flex; gap: 8px; align-items: center; padding: 18px 14px; color: var(--text-muted); }

.user-menu {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  padding: 5px 10px; border-radius: 8px;
  transition: var(--transition); color: #1e293b; font-size: 0.875rem;
}
.user-menu:hover { background: var(--body-bg); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white; font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---- PAGE CONTENT ---- */
.messages-container { padding: 10px 20px 0; }
.page-content { flex: 1; min-width: 0; padding: 24px 20px; }
.page-footer { padding: 16px 20px; border-top: 1px solid var(--border); text-align: center; }

/* ---- CARDS ---- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}
.card-header {
  background: none; border-bottom: 1px solid var(--border);
  padding: 14px 18px; font-weight: 600;
}

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 16px;
  min-height: 142px;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dashboard-stat-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.dashboard-stat-link:hover .stat-card { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-icon.bg-primary-soft { background: var(--primary-light); color: var(--primary); }
.stat-icon.bg-success-soft { background: #dcfce7; color: var(--success); }
.stat-icon.bg-warning-soft { background: #fef3c7; color: var(--warning); }
.stat-icon.bg-danger-soft  { background: #fee2e2; color: var(--danger); }

.stat-body { flex: 1; min-width: 0; }
.stat-body, .card-header, .card-body { min-width: 0; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; overflow-wrap: anywhere; word-break: break-word; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: #0f172a; line-height: 1.15; overflow-wrap: anywhere; word-break: break-word; }
.stat-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; overflow-wrap: anywhere; word-break: break-word; }
.card-body, .card-header, .page-header, .page-content { overflow-wrap: anywhere; word-break: break-word; }
.statement-summary > [class*="col-"] { display: flex; }
.statement-summary .stat-card { width: 100%; min-height: 118px; padding: 16px; gap: 12px; }
.statement-summary .stat-icon { width: 40px; height: 40px; border-radius: 10px; font-size: 1.05rem; }
.statement-summary .stat-label { font-size: 0.72rem; margin-bottom: 4px; }
.statement-summary .stat-value { font-size: 1.35rem; line-height: 1.15; white-space: nowrap; }
.statement-summary .stat-sub { font-size: 0.7rem; line-height: 1.25; }
.statement-actions { justify-content: flex-end; }

/* Keep the director's first view dense; detailed views remain available through links. */
.admin-dashboard-compact { max-width: 1500px; }
.admin-dashboard-compact .mb-4 { margin-bottom: 0.85rem !important; }
.admin-dashboard-compact .mb-3 { margin-bottom: 0.55rem !important; }
.admin-dashboard-compact .stat-card { min-height: 96px; height: 100%; padding: 12px; gap: 10px; }
.admin-dashboard-compact .stat-icon { width: 36px; height: 36px; border-radius: 9px; font-size: 1rem; }
.admin-dashboard-compact .stat-label { font-size: 0.68rem; margin-bottom: 2px; }
.admin-dashboard-compact .stat-value { font-size: 1.28rem; }
.admin-dashboard-compact .stat-sub { font-size: 0.68rem; line-height: 1.2; margin-top: 3px; }
.admin-dashboard-compact h5 { font-size: 0.98rem; }
.admin-dashboard-compact p.small { font-size: 0.7rem !important; }
.admin-dashboard-compact .card-header { padding: 9px 12px; font-size: 0.8rem; }
.admin-dashboard-compact .card-body { padding: 10px 12px; }
.admin-dashboard-compact .table { font-size: 0.75rem; }
.admin-dashboard-compact .table > :not(caption) > * > * { padding: 6px 8px; }
.admin-dashboard-compact .table th { font-size: 0.64rem; }
.admin-dashboard-compact .chart-container { height: 190px; }
.admin-dashboard-compact .collection-rate-chart { height: 105px; }
.admin-dashboard-compact .grade-collection-chart { height: 170px !important; }
.admin-dashboard-compact .chart-container { height: 130px; }
.admin-dashboard-compact .row > .col-lg-4 > .card { min-width: 0; }
.admin-dashboard-compact .row > .col-lg-4 .card-header { min-height: 42px; }
.admin-dashboard-compact .payment-class-card {
  position: relative;
  min-height: 58px;
  padding: 9px 28px 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--text);
}
.admin-dashboard-compact .payment-class-card:hover,
.admin-dashboard-compact .payment-class-card[aria-expanded="true"] { border-color: var(--primary); background: var(--primary-light); }
.payment-class-label, .payment-class-count { display: block; }
.payment-class-label { font-weight: 700; font-size: 0.78rem; }
.payment-class-count { color: var(--text-muted); font-size: 0.68rem; margin-top: 2px; }
.payment-class-chevron { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 0.7rem; color: var(--text-muted); }
.payment-class-card[aria-expanded="true"] .payment-class-chevron { transform: translateY(-50%) rotate(180deg); }
.payment-student-list { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.payment-student-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--border); }
.payment-student-row:last-child { border-bottom: 0; }
.payment-receipt-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }

@media (min-width: 1200px) {
  .admin-dashboard-compact .row.g-3 > .col-xl-3 { width: 25%; }
  .admin-dashboard-compact .row.g-3 > .col-xl-4 { width: 25%; }
  .admin-dashboard-compact .row.g-3.dashboard-finance-summary > .col-xl-3,
  .admin-dashboard-compact .row.g-3.dashboard-academic-summary > .col-xl-3 { width: 33.333333%; }
  .admin-dashboard-compact section[aria-labelledby="academic-performance-heading"] .row.g-3 > .col-xl-8 { width: 66.666667%; }
  .admin-dashboard-compact section[aria-labelledby="academic-performance-heading"] .row.g-3 > .col-xl-6 { width: 50%; }
  .admin-dashboard-compact section[aria-labelledby="parent-communication-heading"] .row.g-3 > .col-xl-4 { width: 33.333333%; }
}

@media (min-width: 768px) {
  .admin-dashboard-compact .row.g-3 > .col-sm-6 { width: 25%; }
}

/* ---- TABLES ---- */
.table { font-size: 0.875rem; width: 100%; table-layout: auto; }
.table-responsive { -webkit-overflow-scrolling: touch; }
.table-responsive > .table { min-width: 620px; }
.table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.table > :not(caption) > * > * { padding: 10px 12px; }
.table td, .table th { overflow-wrap: anywhere; word-break: break-word; vertical-align: top; }
.fee-statement-table { min-width: 0 !important; table-layout: fixed; }
.fee-statement-table th:nth-child(1) { width: 18%; }
.fee-statement-table th:nth-child(2) { width: 20%; }
.fee-statement-table th:nth-child(n+3) { width: 20.666%; }
.fee-matrix-wrap { overflow-x: auto; }
.fee-matrix { min-width: 860px !important; table-layout: auto; }
.fee-matrix th, .fee-matrix td { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
.fee-matrix th:first-child, .fee-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
}
.fee-matrix th:first-child { z-index: 2; }

/* ---- BADGES ---- */
.badge { font-size: 0.7rem; font-weight: 600; padding: 4px 9px; border-radius: 20px; }

/* ---- FORMS ---- */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-size: 0.875rem;
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,79,160,0.12);
}
.form-label { font-size: 0.82rem; font-weight: 600; color: #374151; margin-bottom: 5px; }

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

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-header h4 { margin: 0; font-weight: 700; font-size: 1.15rem; }
.page-header .breadcrumb { margin: 0; font-size: 0.8rem; }
.page-header > :last-child { max-width: 100%; }

/* ---- STATUS BADGES ---- */
.status-paid      { background:#dcfce7; color:#166534; }
.status-pending   { background:#fef3c7; color:#92400e; }
.status-partial   { background:#dbeafe; color:#1e40af; }
.status-overdue   { background:#fee2e2; color:#991b1b; }
.status-approved  { background:#dcfce7; color:#166534; }
.status-rejected  { background:#fee2e2; color:#991b1b; }

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100dvh;
  background: linear-gradient(135deg, #0f1e3c 0%, #1a4fa0 60%, #0f3070 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-logo {
  width: 72px; height: 72px; border-radius: 18px;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; margin: 0 auto 18px;
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }

/* ---- RECEIPT ---- */
.receipt-card { width: 100%; max-width: none; margin: 0 auto; }
.receipt-header { background: var(--primary); color: white; padding: 20px; border-radius: var(--radius) var(--radius) 0 0; text-align: center; }
.receipt-brand { width: fit-content; margin: 0 auto; }
.receipt-card > .card { width: 100%; }
.payment-form-card { width: min(100%, 760px); margin: 0 auto; }
.payment-form-card .card-body { padding: 24px; }
.payment-form-card .alert { margin-bottom: 24px; }
.payment-form-card .payment-all-field { grid-column: 1 / -1; }
#id_payment_method.payment-method-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}
#id_payment_method.payment-method-options > div { display: flex; align-items: center; gap: 6px; min-width: 0; }
#id_payment_method.payment-method-options label { margin: 0; white-space: nowrap; }
#id_payment_method.payment-method-options input { margin: 0; }

@media (min-width: 768px) {
  .payment-form-card form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .payment-form-card form .payment-date-field { grid-column: 1; }
  .payment-form-card form .payment-method-field { grid-column: 2; }
  .payment-form-card form .payment-reference-field,
  .payment-form-card form .payment-notes-field,
  .payment-form-card form .d-flex { grid-column: 1 / -1; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 100%;
    width: 100vw;
    height: 100dvh;
    background: rgba(15, 30, 60, 0.32);
    pointer-events: none;
  }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 20px 16px; }
  .topbar-right { min-width: 0; }
  .topbar-right .dropdown { max-width: 100%; }
  .topbar-right .btn, .topbar-right .user-menu { white-space: nowrap; }
  .table-responsive { width: 100%; overflow-x: auto; }
}

@media (max-width: 575.98px) {
  .sidebar { width: 190px; }
  .brand-name { font-size: 0.78rem; }
  .brand-sub { font-size: 0.65rem; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar-title { flex-basis: calc(100% - 48px); }
  .topbar-right { margin-left: auto; }
  .topbar-right .dropdown.me-2 { margin-right: 0 !important; }
  .topbar-right .dropdown:first-child .btn { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
  .user-menu { padding: 4px 6px; }
  .messages-container { padding: 10px 12px 0; }
  .page-content { padding: 16px 12px; }
  .page-footer { padding: 14px 12px; }
  .page-header { align-items: flex-start; }
  .page-header > :last-child { width: 100%; }
  .page-header .d-flex { width: 100%; flex-wrap: wrap; }
  .page-header .d-flex > form { flex: 1 1 180px; }
  .page-header .d-flex > .btn,
  .page-header .d-flex > form .btn { flex: 0 0 auto; }
  .statement-actions { justify-content: flex-start; }
  .page-header h4 { font-size: 1rem; overflow-wrap: anywhere; }
  .breadcrumb { flex-wrap: wrap; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-icon { width: 40px; height: 40px; font-size: 1rem; }
  .stat-value { font-size: 1.25rem; overflow-wrap: anywhere; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .card { max-width: 100% !important; }
  .card-header.d-flex { align-items: flex-start !important; flex-wrap: wrap; gap: 8px; }
  .card-header.d-flex > * { max-width: 100%; }
  .row > [class*="col-"] { min-width: 0; }
  .form-control, .form-select { width: 100%; min-width: 0; }
  .page-content .table td,
  .page-content .table th { overflow-wrap: anywhere; word-break: break-word; }
  .fee-matrix-wrap { margin-right: -14px; padding-right: 14px; }
  .fee-matrix th, .fee-matrix td { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
  .fee-matrix th:first-child, .fee-matrix td:first-child { min-width: 112px; }
  .page-content .table-sm td,
  .page-content .table-sm th { padding: 8px 7px; }
  .page-content .card-body > table { width: 100%; table-layout: fixed; }
  .page-content .card-body > table th { width: 42% !important; }
  .page-content .card-body > table td { width: 58%; }
  .form-check { min-height: 1.5rem; }
  .btn { max-width: 100%; white-space: normal; }
  .d-flex.gap-2 { flex-wrap: wrap; }
  .d-flex.gap-2 > .btn, .d-flex.gap-2 > a.btn { flex: 1 1 auto; }
  .table { margin-bottom: 0; }
  .table-responsive > .table { min-width: 600px; }
  .fee-statement-table { min-width: 680px !important; table-layout: auto; }
  .statement-summary .stat-card { min-height: 112px; }
  .receipt-card { width: 100%; }
  .payment-form-card { width: 100%; }
  .payment-form-card .card-body { padding: 16px; }
  .payment-form-card form { display: block; }
  #id_payment_method.payment-method-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #id_payment_method.payment-method-options > div { min-width: 0; }
  #id_payment_method.payment-method-options label { overflow-wrap: anywhere; white-space: normal; }
  .receipt-card .d-flex.justify-content-between { flex-wrap: wrap; gap: 10px; }
  .receipt-card .text-end { text-align: left !important; }
  .login-card { padding: 32px 20px; margin: 12px; }
  .chart-container { height: 240px; }
  .btn-group { flex-wrap: wrap; }
}

@media (max-width: 991.98px) and (max-height: 600px) {
  .sidebar-brand { padding: 12px 14px; }
  .brand-logo { width: 34px; height: 34px; font-size: 1rem; }
  .sidebar-nav { padding: 6px 0 10px; }
  .nav-section-label { padding: 8px 14px 3px; }
  .nav-item { gap: 8px; padding: 6px 14px; font-size: 0.82rem; }
  .nav-item i { width: 16px; font-size: 0.82rem; }
}

/* ---- SCROLLBAR ---- */
.sidebar {
  scrollbar-width: auto;
  scrollbar-color: var(--accent) rgba(255,255,255,0.12);
}
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-track { background: rgba(255,255,255,0.12); }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--accent);
  border: 2px solid var(--sidebar-bg);
  border-radius: 6px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: #fbbf24; }

/* ---- CHART CONTAINER ---- */
.chart-container { position: relative; height: 210px; }
.collection-rate-chart { position: relative; height: 210px; }
.grade-collection-chart { position: relative; width: min(100%, 720px); height: 190px; }

/* ---- PAYSLIP ---- */
.payslip-print { max-width: 700px; margin: 0 auto; }

.student-details-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 28px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.student-details-row--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.student-details-row:last-child { border-bottom: 0; padding-bottom: 0; }
.student-details-row > div { min-width: 0; }
.student-details-row .text-muted,
.student-details-row > div > span:last-child,
.student-details-row > div > strong { display: block; }
.student-details-row .text-muted { margin-bottom: 3px; }
.student-details-row > div > span:last-child,
.student-details-row > div > strong { overflow-wrap: anywhere; }
.student-details-heading {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.student-detail-item {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}
.student-detail-item .text-muted {
  color: var(--text-muted) !important;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.student-detail-item > span:last-child,
.student-detail-item > strong { color: var(--text); font-size: 0.95rem; }
.principal-welcome {
  border-left: 4px solid var(--primary);
  padding: 4px 0 4px 16px;
}
.principal-welcome h3 { font-size: clamp(1.35rem, 2vw, 1.8rem); }
.principal-section-title {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

@media (min-width: 992px) {
  .fee-record-form-card { max-width: none !important; width: 100%; }
  .principal-summary-grid .stat-card { min-height: 150px; }
  .principal-reports-grid .card { min-height: 300px; }
  .student-finance-layout { display: block; }
  .student-finance-layout > [class*="col-"] { width: 100%; }
  .learner-only-profile .card-body { padding: 24px 28px; }
  .learner-only-profile .card-body.text-center { padding: 34px 28px; }
  .learner-only-profile h5 { font-size: 1.45rem; }
  .learner-only-profile .badge { font-size: 0.82rem; padding: 6px 12px; }
}

@media print {
  .sidebar, .topbar, .btn, .page-footer { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .payslip-print { box-shadow: none !important; }
  .payslip-print img { display: block !important; visibility: visible !important; }
}
