:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fbfd;
  --ink: #172033;
  --muted: #637083;
  --line: #d9e3ee;
  --primary: #0f766e;
  --primary-2: #0b5f59;
  --nav: #101827;
  --nav-soft: #1d2a3d;
  --danger: #b42318;
  --warn: #8a5a00;
  --shadow: 0 18px 50px rgba(16, 24, 39, .10);
}

/* Final ERP fit layer: keeps legacy and newly added pages compact and responsive. */
@media screen {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }
  .content:not(.login-page) {
    max-width: 100%;
    min-width: 0;
    padding: clamp(10px, 1.35vw, 18px);
  }
  .content > *,
  main > *,
  section,
  article,
  form,
  .panel,
  .page-hero,
  .dashboard-hero,
  .records-panel,
  .detail-panel,
  .table-shell,
  .profile-table-scroll {
    min-width: 0;
    max-width: 100%;
  }
  .page-hero,
  .dashboard-hero {
    gap: 12px;
    padding: clamp(13px, 1.65vw, 20px);
  }
  .page-hero h1,
  .dashboard-hero h1,
  .content > h1 {
    font-size: clamp(21px, 2.3vw, 32px);
    line-height: 1.12;
    margin: 6px 0;
    overflow-wrap: anywhere;
  }
  .page-hero p,
  .dashboard-hero p,
  .panel-subtitle {
    font-size: 12px;
    line-height: 1.42;
    max-width: 78ch;
  }
  .hero-balance {
    min-width: 0;
    padding: 12px;
  }
  .hero-balance strong {
    font-size: clamp(18px, 2vw, 26px);
    overflow-wrap: anywhere;
  }
  .panel,
  .records-panel,
  .detail-panel,
  .chart-panel,
  .focus-panel {
    border-radius: 8px;
    padding: clamp(10px, 1.2vw, 14px);
  }
  .panel-title {
    gap: 8px;
    margin-bottom: 9px;
  }
  .panel-title h2,
  .panel h2 {
    font-size: clamp(14px, 1.45vw, 17px);
    line-height: 1.18;
    overflow-wrap: anywhere;
  }
  .settings-tiles,
  .profile-summary-grid,
  .kpi-grid,
  .payment-kpi-grid,
  .dashboard-feature-grid,
  .result-quick-links,
  .fee-quick-links,
  .payment-quick-links,
  .payroll-quick-links,
  .student-quick-links,
  .outstanding-quick-links {
    gap: 9px;
  }
  .settings-tiles a,
  .profile-quick-links a,
  .student-quick-links a,
  .fee-quick-links a,
  .payment-quick-links a,
  .payroll-quick-links a,
  .outstanding-quick-links a,
  .dashboard-feature-card,
  .kpi-grid article,
  .payment-kpi-grid article,
  .profile-summary-grid article {
    border-radius: 8px;
    min-width: 0;
    padding: 10px;
  }
  .settings-tiles strong,
  .dashboard-feature-card header strong,
  .kpi-grid strong,
  .payment-kpi-grid strong,
  .profile-summary-grid strong {
    overflow-wrap: anywhere;
  }
  .form-grid,
  .filters,
  .records-filter,
  .student-form-card,
  .settings-form,
  .inventory-form,
  .payroll-form,
  .certificate-toolbar {
    gap: 9px;
  }
  label {
    min-width: 0;
  }
  input,
  select,
  textarea {
    max-width: 100%;
    min-width: 0;
  }
  input,
  select,
  textarea,
  button,
  .button {
    border-radius: 8px;
    font-size: 12px;
    min-height: 34px;
  }
  input,
  select,
  textarea {
    padding: 7px 9px;
  }
  textarea {
    min-height: 76px;
  }
  button,
  .button {
    padding: 7px 10px;
  }
  .button.mini,
  button.mini,
  .mini {
    min-height: 28px;
    padding: 4px 7px;
  }
  .table-shell,
  .table-scroll,
  .profile-table-scroll,
  .records-panel {
    overflow-x: auto;
  }
  table {
    max-width: 100%;
    border-spacing: 0;
  }
  th,
  td,
  .profile-table th,
  .profile-table td,
  .managed-table th,
  .managed-table td {
    font-size: 11.5px;
    line-height: 1.3;
    padding: 7px 8px;
    vertical-align: middle;
  }
  td,
  th {
    overflow-wrap: anywhere;
  }
  .table-actions,
  .action-stack,
  .record-actions,
  .bulk-actions {
    gap: 5px;
  }
  .pill,
  .danger-pill,
  .status-pill {
    font-size: 10.5px;
    padding: 4px 7px;
    white-space: nowrap;
  }
  .student-passport-thumb {
    border-radius: 8px;
    height: 30px;
    margin-right: 6px;
    width: 30px;
  }
}

@media screen and (max-width: 1180px) {
  .content:not(.login-page) {
    padding: 14px;
  }
  .split,
  .three-col,
  .dashboard-grid,
  .dashboard-grid.lower,
  .analytics-grid,
  .analytics-grid.wide-left,
  .student-workspace,
  .payment-workspace,
  .inventory-workspace,
  .users-workspace,
  .results-workspace,
  .profile-record-grid,
  .result-lower-grid {
    grid-template-columns: 1fr !important;
  }
  .settings-tiles,
  .dashboard-feature-grid,
  .profile-summary-grid,
  .kpi-grid,
  .payment-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media screen and (max-width: 760px) {
  .content:not(.login-page) {
    padding: 10px;
  }
  .page-hero,
  .dashboard-hero,
  .panel,
  .records-panel,
  .detail-panel {
    padding: 10px;
  }
  .page-hero,
  .dashboard-hero,
  .filters,
  .records-filter,
  .table-toolbar,
  .table-pager,
  .table-nav-bar,
  .panel-title,
  .hero-actions,
  .bulk-actions,
  .record-actions {
    align-items: stretch;
    grid-template-columns: 1fr !important;
  }
  .filters,
  .records-filter,
  .panel-title,
  .hero-actions,
  .bulk-actions,
  .record-actions,
  .table-toolbar,
  .table-pager,
  .table-nav-bar {
    flex-direction: column;
  }
  .settings-tiles,
  .dashboard-feature-grid,
  .profile-summary-grid,
  .kpi-grid,
  .kpi-grid.compact,
  .payment-kpi-grid,
  .form-grid,
  .statement-list,
  .result-quick-links,
  .fee-quick-links,
  .payment-quick-links,
  .payroll-quick-links,
  .student-quick-links,
  .outstanding-quick-links {
    grid-template-columns: 1fr !important;
  }
  .filters label,
  .filters button,
  .records-filter label,
  .records-filter button,
  .table-toolbar label,
  .table-toolbar input,
  .table-toolbar select,
  .table-pager button,
  .table-nav-bar .button,
  .hero-actions .button,
  .record-actions .button,
  .bulk-actions label,
  .bulk-actions button,
  .action-stack .button,
  .action-stack button,
  .action-stack form {
    width: 100%;
  }
  .table-shell table,
  .table-scroll table,
  .profile-table,
  .managed-table,
  .records-panel > table,
  .panel > table {
    min-width: 680px;
  }
  .table-shell,
  .table-scroll,
  .profile-table-scroll,
  .records-panel {
    -webkit-overflow-scrolling: touch;
  }
}

@media screen and (max-width: 520px) {
  body {
    font-size: 12px;
  }
  .page-hero h1,
  .dashboard-hero h1,
  .content > h1 {
    font-size: 20px;
  }
  .page-hero p,
  .dashboard-hero p {
    font-size: 11.5px;
  }
  .panel-title h2,
  .panel h2 {
    font-size: 14px;
  }
  th,
  td,
  .profile-table th,
  .profile-table td,
  .managed-table th,
  .managed-table td {
    font-size: 11px;
    padding: 6px;
  }
  .student-passport-thumb {
    height: 26px;
    width: 26px;
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
a { color: var(--primary-2); text-decoration: none; }
.app-shell { min-height: 100vh; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 282px;
  background:
    radial-gradient(circle at 20% 8%, rgba(94,234,212,.16), transparent 26%),
    linear-gradient(180deg, var(--nav), #141f30 58%, #0f1724);
  color: #fff;
  padding: 16px 12px;
  overflow-y: auto;
  z-index: 30;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.22) transparent;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-weight: 800;
  padding: 10px 10px 14px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #d9f99d;
  color: #17320d;
  font-size: 13px;
  letter-spacing: 0;
  overflow: hidden;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.brand-copy strong,
.brand-copy small {
  display: block;
}
.brand-copy small {
  margin-top: 2px;
  color: rgba(255,255,255,.6);
  font-size: 12px;
}
.sidebar-status {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 8px 4px 14px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
}
.sidebar-status .icon {
  width: 22px;
  height: 22px;
  color: #5eead4;
}
.sidebar-status > .icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(94,234,212,.12);
}
.sidebar-status strong,
.sidebar-status small {
  display: block;
}
.sidebar-status small {
  margin-top: 2px;
  color: rgba(255,255,255,.58);
}
.sidebar-nav {
  display: grid;
  gap: 10px;
  padding: 0 2px 18px;
}
.nav-section {
  padding: 6px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  transition: border-color .18s ease, background .18s ease;
}
.nav-section.open {
  border-color: rgba(94,234,212,.22);
  background: rgba(94,234,212,.055);
}
.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.55);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}
.nav-section-title:hover,
.nav-section.open .nav-section-title {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.nav-section-title-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.nav-section-title .icon {
  width: 15px;
  height: 15px;
  color: #5eead4;
}
.nav-section-meta {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.72);
  font-size: 11px;
}
.nav-chevron {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: rgba(255,255,255,.58);
  transition: transform .2s ease;
}
.nav-chevron .icon {
  width: 15px;
  height: 15px;
}
.nav-section.open .nav-chevron {
  transform: rotate(90deg);
  color: #d9f99d;
}
.nav-links {
  display: grid;
  gap: 4px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0;
  transition: max-height .24s ease, opacity .18s ease, padding .18s ease;
}
.nav-section.open .nav-links {
  max-height: 560px;
  opacity: 1;
  padding-top: 6px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  color: #d8e2ef;
  padding: 8px 9px;
  border-radius: 8px;
  min-height: 40px;
  font-weight: 750;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,.09);
  color: #fff;
}
.sidebar-nav a.active {
  box-shadow: 0 10px 26px rgba(15,118,110,.18);
}
.nav-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #9fb1c5;
  background: rgba(255,255,255,.055);
}
.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  color: #062c2a;
  background: #5eead4;
}
.nav-icon .icon {
  width: 18px;
  height: 18px;
}
.nav-indicator {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 999px;
  background: #d9f99d;
  box-shadow: 0 0 0 5px rgba(217,249,157,.12);
}

.topbar {
  margin-left: 282px;
  min-height: 68px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar strong { display: block; font-size: 15px; }
.topbar span, .topbar small { color: var(--muted); }
.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.offline-sync-button {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  position: relative;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}
.offline-sync-button .icon {
  height: 15px;
  width: 15px;
}
.offline-sync-button.is-syncing .icon {
  animation: offline-spin .9s linear infinite;
}
.offline-sync-button small {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
}
.offline-status {
  border: 1px solid rgba(34, 197, 94, .22);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(34, 197, 94, .08);
  color: #166534;
  font-size: 11px;
  font-weight: 900;
}
.offline-status.is-offline {
  border-color: rgba(239, 68, 68, .22);
  background: rgba(239, 68, 68, .08);
  color: #991b1b;
}
@keyframes offline-spin {
  to { transform: rotate(360deg); }
}
.offline-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}
.offline-shell {
  max-width: 560px;
  width: 100%;
}
.offline-shell .panel {
  text-align: center;
}
.logout-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--danger);
  font-weight: 700;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
}
.menu-button { display: none; }

.content {
  margin-left: 282px;
  padding: 28px;
}
.content > h1 {
  position: relative;
  overflow: hidden;
  margin: 0 0 18px;
  padding: 24px 28px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(16,24,39,.94), rgba(16,24,39,.72)),
    radial-gradient(circle at 18% 20%, rgba(94,234,212,.22), transparent 30%),
    linear-gradient(135deg, rgba(15,118,110,.78), rgba(16,24,39,.92));
  color: #fff;
  box-shadow: var(--shadow);
}
.content > h1::after {
  content: "";
  position: absolute;
  inset: auto -8% -70% 45%;
  height: 150px;
  background: linear-gradient(135deg, rgba(217,249,157,.28), rgba(94,234,212,.13));
  transform: skewY(-8deg);
  border-radius: 8px;
}
.dashboard-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  align-items: end;
  min-height: 285px;
  margin-bottom: 18px;
  padding: 32px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(16,24,39,.94), rgba(16,24,39,.72)),
    radial-gradient(circle at 18% 20%, rgba(94,234,212,.26), transparent 30%),
    linear-gradient(135deg, rgba(15,118,110,.82), rgba(16,24,39,.92));
  color: #fff;
  box-shadow: var(--shadow);
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -42% 38%;
  height: 230px;
  background: linear-gradient(135deg, rgba(217,249,157,.28), rgba(94,234,212,.13));
  transform: skewY(-8deg);
  border-radius: 8px;
}
.dashboard-hero > * { position: relative; z-index: 1; }
.dashboard-hero h1 {
  margin: 16px 0 12px;
  color: #fff;
  font-size: 40px;
  line-height: 1.08;
}
.dashboard-hero p {
  margin: 0;
  color: rgba(255,255,255,.76);
  font-size: 16px;
  line-height: 1.65;
  max-width: 680px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.button.light,
.button.ghost.light {
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.12);
  color: #fff;
}
.button.light:hover,
.button.ghost.light:hover {
  background: rgba(255,255,255,.2);
}
.hero-balance {
  padding: 20px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
}
.hero-balance span,
.hero-balance small {
  display: block;
  color: rgba(255,255,255,.72);
  font-weight: 800;
}
.hero-balance strong {
  display: block;
  margin: 10px 0;
  font-size: 32px;
  color: #fff;
}
.dashboard-kpis article {
  position: relative;
  overflow: hidden;
}
.dashboard-kpis article::after {
  content: "";
  position: absolute;
  inset: auto -36px -48px auto;
  width: 118px;
  height: 118px;
  border-radius: 999px;
  background: rgba(15,118,110,.08);
}
.kpi-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 8px;
  color: var(--primary-2);
  background: #eef8f6;
}
.kpi-icon .icon {
  width: 22px;
  height: 22px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 18px;
  align-items: start;
}
.dashboard-grid.lower {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr);
}
.focus-panel {
  min-height: 330px;
}
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-title h2 {
  margin: 0;
}
.panel-title a {
  font-weight: 800;
  white-space: nowrap;
}
.statement-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.statement-list div {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.statement-list span,
.statement-list strong {
  display: block;
}
.statement-list span {
  color: var(--muted);
  font-weight: 800;
}
.statement-list strong {
  margin-top: 8px;
  font-size: 21px;
}
.activity-list {
  display: grid;
  gap: 10px;
}
.activity-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}
.activity-item:hover {
  border-color: rgba(15,118,110,.38);
  background: #fbfefd;
}
.activity-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--primary-2);
}
.activity-item strong,
.activity-item small {
  display: block;
}
.activity-item small {
  margin-top: 3px;
  color: var(--muted);
}
.activity-item b {
  color: var(--primary-2);
}
.empty-state {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
}
.flow span {
  display: flex;
  align-items: center;
  gap: 9px;
}
.mini-ledger {
  display: grid;
  gap: 10px;
}
.mini-ledger div {
  padding: 12px;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: var(--surface-2);
}
.mini-ledger span,
.mini-ledger strong,
.mini-ledger small {
  display: block;
}
.mini-ledger span,
.mini-ledger small {
  color: var(--muted);
}
.mini-ledger strong {
  margin: 4px 0;
}
.report-hero {
  min-height: 235px;
}
.filters.elevated {
  box-shadow: var(--shadow);
}
.report-shortcuts {
  display: grid;
  gap: 10px;
}
.report-shortcuts a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}
.report-shortcuts a:hover {
  border-color: rgba(15,118,110,.38);
  color: var(--primary-2);
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head p {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}
h1 { margin: 0 0 18px; font-size: 26px; line-height: 1.15; }
.page-head h1 { margin: 0; }
h2 { margin: 0 0 14px; font-size: 17px; line-height: 1.25; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 0 rgba(16, 24, 39, .03);
}
.split {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}
.wide { grid-column: 1 / -1; }
label {
  display: grid;
  gap: 6px;
  font-weight: 750;
  color: #344054;
  margin-bottom: 12px;
}
.field-hint {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.check input { width: auto; }
input, select, textarea {
  width: 100%;
  border: 1px solid #c8d4e1;
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(15, 118, 110, .18);
  border-color: var(--primary);
}
input[readonly] {
  background: #f8fbfd;
  color: var(--primary-2);
  font-weight: 850;
}
textarea { min-height: 96px; resize: vertical; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  padding: 11px 16px;
  min-height: 42px;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--primary-2); color: #fff; }
.button.ghost {
  background: var(--surface);
  color: var(--primary-2);
  border: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: var(--surface-2);
}
tfoot th { background: #eef8f6; color: var(--ink); }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #eef8f6;
  color: var(--primary-2);
  font-weight: 800;
  font-size: 12px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-grid.compact { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
.kpi-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpi-grid span, .kpi-grid small { color: var(--muted); display: block; }
.kpi-grid strong { display: block; margin: 8px 0; font-size: 24px; }
.statement-total {
  font-size: 24px;
  color: var(--primary-2);
}
.flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.flow span {
  border-left: 4px solid var(--primary);
  background: #eef8f6;
  padding: 12px;
  border-radius: 8px;
  font-weight: 800;
}
.alert {
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: #fff4ed;
  color: var(--warn);
  border: 1px solid #fed7aa;
}
.alert.danger {
  background: #fef3f2;
  color: var(--danger);
  border-color: #fecdca;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(120deg, rgba(16,24,39,.92), rgba(16,24,39,.7)),
    radial-gradient(circle at 18% 22%, rgba(94,234,212,.28), transparent 28%),
    linear-gradient(135deg, #f4f7fb, #eef8f6 52%, #f7f4ec);
  padding: 24px;
}
.login-layout {
  width: min(1120px, 100%);
  min-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr);
  gap: 18px;
}
.login-hero,
.login-card {
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.login-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.05)),
    linear-gradient(135deg, rgba(15,118,110,.56), rgba(16,24,39,.42));
  color: #fff;
}
.login-hero::after {
  content: "";
  position: absolute;
  inset: auto -18% -28% 22%;
  height: 330px;
  background: linear-gradient(135deg, rgba(217,249,157,.34), rgba(94,234,212,.16));
  transform: skewY(-8deg);
  border-radius: 8px;
}
.login-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  width: fit-content;
}
.login-brand strong,
.login-brand small {
  display: block;
}
.login-brand small {
  margin-top: 2px;
  color: rgba(255,255,255,.72);
}
.login-copy {
  position: relative;
  z-index: 1;
  max-width: 640px;
  padding: 64px 0;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  font-weight: 800;
  color: #effffb;
}
.login-copy h1 {
  margin: 18px 0 14px;
  color: #fff;
  font-size: 42px;
  line-height: 1.06;
  max-width: 720px;
}
.login-copy p {
  margin: 0;
  color: rgba(255,255,255,.78);
  font-size: 16px;
  line-height: 1.65;
  max-width: 620px;
}
.login-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.login-metrics article {
  min-height: 126px;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
}
.login-metrics .icon {
  width: 24px;
  height: 24px;
  color: #d9f99d;
}
.login-metrics strong,
.login-metrics span {
  display: block;
}
.login-metrics strong {
  margin: 14px 0 5px;
  color: #fff;
}
.login-metrics span {
  color: rgba(255,255,255,.72);
}
.login-card {
  align-self: center;
  width: 100%;
  background: rgba(255,255,255,.96);
  padding: 30px;
  box-shadow: var(--shadow);
}
.login-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--primary-2);
}
.login-icon .icon {
  width: 26px;
  height: 26px;
}
.login-card h2 {
  margin: 0 0 4px;
  font-size: 25px;
}
.login-card p {
  color: var(--muted);
  margin: 0;
}
.login-form {
  display: grid;
  gap: 14px;
}
.login-form label {
  margin-bottom: 0;
}
.input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid #c8d4e1;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}
.input-shell:focus-within {
  outline: 3px solid rgba(15, 118, 110, .18);
  border-color: var(--primary);
}
.input-shell .icon {
  color: var(--muted);
}
.input-shell input {
  border: 0;
  min-height: 46px;
  padding: 0;
}
.input-shell input:focus {
  outline: 0;
}
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0;
}
.login-options .check {
  color: var(--muted);
  font-weight: 700;
}
.login-submit {
  width: 100%;
  min-height: 48px;
}
.login-footnote {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
}
.login-footnote span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filters {
  display: flex;
  align-items: end;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
}
.filters label { min-width: 180px; margin-bottom: 0; }
.big { display: block; font-size: 28px; margin-bottom: 14px; }
.receipt {
  width: min(760px, calc(100vw - 32px));
  margin: 32px auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
}
.receipt h1, .receipt h2, .receipt p { text-align: center; }
.receipt dl { display: grid; grid-template-columns: 160px 1fr; gap: 10px; margin: 24px 0; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-weight: 800; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .three-col { grid-template-columns: 1fr; }
  .dashboard-grid,
  .dashboard-grid.lower {
    grid-template-columns: 1fr;
  }
  .compact-dashboard-page .analytics-grid,
  .compact-dashboard-page .analytics-grid.wide-left {
    grid-template-columns: 1fr;
  }
  .login-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .login-hero {
    min-height: 520px;
  }
}

@media (max-width: 940px) {
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
    z-index: 25;
  }
  body.sidebar-open::after { opacity: 1; pointer-events: auto; }
  .sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .menu-button { display: inline-grid; }
  .topbar, .content { margin-left: 0; }
  .topbar {
    min-height: 62px;
    padding: 10px 14px;
  }
  .user-chip small { display: none; }
  .logout-link span { display: none; }
  .content { padding: 16px; }
  .split, .form-grid, .flow, .kpi-grid, .kpi-grid.compact { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters label { min-width: 0; width: 100%; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .dashboard-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 24px;
  }
  .compact-dashboard-page .modern-dashboard-hero {
    grid-template-columns: 1fr;
  }
  .compact-dashboard-page .hero-analytics-card {
    min-width: 0;
  }
  .dashboard-hero h1 {
    font-size: 32px;
  }
  .hero-balance strong {
    font-size: 28px;
  }
  .statement-list,
  .login-metrics {
    grid-template-columns: 1fr;
  }
  .login-page {
    padding: 14px;
  }
  .login-hero {
    min-height: auto;
    padding: 24px;
  }
  .login-copy {
    padding: 46px 0;
  }
  .login-copy h1 {
    font-size: 32px;
  }
}

@media (max-width: 520px) {
  body { font-size: 13px; }
  h1 { font-size: 23px; }
  .topbar > div:first-of-type span { display: block; }
  .user-chip > span { display: none; }
  .panel { padding: 14px; }
  th, td { padding: 10px 8px; }
  .receipt { margin: 12px auto; padding: 18px; }
  .receipt dl { grid-template-columns: 1fr; }
  .dashboard-hero,
  .login-card,
  .login-hero {
    padding: 18px;
  }
  .dashboard-hero h1,
  .login-copy h1 {
    font-size: 27px;
  }
  .hero-actions,
  .login-options {
    align-items: stretch;
    flex-direction: column;
  }
  .hero-actions .button {
    width: 100%;
  }
  .activity-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .activity-item b {
    grid-column: 2;
  }
  .login-card-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar { display: none; }
  .content, .receipt { margin: 0; width: 100%; }
  .receipt { border: 0; }
  button, .receipt a, .button { display: none; }
}

/* Harmonized module surfaces */
.page-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(16,24,39,.94), rgba(16,24,39,.72)),
    radial-gradient(circle at 18% 20%, rgba(94,234,212,.22), transparent 30%),
    linear-gradient(135deg, rgba(15,118,110,.78), rgba(16,24,39,.92));
  color: #fff;
  box-shadow: var(--shadow);
}
.page-hero h1 { margin: 14px 0 8px; color: #fff; }
.page-hero p {
  max-width: 720px;
  margin: 0;
  color: rgba(255,255,255,.76);
  line-height: 1.6;
}
.compact-hero { min-height: 190px; }
.button.mini {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}
.payment-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 410px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.student-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.student-card strong,
.student-card small { display: block; }
.student-card small {
  margin-top: 4px;
  color: var(--muted);
}
.student-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--primary-2);
  font-weight: 900;
  font-size: 22px;
  overflow: hidden;
}
.student-avatar img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}
.student-passport-thumb {
  align-items: center;
  background: #eef8f6;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  color: var(--primary-2);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 950;
  height: 34px;
  justify-content: center;
  margin-right: 8px;
  overflow: hidden;
  vertical-align: middle;
  width: 34px;
}
.student-passport-thumb img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}
.student-passport-thumb.print-thumb {
  border-radius: 7px;
  height: 24px;
  margin-right: 5px;
  width: 24px;
}
.student-with-photo {
  align-items: center;
  display: inline-flex;
  gap: 2px;
  min-width: 0;
}
.danger-card {
  border-color: #fecdca;
  background: #fef3f2;
}
.danger-card .student-avatar {
  background: #fee4e2;
  color: var(--danger);
}
.payment-form button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: .58;
}
.payment-form.is-locked {
  opacity: .72;
}
.payment-form.is-locked::after {
  content: "Payment complete - fields locked";
  grid-column: 1 / -1;
  display: block;
  padding: 10px 12px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  font-weight: 900;
  text-align: center;
}
.payment-form.is-locked input,
.payment-form.is-locked select,
.payment-form.is-locked textarea,
.payment-form.is-locked button {
  cursor: not-allowed;
}
.records-filter {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}
.records-panel table td,
.records-panel table th { white-space: nowrap; }

.dashboard-content {
  display: grid;
  gap: 18px;
}
.compact-dashboard-page {
  gap: 12px;
}
.compact-dashboard-page .modern-dashboard-hero {
  padding: 18px;
  min-height: 0;
}
.compact-dashboard-page .modern-dashboard-hero h1 {
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.05;
  margin: 8px 0 6px;
}
.compact-dashboard-page .modern-dashboard-hero p {
  max-width: 760px;
  font-size: 13px;
  line-height: 1.5;
}
.compact-dashboard-page .hero-actions {
  gap: 8px;
  margin-top: 12px;
}
.compact-dashboard-page .hero-actions .button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}
.compact-dashboard-page .hero-analytics-card {
  min-width: 240px;
  padding: 14px;
}
.compact-dashboard-page .hero-analytics-card strong {
  font-size: clamp(22px, 2.8vw, 32px);
  line-height: 1.1;
}
.modern-dashboard-hero {
  margin-bottom: 0;
  background:
    linear-gradient(120deg, rgba(16,24,39,.95), rgba(16,24,39,.72)),
    radial-gradient(circle at 14% 18%, rgba(94,234,212,.22), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(217,249,157,.16), transparent 24%),
    linear-gradient(135deg, rgba(15,118,110,.86), rgba(16,24,39,.94));
}
.hero-analytics-card {
  display: grid;
  gap: 7px;
}
.hero-meter,
.channel-row i,
.class-bar-row i {
  display: block;
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
}
.hero-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5eead4, #d9f99d);
}
.analytics-kpis article {
  min-height: 168px;
  border: 1px solid rgba(15,118,110,.12);
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,253,.96)),
    radial-gradient(circle at 90% 20%, rgba(94,234,212,.12), transparent 26%);
}
.compact-dashboard-page .analytics-kpis {
  gap: 10px;
}
.compact-dashboard-page .analytics-kpis article {
  min-height: 116px;
  padding: 14px;
}
.compact-dashboard-page .analytics-kpis .kpi-icon {
  width: 34px;
  height: 34px;
}
.compact-dashboard-page .analytics-kpis strong {
  font-size: 20px;
  margin: 5px 0;
}
.compact-dashboard-page .analytics-kpis span,
.compact-dashboard-page .analytics-kpis small {
  font-size: 11px;
}
.dashboard-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
}
.dashboard-feature-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(15,118,110,.13);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,253,.96)),
    radial-gradient(circle at 94% 0%, rgba(217,249,157,.26), transparent 30%);
  box-shadow: 0 14px 32px rgba(16,24,39,.07);
}
.dashboard-feature-card header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.dashboard-feature-card header strong,
.dashboard-feature-card header small {
  display: block;
  min-width: 0;
}
.dashboard-feature-card header strong {
  font-size: 13px;
}
.dashboard-feature-card header small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.dashboard-feature-card header b {
  color: var(--primary-2);
  font-size: 13px;
  justify-self: end;
  max-width: 120px;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feature-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(15,118,110,.1);
  color: var(--primary-2);
}
.feature-icon .icon {
  width: 20px;
  height: 20px;
}
.dashboard-feature-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.dashboard-feature-links a {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  min-height: 34px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.dashboard-feature-links a:hover {
  border-color: rgba(15,118,110,.28);
  background: #fff;
  transform: translateY(-1px);
}
.dashboard-feature-links .icon {
  width: 15px;
  height: 15px;
  color: var(--primary-2);
}
.dashboard-feature-links span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 18px;
  align-items: stretch;
}
.compact-dashboard-page .analytics-grid,
.compact-dashboard-page .dashboard-grid.lower {
  gap: 12px;
}
.analytics-grid.wide-left {
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr);
}
.chart-panel {
  min-height: 330px;
}
.compact-dashboard-page .panel {
  padding: 14px;
}
.compact-dashboard-page .panel-title {
  gap: 8px;
  margin-bottom: 10px;
}
.compact-dashboard-page .panel-title h2 {
  font-size: 16px;
}
.compact-dashboard-page .panel-title a {
  font-size: 12px;
}
.compact-dashboard-page .chart-panel {
  min-height: 250px;
}
.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 250px;
  padding: 14px 2px 0;
}
.compact-dashboard-page .bar-chart {
  gap: 8px;
  min-height: 185px;
  padding-top: 6px;
}
.compact-dashboard-page .bar-column {
  grid-template-rows: 22px minmax(92px, 1fr) 20px;
  gap: 6px;
}
.compact-dashboard-page .bar-value,
.compact-dashboard-page .bar-column strong {
  font-size: 10px;
}
.bar-column {
  display: grid;
  grid-template-rows: 28px minmax(130px, 1fr) 24px;
  align-items: end;
  gap: 8px;
  min-width: 0;
  text-align: center;
}
.bar-column i {
  display: block;
  width: 100%;
  min-height: 7px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #0f766e, #5eead4);
  box-shadow: 0 12px 24px rgba(15,118,110,.16);
}
.bar-column strong,
.bar-value {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-chart,
.class-bars {
  display: grid;
  gap: 14px;
}
.compact-dashboard-page .channel-chart,
.compact-dashboard-page .class-bars {
  gap: 8px;
}
.channel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.compact-dashboard-page .channel-row,
.compact-dashboard-page .class-bar-row {
  padding: 9px 10px;
  font-size: 12px;
}
.compact-dashboard-page .channel-row i,
.compact-dashboard-page .class-bar-row i,
.compact-dashboard-page .hero-meter {
  height: 7px;
}
.channel-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 850;
}
.channel-row strong {
  color: var(--primary-2);
}
.channel-row i {
  grid-column: 1 / -1;
  background: #e8eef5;
}
.channel-row i b,
.class-bar-row i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #5eead4);
}
.due-alert-panel {
  border-color: rgba(180,35,24,.18);
}
.compact-dashboard-page .due-alert-panel table {
  font-size: 12px;
}
.compact-dashboard-page .due-alert-panel th,
.compact-dashboard-page .due-alert-panel td {
  padding: 9px 10px;
}
.danger-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff0ee;
  color: var(--danger);
  font-weight: 900;
}
.donut-wrap {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}
.compact-dashboard-page .donut-wrap {
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
}
.compact-dashboard-page .donut {
  width: 150px;
  height: 150px;
}
.compact-dashboard-page .statement-list {
  gap: 8px;
}
.compact-dashboard-page .statement-list div,
.compact-dashboard-page .mini-ledger div,
.compact-dashboard-page .activity-item {
  padding: 9px 10px;
}

.inventory-page {
  display: grid;
  gap: 12px;
}
.inventory-page .profile-hero {
  margin-bottom: 0;
}
.inventory-summary-grid {
  margin-bottom: 0;
}
.inventory-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 12px;
  align-items: start;
}
.inventory-form-stack {
  display: grid;
  gap: 12px;
}
.inventory-form-card {
  margin-bottom: 0;
}
.inventory-table {
  min-width: 980px;
}
.inventory-movements-table {
  min-width: 840px;
}
.inventory-category-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.inventory-category-list article {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px;
  background: var(--surface-2);
}
.inventory-category-list strong,
.inventory-category-list small,
.inventory-movements-table small {
  display: block;
}
.inventory-category-list small,
.inventory-movements-table small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.users-page {
  display: grid;
  gap: 12px;
}
.users-page .profile-hero {
  margin-bottom: 0;
}
.users-summary-grid {
  margin-bottom: 0;
}
.users-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.users-form-card,
.users-records-panel {
  margin-bottom: 0;
}
.users-table {
  min-width: 920px;
}

.results-page,
.results-print-page {
  display: grid;
  gap: 12px;
}
.result-quick-links,
.results-summary-grid {
  margin-bottom: 0;
}
.results-workspace {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 12px;
}
.results-table {
  min-width: 860px;
}
.results-broadsheet-table {
  min-width: 1100px;
}
.result-sheets {
  display: grid;
  gap: 14px;
}
.result-sheet {
  position: relative;
  page-break-after: always;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  overflow: hidden;
}
.result-watermark {
  position: absolute;
  inset: 22% 22%;
  background-image: var(--result-watermark);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: .045;
  pointer-events: none;
  z-index: 0;
}
.result-sheet > *:not(.result-watermark),
.broadsheet-document > *:not(.result-watermark) {
  position: relative;
  z-index: 1;
}
.result-letterhead,
.broadsheet-letterhead {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 3px double var(--ink);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.result-logo-wrap {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
  color: var(--primary-2);
  font-weight: 950;
}
.result-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.result-letterhead strong,
.broadsheet-letterhead strong,
.result-letterhead span,
.broadsheet-letterhead span,
.result-letterhead small,
.broadsheet-letterhead small {
  display: block;
}
.result-letterhead strong,
.broadsheet-letterhead strong {
  font-size: 20px;
  text-transform: uppercase;
  color: var(--ink);
}
.result-letterhead b {
  justify-self: end;
  border: 1px solid rgba(15, 118, 110, .2);
  border-radius: 999px;
  padding: 8px 12px;
  background: #eef8f6;
  color: var(--primary-2);
  font-size: 12px;
}
.broadsheet-letterhead b {
  display: block;
  margin-top: 4px;
  color: var(--primary-2);
}
.result-letterhead span,
.broadsheet-letterhead span,
.result-letterhead small,
.broadsheet-letterhead small {
  color: var(--muted);
  font-size: 12px;
}
.result-student-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.result-student-card div,
.result-box,
.result-signatures div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255,255,255,.86);
}
.result-student-card .result-passport-box {
  align-items: center;
  display: flex;
  grid-row: span 2;
  justify-content: center;
  min-height: 78px;
  padding: 4px;
}
.result-passport-box img {
  border-radius: 6px;
  display: block;
  height: 76px;
  object-fit: cover;
  width: 64px;
}
.result-passport-box span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.result-student-card span,
.result-signatures span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.result-student-card strong,
.result-signatures strong {
  display: block;
  margin-top: 2px;
}
.result-score-table th,
.result-score-table td {
  padding: 7px 8px;
}
.result-lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.result-box h3 {
  margin: 0 0 7px;
  font-size: 13px;
}
.result-signatures,
.result-remarks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}
.result-remarks div {
  min-height: 54px;
}
.result-remarks strong:empty::after {
  content: "";
  display: block;
  height: 18px;
  border-bottom: 1px solid #98a2b3;
  margin-top: 10px;
}
.result-grade-key {
  border-top: 1px dashed var(--line);
  padding-top: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.result-student,
.result-psycho,
.result-sheet footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.result-psycho {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  font-size: 12px;
}
.result-student div,
.result-sheet footer div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.result-student span,
.result-sheet footer span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.result-sheet table {
  font-size: 12px;
}
.broadsheet-document {
  position: relative;
  overflow: hidden;
}
.broadsheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.broadsheet-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-assistant {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
}
.ai-assistant-toggle {
  align-items: center;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
  display: inline-flex;
  gap: 8px;
  min-height: 46px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--primary), #111827);
  color: #fff;
  font-weight: 900;
}
.ai-assistant-toggle .icon {
  width: 19px;
  height: 19px;
}
.ai-assistant-panel {
  position: absolute;
  right: 0;
  bottom: 58px;
  width: min(380px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 100px));
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.24);
}
.ai-assistant-panel[hidden] {
  display: none;
}
.ai-assistant-panel header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(135deg, #0f766e, #111827);
  color: #fff;
}
.ai-assistant-panel header strong {
  display: block;
  font-size: 18px;
  margin-top: 4px;
}
.ai-assistant-panel .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}
.ai-assistant-panel .icon-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}
.ai-assistant-messages {
  display: grid;
  gap: 10px;
  max-height: 310px;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc;
}
.ai-message {
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
}
.ai-message strong {
  display: block;
  font-size: 11px;
  margin-bottom: 4px;
  text-transform: uppercase;
  color: var(--muted);
}
.ai-message p {
  margin: 0;
}
.ai-message.assistant {
  margin-right: 20px;
  border: 1px solid var(--line);
  background: #fff;
}
.ai-message.user {
  margin-left: 42px;
  background: #0f766e;
  color: #fff;
}
.ai-message.user strong {
  color: rgba(255, 255, 255, 0.72);
}
.ai-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.ai-message-actions a,
.ai-assistant-prompts button {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: #ecfdf5;
  color: #0f766e;
  font-size: 11px;
  font-weight: 850;
  padding: 6px 9px;
  text-decoration: none;
}
.ai-assistant-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 0;
  background: #fff;
}
.ai-assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px auto;
  gap: 8px;
  padding: 12px 14px 14px;
  background: #fff;
}
.ai-assistant-form textarea {
  min-height: 42px;
  max-height: 110px;
  resize: vertical;
  font-size: 12px;
}
.ai-assistant-form button {
  align-self: end;
  min-height: 42px;
  padding: 8px 12px;
}
.ai-voice-button {
  border-radius: 12px;
  justify-content: center;
  padding: 0;
}
.ai-voice-button.listening {
  background: #b42318;
  box-shadow: 0 0 0 5px rgba(180, 35, 24, 0.12);
}
.ai-reminder-panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 12px 14px 14px;
  background: #fff;
}
.ai-reminder-panel[hidden] {
  display: none;
}
.ai-reminder-panel .panel-title {
  margin: 0;
}
.ai-reminder-panel .panel-title h2 {
  font-size: 14px;
}
.ai-reminder-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(145px, .8fr) auto;
  gap: 8px;
}
.ai-reminder-form input,
.ai-reminder-form button {
  min-height: 38px;
  font-size: 12px;
}
.ai-reminder-list {
  display: grid;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
}
.ai-reminder-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 10px;
  background: #f8fafc;
}
.ai-reminder-item.due {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fff0ee;
}
.ai-reminder-item strong,
.ai-reminder-item small {
  display: block;
}
.ai-reminder-item small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.ai-reminder-item button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 11px;
}
.donut {
  --value: 0;
  display: grid;
  place-items: center;
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 57%, transparent 58%),
    conic-gradient(#0f766e calc(var(--value) * 1%), #dfe8f2 0);
  box-shadow: inset 0 0 0 1px var(--line), 0 18px 40px rgba(16,24,39,.08);
}
.donut span {
  color: var(--ink);
  font-size: 30px;
  font-weight: 950;
}
.compact-stats {
  grid-template-columns: 1fr;
}
.compact-stats strong {
  font-size: 18px;
}
.class-bar-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.class-bar-row span {
  font-weight: 900;
}
.class-bar-row i {
  background: #e8eef5;
}
.class-bar-row strong {
  color: var(--danger);
  font-size: 13px;
  white-space: nowrap;
}
.payroll-page .compact {
  margin-bottom: 18px;
}
.payroll-actions {
  margin-bottom: 18px;
}
.compact-payroll-page .profile-hero {
  margin-bottom: 12px;
  padding: 18px;
}
.compact-payroll-page .profile-hero h1 {
  font-size: clamp(24px, 3vw, 34px);
}
.compact-payroll-page .profile-hero p {
  margin-bottom: 0;
  font-size: 13px;
}
.compact-payroll-page .hero-balance {
  padding: 13px 15px;
}
.compact-payroll-page .hero-balance strong {
  margin: 5px 0;
  font-size: clamp(20px, 2.4vw, 27px);
}
.compact-payroll-page .payroll-quick-links {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.compact-payroll-page .payroll-quick-links a {
  min-height: 58px;
  padding: 10px;
}
.compact-payroll-page .payroll-quick-links a > .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
}
.compact-payroll-page .payroll-quick-links small {
  font-size: 11px;
}
.compact-payroll-page .payroll-summary-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}
.payroll-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.compact-payroll-page .panel {
  padding: 14px;
}
.compact-payroll-page .panel-title {
  gap: 8px;
  margin-bottom: 10px;
}
.compact-payroll-page .panel-title h2 {
  font-size: 17px;
}
.compact-payroll-page .payroll-form-card {
  gap: 10px;
}
.compact-payroll-page .payroll-form-card label {
  margin-bottom: 0;
  font-size: 12px;
}
.compact-payroll-page .payroll-form-card input,
.compact-payroll-page .payroll-form-card select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}
.compact-payroll-page .payroll-form-card button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}
.compact-payroll-page .payroll-run-card {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
}
.compact-payroll-page .payroll-run-card .panel-title,
.compact-payroll-page .payroll-run-card .wide {
  grid-column: 1 / -1;
}
.compact-payroll-page .payroll-run-card .payroll-run-preview {
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}
.compact-payroll-page .payroll-run-card .payroll-run-preview > div {
  min-width: 0;
  padding: 12px;
}
.compact-payroll-page .payroll-run-card .payroll-run-preview small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}
.compact-payroll-page .payroll-run-card button.wide {
  justify-content: center;
  width: 100%;
}
.compact-payroll-page .payroll-detail-grid,
.compact-payroll-page .payroll-run-preview {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}
.compact-payroll-page .payroll-run-card .payroll-run-preview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.compact-payroll-page .payroll-employees-table {
  min-width: 980px;
}
.compact-payroll-page .payroll-runs-table,
.compact-payroll-page .payroll-items-table {
  min-width: 920px;
}
.compact-payroll-page .payroll-payslips-table {
  min-width: 860px;
}
.compact-payroll-page .payroll-reports-table {
  min-width: 860px;
}
.compact-payroll-page .payroll-statutory-table {
  min-width: 820px;
}
.compact-payroll-page .payroll-statutory-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -2px 0 12px;
}
.compact-payroll-page .payroll-statutory-breakdown article {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  padding: 12px 14px;
}
.compact-payroll-page .payroll-statutory-breakdown span {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.compact-payroll-page .payroll-statutory-breakdown strong {
  color: var(--ink);
  display: block;
  font-size: 1.25rem;
  line-height: 1.2;
  margin-top: 4px;
}
.compact-payroll-page .payroll-net-summary {
  margin-top: -2px;
}
.compact-payroll-page .records-filter {
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
}
.compact-payroll-page .records-filter label {
  min-width: 150px;
  font-size: 12px;
}
.compact-payroll-page .records-filter select,
.compact-payroll-page .records-filter input {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}
.compact-payroll-page .records-filter button,
.compact-payroll-page .records-filter .button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}
.payroll-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  width: 100%;
}
.inline-form label {
  min-width: 190px;
  margin: 0;
}
.payslip-sheet {
  width: min(900px, calc(100vw - 32px));
  margin: 28px auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.payslip-header {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.payslip-header img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.payslip-header strong,
.payslip-header span {
  display: block;
}
.payslip-header strong {
  font-size: 20px;
}
.payslip-header span {
  color: var(--muted);
  margin-top: 3px;
}
.payslip-header h1 {
  margin: 0;
  color: var(--primary-2);
  font-size: 28px;
}
.payslip-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.payslip-meta div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.payslip-meta span,
.payslip-meta strong {
  display: block;
}
.payslip-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.payslip-meta strong {
  margin-top: 5px;
}
.payslip-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.payslip-net {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--primary-2);
}
.payslip-net span {
  font-weight: 900;
}
.payslip-net strong {
  font-size: 30px;
}
.payslip-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 26px;
  color: var(--muted);
}
.record-actions,
.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}
.bulk-actions {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.bulk-actions label {
  min-width: 180px;
  margin: 0;
}
.student-sis-page .settings-tiles,
.student-profile-page .settings-tiles {
  margin-bottom: 18px;
}
.compact-filters {
  margin: 0;
  align-items: end;
}
.student-quick-links {
  grid-template-columns: repeat(5, minmax(180px, 1fr));
}
.student-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  gap: 18px;
  align-items: start;
}
.student-tools-column {
  display: grid;
  gap: 18px;
}
.student-tool-card {
  margin-bottom: 0;
}
.student-form-card {
  position: sticky;
  top: 86px;
}
.student-filter-form,
.student-family-form {
  display: grid;
  gap: 12px;
}
.student-filter-form label,
.student-family-form label {
  margin-bottom: 0;
}
.form-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 -2px;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}
.form-section-heading::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}
.student-sis-page .kpi-grid.compact {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
.student-sis-page .records-panel {
  overflow: hidden;
}
.student-sis-page .records-panel > table {
  min-width: 980px;
}
.compact-profile-page .profile-hero {
  margin-bottom: 12px;
  padding: 18px;
}
.compact-profile-page .profile-hero h1 {
  font-size: clamp(24px, 3vw, 34px);
}
.compact-profile-page .profile-hero p {
  margin-bottom: 0;
  font-size: 13px;
}
.compact-profile-page .hero-balance {
  padding: 13px 15px;
}
.compact-profile-page .hero-balance strong {
  margin: 5px 0;
  font-size: clamp(20px, 2.4vw, 27px);
}
.profile-quick-links {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 12px !important;
}
.profile-quick-links a {
  min-height: 58px;
  padding: 10px;
}
.profile-quick-links a > .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
}
.profile-quick-links small {
  font-size: 11px;
}
.profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.profile-summary-grid article {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.profile-summary-grid span,
.profile-summary-grid strong {
  display: block;
}
.profile-summary-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.profile-summary-grid strong {
  margin-top: 5px;
  font-size: clamp(17px, 2vw, 23px);
  line-height: 1.05;
}
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, .55fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.profile-side-stack {
  display: grid;
  gap: 14px;
}
.compact-profile-page .panel {
  padding: 14px;
}
.compact-profile-page .panel-title {
  gap: 8px;
  margin-bottom: 10px;
}
.compact-profile-page .panel-title h2 {
  font-size: 17px;
}
.profile-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 8px;
}
.profile-detail-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.profile-detail-grid div.wide {
  grid-column: 1 / -1;
}
.profile-detail-grid span,
.profile-detail-grid strong {
  display: block;
}
.profile-detail-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.profile-detail-grid strong {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.25;
}
.mini-profile-card {
  text-align: center;
}
.student-avatar.large {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  font-size: 24px;
}
.mini-profile-card strong,
.mini-profile-card span,
.mini-profile-card small {
  display: block;
}
.mini-profile-card span,
.mini-profile-card small {
  color: var(--muted);
  margin-top: 3px;
}
.profile-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.profile-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,118,110,.45) rgba(15,118,110,.08);
}
.profile-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}
.payment-profile-table {
  min-width: 820px;
}
.statement-students-table {
  min-width: 980px;
}
.outstanding-table {
  min-width: 980px;
}
.outstanding-page .outstanding-quick-links {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.outstanding-page .outstanding-quick-links a {
  min-height: 58px;
  padding: 10px;
}
.outstanding-page .outstanding-quick-links a > .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
}
.outstanding-page .outstanding-quick-links small {
  font-size: 11px;
}
.outstanding-page .outstanding-summary-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}
.outstanding-page .records-filter {
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
}
.outstanding-page .records-filter label {
  min-width: 150px;
  font-size: 12px;
}
.outstanding-page .records-filter input,
.outstanding-page .records-filter select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}
.outstanding-page .records-filter button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}
.student-statement-page .records-filter {
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
}
.student-statement-page .records-filter label {
  min-width: 155px;
  font-size: 12px;
}
.student-statement-page .records-filter input,
.student-statement-page .records-filter select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}
.student-statement-page .records-filter button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}
.student-statement-page .detail-panel {
  margin-bottom: 14px;
}
.student-statement-page .statement-detail-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}
.profile-table th,
.profile-table td {
  padding: 8px 9px;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  vertical-align: top;
}
.profile-table th {
  white-space: nowrap;
}
.fee-quick-links,
.payment-quick-links {
  margin-bottom: 18px;
}
.compact-fees-page .profile-hero {
  margin-bottom: 12px;
  padding: 18px;
}
.compact-fees-page .profile-hero h1 {
  font-size: clamp(24px, 3vw, 34px);
}
.compact-fees-page .profile-hero p {
  margin-bottom: 0;
  font-size: 13px;
}
.compact-fees-page .hero-balance {
  padding: 13px 15px;
}
.compact-fees-page .hero-balance strong {
  margin: 5px 0;
  font-size: clamp(20px, 2.4vw, 27px);
}
.compact-fees-page .fee-quick-links {
  grid-template-columns: repeat(5, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.compact-fees-page .fee-quick-links a {
  min-height: 58px;
  padding: 10px;
}
.compact-fees-page .fee-quick-links a > .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
}
.compact-fees-page .fee-quick-links small {
  font-size: 11px;
}
.compact-fees-page .fee-summary-grid {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}
.assign-fees-page .fee-summary-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}
.compact-fees-page .fee-workspace {
  grid-template-columns: minmax(0, 1.1fr) minmax(245px, .42fr);
  gap: 14px;
  margin-bottom: 14px;
}
.compact-fees-page .panel {
  padding: 14px;
}
.compact-fees-page .panel-title {
  gap: 8px;
  margin-bottom: 10px;
}
.compact-fees-page .panel-title h2 {
  font-size: 17px;
}
.compact-fees-page .fee-form-card,
.compact-fees-page .fee-help-card {
  margin-bottom: 0;
}
.compact-fees-page .fee-form-card {
  gap: 10px;
}
.compact-fees-page .fee-form-card label {
  margin-bottom: 0;
  font-size: 12px;
}
.compact-fees-page .fee-form-card input,
.compact-fees-page .fee-form-card select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}
.compact-fees-page .fee-form-card button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}
.compact-fees-page .fee-detail-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}
.compact-fees-page .fee-register-panel {
  overflow: visible;
}
.compact-fees-page .fee-items-table {
  min-width: 780px;
}
.compact-fees-page .assignment-fees-table {
  min-width: 1060px;
}
.compact-fees-page .fee-items-table td:first-child strong {
  min-width: 0;
}
.fee-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .48fr);
  gap: 18px;
  align-items: start;
}
.fee-form-card,
.fee-help-card {
  margin-bottom: 18px;
}
.fee-register-panel {
  overflow: hidden;
}
.fee-register-panel table {
  min-width: 820px;
}
.fee-register-panel td:first-child strong {
  display: block;
  min-width: 170px;
}
.payment-history-layout {
  display: grid;
  grid-template-columns: minmax(260px, .68fr) minmax(0, 1.32fr);
  gap: 14px;
  align-items: start;
}
.payment-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.payment-kpi-grid article {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.payment-kpi-grid span,
.payment-kpi-grid small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.payment-kpi-grid strong {
  display: block;
  margin: 6px 0 2px;
  color: var(--ink);
  font-size: clamp(17px, 2vw, 23px);
  line-height: 1.05;
}
.payment-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fffd, #f7f8fb);
}
.payment-summary-strip div {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.78);
}
.payment-summary-strip span,
.payment-summary-strip small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.payment-summary-strip strong {
  display: block;
  margin: 4px 0 2px;
  overflow-wrap: anywhere;
  color: var(--primary-2);
  font-size: 15px;
}
.panel-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.table-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f8fbfd);
}
.table-nav-bar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.table-nav-bar nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.table-nav-bar nav strong {
  padding: 6px 8px;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--primary-2);
  font-size: 11px;
}
.button.disabled,
.button.disabled:hover {
  opacity: .48;
  pointer-events: none;
  cursor: not-allowed;
}
.managed-table {
  width: 100%;
  border-collapse: collapse;
}
.payments-page .records-panel {
  overflow: visible;
}
.payments-page .table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,118,110,.45) rgba(15,118,110,.08);
}
.payments-page .table-scroll:focus {
  outline: 2px solid rgba(15,118,110,.22);
  outline-offset: 2px;
}
.payments-page .records-panel table {
  min-width: 720px;
}
.payments-page .transaction-payments-table {
  min-width: 960px;
}
.payments-page .student-payments-table {
  min-width: 720px;
}
.payments-page .page-hero.compact-hero {
  margin-bottom: 12px;
  padding: 18px;
}
.payments-page .page-hero h1 {
  font-size: clamp(24px, 3vw, 34px);
}
.payments-page .page-hero p {
  max-width: 760px;
  margin-bottom: 0;
  font-size: 13px;
}
.payments-page .hero-balance {
  padding: 13px 15px;
}
.payments-page .hero-balance strong {
  margin: 5px 0;
  font-size: clamp(20px, 2.4vw, 27px);
}
.payments-page .payment-quick-links {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.payments-page .payment-quick-links a {
  min-height: 58px;
  padding: 10px;
}
.payments-page .payment-quick-links a > .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
}
.payments-page .payment-quick-links small {
  font-size: 11px;
}
.payments-page .records-filter {
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
}
.payments-page .records-filter label {
  min-width: 145px;
  font-size: 12px;
}
.payments-page .records-filter input,
.payments-page .records-filter select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 12px;
}
.payments-page .records-filter button,
.payments-page .records-filter .button,
.payments-page .table-nav-bar .button,
.payments-page .managed-table .button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}
.payments-page .panel {
  padding: 14px;
}
.payments-page .panel-title {
  gap: 8px;
  margin-bottom: 10px;
}
.payments-page .panel-title h2 {
  font-size: 17px;
}
.payments-page .managed-table th,
.payments-page .managed-table td {
  padding: 8px 9px;
  font-size: 12px;
  line-height: 1.35;
  vertical-align: top;
  white-space: normal;
}
.payments-page .managed-table th {
  white-space: nowrap;
}
.payments-page .transaction-payments-table td:nth-child(4),
.payments-page .transaction-payments-table td:nth-child(3) {
  min-width: 150px;
}
.payments-page .managed-table .pill {
  padding: 5px 7px;
  font-size: 11px;
}
.payments-page .selected-row {
  background: #f0fdfa;
  box-shadow: inset 3px 0 0 var(--primary);
}
.payments-page .selected-row td:first-child strong {
  color: var(--primary-2);
}
.action-icon-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  overflow: hidden;
}
.action-svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  transition: transform .2s ease, filter .2s ease;
}
.action-icon-button:hover .action-svg,
.action-icon-button:focus-visible .action-svg {
  transform: translateY(-1px) scale(1.12) rotate(-4deg);
  filter: drop-shadow(0 5px 8px rgba(15,118,110,.18));
}
.action-delete:hover .action-svg,
.action-suspend:hover .action-svg {
  color: var(--danger);
}
.action-pay:hover .action-svg,
.action-print:hover .action-svg {
  color: var(--primary-2);
}
.panel,
.page-hero,
.dashboard-hero,
.content > h1,
.filters,
.settings-tiles a,
.table-shell {
  max-width: 100%;
}
input,
select,
textarea,
button,
.button {
  max-width: 100%;
}
.content {
  min-width: 0;
}
.records-panel,
.panel {
  min-width: 0;
}
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.table-actions { min-width: 96px; }
.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.action-stack form {
  margin: 0;
}
.danger-button {
  color: var(--danger) !important;
  border-color: #fecdca !important;
}
.danger-button:hover {
  background: #fef3f2 !important;
}
.detail-panel {
  border-color: rgba(15,118,110,.25);
  box-shadow: var(--shadow);
}

.receipt-page {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  gap: 16px;
  padding: 24px;
  background: var(--bg);
}
.receipt-actions {
  width: min(420px, 100%);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.pos-receipt {
  width: 80mm;
  max-width: calc(100vw - 28px);
  padding: 12px;
  background: #fff;
  color: #111827;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-family: "Segoe UI", Arial, sans-serif;
}
.pos-receipt header {
  text-align: center;
  border-bottom: 1px dashed #98a2b3;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.pos-receipt header strong,
.pos-receipt header span { display: block; }
.pos-receipt header strong { font-size: 15px; }
.receipt-logo {
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto 7px;
  object-fit: contain;
}
.settings-logo-preview {
  position: relative;
  z-index: 1;
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 8px;
  padding: 8px;
  background: rgba(255,255,255,.92);
}
.settings-page .page-hero {
  align-items: center;
}
.settings-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.settings-tiles a {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(16,24,39,.03);
  color: var(--ink);
}
.settings-tiles a > .icon {
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--primary-2);
}
.settings-tiles strong,
.settings-tiles small {
  display: block;
}
.settings-tiles small {
  margin-top: 3px;
  color: var(--muted);
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.settings-card {
  min-width: 0;
}
.settings-card.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.settings-card input,
.settings-card select,
.settings-card textarea {
  min-width: 0;
}
.pos-receipt header span,
.pos-receipt small {
  color: #475467;
  font-size: 11px;
}
.pos-receipt h1 {
  margin: 10px 0 0;
  font-size: 15px;
  text-transform: uppercase;
}
.receipt-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed #d0d5dd;
}
.receipt-meta span,
.receipt-meta strong,
.receipt-student span,
.receipt-student strong { display: block; }
.receipt-meta span,
.receipt-student span {
  color: #667085;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
}
.receipt-meta strong { font-size: 12px; }
.receipt-student {
  padding: 10px 0;
  border-bottom: 1px dashed #d0d5dd;
}
.receipt-student strong {
  margin-top: 4px;
  font-size: 14px;
}
.receipt-lines {
  display: table;
  white-space: normal;
  margin: 8px 0;
}
.receipt-lines th,
.receipt-lines td {
  padding: 6px 0;
  border-bottom: 1px dashed #eaecf0;
  font-size: 12px;
}
.receipt-lines th:last-child,
.receipt-lines td:last-child { text-align: right; }
.receipt-lines tfoot th {
  color: #111827;
  background: #fff;
  font-size: 13px;
}
.pos-receipt footer {
  text-align: center;
  border-top: 1px dashed #98a2b3;
  padding-top: 10px;
  margin-top: 10px;
}
.pos-receipt footer span,
.pos-receipt footer small { display: block; }
.pos-receipt {
  display: grid;
  gap: 8px;
  padding: 8px;
}
.pos-receipt-copy {
  position: relative;
  overflow: hidden;
  padding: 8px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fff;
}
.pos-receipt-copy::before {
  content: "";
  position: absolute;
  inset: 28% 18%;
  background-image: var(--receipt-watermark);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: .055;
  pointer-events: none;
}
.pos-receipt-copy > * {
  position: relative;
  z-index: 1;
}
.receipt-copy-badge {
  display: block;
  margin: -2px 0 5px;
  text-align: center;
  color: #0b5f59;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0;
}
.pos-receipt-copy header {
  padding-bottom: 6px;
  margin-bottom: 6px;
}
.pos-receipt-copy header strong {
  font-size: 13px;
  line-height: 1.15;
}
.pos-receipt-copy header span,
.pos-receipt-copy small {
  font-size: 9px;
  line-height: 1.25;
}
.pos-receipt-copy h1 {
  margin: 5px 0 0;
  font-size: 12px;
}
.pos-receipt-copy .receipt-logo {
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
}
.receipt-meta.compact {
  gap: 5px;
  padding: 5px 0;
}
.receipt-meta.compact span,
.receipt-student span,
.receipt-note span {
  font-size: 8px;
}
.receipt-meta.compact strong {
  font-size: 10px;
  line-height: 1.2;
}
.pos-receipt-copy .receipt-student {
  padding: 6px 0;
}
.pos-receipt-copy .receipt-student strong {
  margin-top: 2px;
  font-size: 12px;
}
.pos-receipt-copy .receipt-lines {
  width: 100%;
  margin: 5px 0;
}
.pos-receipt-copy .receipt-lines th,
.pos-receipt-copy .receipt-lines td {
  padding: 4px 0;
  font-size: 10px;
  line-height: 1.25;
}
.pos-receipt-copy .receipt-lines td:first-child {
  max-width: 48mm;
}
.pos-receipt-copy .receipt-lines small {
  display: block;
  color: #667085;
}
.pos-receipt-copy .receipt-lines tfoot th {
  font-size: 11px;
}
.receipt-note {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px dashed #d0d5dd;
}
.receipt-note strong {
  font-size: 10px;
}
.pos-receipt-copy footer {
  padding-top: 6px;
  margin-top: 6px;
}
.receipt-cut-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  color: #667085;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.receipt-cut-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed #98a2b3;
}
.receipt-cut-line span {
  position: relative;
  padding: 0 8px;
  background: #fff;
}

@media (max-width: 1180px) {
  .records-filter { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .settings-tiles { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 940px) {
  .page-hero,
  .payment-workspace { grid-template-columns: 1fr; }
  .page-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px;
  }
  .records-filter { grid-template-columns: 1fr; }
  .settings-page .page-hero {
    align-items: flex-start;
  }
  .settings-logo-preview {
    width: 78px;
    height: 78px;
  }
}

@media (max-width: 520px) {
  .lookup-row { grid-template-columns: 1fr; }
  .receipt-actions { flex-direction: column; }
  .settings-tiles,
  .settings-card.form-grid {
    grid-template-columns: 1fr;
  }
  .settings-tiles a {
    min-height: 64px;
  }
}

@media print {
  @page { size: 80mm auto; margin: 0; }
  body { background: #fff; }
  .receipt-actions,
  .sidebar,
  .topbar { display: none !important; }
  .receipt-page {
    display: block;
    min-height: 0;
    padding: 0;
    background: #fff;
  }
  .pos-receipt {
    width: 80mm;
    max-width: 80mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 4mm;
  }
}

.swal-lite-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .52);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 100;
}
.swal-lite-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.swal-lite {
  width: min(420px, 100%);
  padding: 28px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
  transform: translateY(12px) scale(.96);
  transition: transform .2s cubic-bezier(.2,.9,.25,1.25);
}
.swal-lite-backdrop.show .swal-lite {
  transform: translateY(0) scale(1);
}
.swal-lite-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 999px;
  border: 3px solid #5eead4;
  color: var(--primary-2);
  animation: swalPop .42s ease both;
}
.swal-lite-icon span {
  width: 28px;
  height: 14px;
  border-left: 4px solid currentColor;
  border-bottom: 4px solid currentColor;
  transform: rotate(-45deg) translate(2px, -2px);
}
.swal-lite.error .swal-lite-icon,
.swal-lite.danger .swal-lite-icon {
  border-color: #fda29b;
  color: var(--danger);
}
.swal-lite.warning .swal-lite-icon {
  border-color: #fdb022;
  color: #b54708;
}
.swal-lite.warning .swal-lite-icon span,
.swal-lite.error .swal-lite-icon span,
.swal-lite.danger .swal-lite-icon span {
  width: auto;
  height: auto;
  border: 0;
  transform: none;
}
.swal-lite.warning .swal-lite-icon span::before,
.swal-lite.error .swal-lite-icon span::before,
.swal-lite.danger .swal-lite-icon span::before {
  content: "!";
  font-size: 34px;
  font-weight: 900;
}
.swal-lite h2 {
  margin: 0 0 8px;
  font-size: 22px;
}
.swal-lite p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}
.swal-lite-ok,
.swal-lite-confirm {
  min-width: 118px;
}
.swal-lite-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
@keyframes swalPop {
  0% { transform: scale(.72); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* Responsive UX upgrade */
img, svg, video, canvas {
  max-width: 100%;
}
p, h1, h2, h3, strong, span, small, td, th, a, label {
  overflow-wrap: anywhere;
}
.content,
.panel,
.page-hero,
.dashboard-hero,
.topbar {
  min-width: 0;
}
.table-shell {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.table-shell table {
  min-width: 760px;
}
.table-toolbar,
.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f8fbfd);
}
.table-toolbar label {
  margin: 0;
  min-width: 170px;
}
.table-toolbar label:first-child {
  flex: 1;
}
.table-pager {
  justify-content: flex-end;
  margin: 12px 0 0;
}
.table-pager span {
  color: var(--muted);
  font-weight: 800;
}
.table-pager button {
  min-height: 36px;
  padding: 7px 12px;
}
.table-pager button:disabled {
  opacity: .45;
}

@media (max-width: 1180px) {
  .split,
  .payment-workspace {
    grid-template-columns: 1fr;
  }
  .dashboard-feature-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
  .content {
    padding: 22px;
  }
}

@media (max-width: 940px) {
  .sidebar {
    width: min(330px, calc(100vw - 32px));
    border-radius: 0 12px 12px 0;
  }
  .topbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }
  .topbar-school {
    min-width: 0;
  }
  .topbar-school strong,
  .topbar-school span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dashboard-feature-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
  .user-chip {
    gap: 8px;
  }
  .page-hero,
  .dashboard-hero,
  .content > h1 {
    border-radius: 8px;
  }
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .table-toolbar,
  .table-pager {
    align-items: stretch;
    flex-direction: column;
  }
  .table-toolbar label,
  .table-toolbar label:first-child,
  .table-pager button {
    width: 100%;
  }
  .table-pager span {
    text-align: center;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 12px;
  }
  .content > h1,
  .page-hero,
  .dashboard-hero {
    padding: 18px;
  }
  .dashboard-hero h1,
  .page-hero h1,
  .content > h1 {
    font-size: 24px;
    line-height: 1.18;
  }
  .kpi-grid,
  .kpi-grid.compact,
  .statement-list,
  .dashboard-grid,
  .dashboard-grid.lower,
  .dashboard-feature-grid,
  .three-col,
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  .dashboard-feature-card {
    padding: 12px;
  }
  .dashboard-feature-card header {
    grid-template-columns: 34px minmax(0, 1fr);
  }
  .dashboard-feature-card header b {
    grid-column: 2;
    justify-self: start;
    max-width: 100%;
    text-align: left;
  }
  .dashboard-feature-links {
    grid-template-columns: 1fr;
  }
  .hero-balance,
  .panel,
  .login-card {
    width: 100%;
  }
  .compact-dashboard-page {
    gap: 10px;
  }
  .compact-dashboard-page .modern-dashboard-hero,
  .compact-dashboard-page .panel {
    padding: 12px;
  }
  .compact-dashboard-page .modern-dashboard-hero h1 {
    font-size: 24px;
  }
  .compact-dashboard-page .modern-dashboard-hero p {
    font-size: 12px;
  }
  .compact-dashboard-page .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .compact-dashboard-page .bar-chart {
    grid-template-columns: repeat(6, minmax(34px, 1fr));
    overflow-x: auto;
  }
  .compact-dashboard-page .donut-wrap {
    grid-template-columns: 1fr !important;
  }
  .compact-dashboard-page .donut {
    justify-self: center;
  }
  .action-stack,
  .hero-actions,
  .receipt-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .action-stack .button,
  .action-stack button,
  .action-stack form,
  .hero-actions .button,
  .receipt-actions .button,
  .receipt-actions button {
    width: 100%;
  }
  .table-shell {
    border: 0;
    background: transparent;
    overflow: visible;
  }
  .table-shell table,
  .table-shell thead,
  .table-shell tbody,
  .table-shell th,
  .table-shell td,
  .table-shell tr {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .table-shell thead {
    display: none;
  }
  .table-shell tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(16, 24, 39, .03);
    overflow: hidden;
  }
  .table-shell td {
    display: grid;
    grid-template-columns: minmax(95px, 38%) minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid var(--line);
    white-space: normal !important;
  }
  .table-shell td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
    font-size: 11px;
  }
  .table-shell td:last-child {
    border-bottom: 0;
  }
  .records-panel table td,
  .records-panel table th {
    white-space: normal;
  }
  .compact-dashboard-page .dashboard-due-table,
  .compact-dashboard-page .dashboard-due-table thead,
  .compact-dashboard-page .dashboard-due-table tbody,
  .compact-dashboard-page .dashboard-due-table th,
  .compact-dashboard-page .dashboard-due-table td,
  .compact-dashboard-page .dashboard-due-table tr {
    display: block;
    width: 100%;
  }
  .compact-dashboard-page .dashboard-due-table {
    overflow: visible;
    white-space: normal;
  }
  .compact-dashboard-page .dashboard-due-table thead {
    display: none;
  }
  .compact-dashboard-page .dashboard-due-table tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
  }
  .compact-dashboard-page .dashboard-due-table td {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 38px;
    padding: 8px 10px;
  }
  .compact-dashboard-page .dashboard-due-table td::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 42%;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
  }
  .compact-dashboard-page .dashboard-due-table .table-actions {
    justify-content: space-between;
  }
  .ai-assistant {
    inset: auto 10px 10px 10px;
  }
  .ai-assistant-toggle {
    justify-content: center;
    width: 100%;
  }
  .ai-assistant-panel {
    bottom: 56px;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100vh - 82px);
    border-radius: 14px;
  }
  .ai-assistant-messages {
    max-height: calc(100vh - 330px);
  }
  .ai-assistant-form {
    grid-template-columns: 1fr 42px;
  }
  .ai-assistant-form textarea {
    grid-column: 1 / -1;
  }
  .ai-assistant-form button[type="submit"] {
    grid-column: 1 / -1;
  }
  .ai-reminder-form {
    grid-template-columns: 1fr;
  }
  .ai-reminder-item {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 12px;
  }
  .topbar {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    padding: 8px;
  }
  .logout-link {
    width: 36px;
    height: 36px;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }
  .logout-link span {
    display: none;
  }
  .button,
  button,
  input,
  select,
  textarea {
    min-height: 40px;
  }
}

@media (max-width: 1180px) {
  .analytics-grid,
  .analytics-grid.wide-left {
    grid-template-columns: 1fr;
  }
  .student-quick-links {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
  .student-workspace {
    grid-template-columns: 1fr;
  }
  .profile-layout,
  .profile-record-grid {
    grid-template-columns: 1fr;
  }
  .profile-quick-links,
  .profile-summary-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
  .outstanding-page .outstanding-quick-links,
  .outstanding-page .outstanding-summary-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
  .compact-payroll-page .payroll-quick-links,
  .compact-payroll-page .payroll-summary-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
  .payroll-workspace {
    grid-template-columns: 1fr;
  }
  .compact-payroll-page .payroll-detail-grid,
  .compact-payroll-page .payroll-run-preview {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .compact-payroll-page .payroll-run-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .compact-fees-page .fee-quick-links {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
  .compact-fees-page .fee-workspace {
    grid-template-columns: 1fr;
  }
  .compact-fees-page .fee-detail-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .profile-detail-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .fee-workspace {
    grid-template-columns: 1fr;
  }
  .payment-history-layout {
    grid-template-columns: 1fr;
  }
  .payments-page .payment-quick-links {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
  .payment-kpi-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
  .payment-summary-strip {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
  .table-nav-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .table-nav-bar nav {
    justify-content: space-between;
  }
  .student-form-card {
    position: static;
  }
  .donut-wrap {
    grid-template-columns: minmax(160px, 190px) minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .analytics-grid,
  .analytics-grid.wide-left,
  .donut-wrap,
  .student-quick-links {
    grid-template-columns: 1fr !important;
  }
  .student-sis-page .records-panel > table {
    min-width: 0;
  }
  .profile-quick-links,
  .profile-summary-grid,
  .profile-detail-grid {
    grid-template-columns: 1fr !important;
  }
  .compact-fees-page .fee-quick-links,
  .compact-fees-page .fee-summary-grid,
  .compact-fees-page .fee-detail-grid {
    grid-template-columns: 1fr !important;
  }
  .outstanding-page .outstanding-quick-links,
  .outstanding-page .outstanding-summary-grid {
    grid-template-columns: 1fr !important;
  }
  .compact-payroll-page .payroll-quick-links,
  .compact-payroll-page .payroll-summary-grid,
  .compact-payroll-page .payroll-statutory-breakdown,
  .compact-payroll-page .payroll-run-card,
  .compact-payroll-page .payroll-detail-grid,
  .compact-payroll-page .payroll-run-preview {
    grid-template-columns: 1fr !important;
  }
  .compact-payroll-page .profile-hero,
  .compact-payroll-page .panel {
    padding: 12px;
  }
  .compact-payroll-page .payroll-quick-links a {
    min-height: 54px;
  }
  .compact-payroll-page .payroll-quick-links small {
    display: none;
  }
  .outstanding-page .outstanding-quick-links a {
    min-height: 54px;
  }
  .outstanding-page .outstanding-quick-links small {
    display: none;
  }
  .compact-fees-page .profile-hero,
  .compact-fees-page .panel {
    padding: 12px;
  }
  .compact-fees-page .fee-quick-links a {
    min-height: 54px;
  }
  .compact-fees-page .fee-quick-links small {
    display: none;
  }
  .compact-profile-page .profile-hero,
  .compact-profile-page .panel {
    padding: 12px;
  }
  .profile-quick-links a {
    min-height: 54px;
  }
  .profile-quick-links small {
    display: none;
  }
  .profile-table-scroll {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .profile-table,
  .profile-table thead,
  .profile-table tbody,
  .profile-table th,
  .profile-table td,
  .profile-table tr {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .profile-table thead {
    display: none;
  }
  .profile-table tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(16,24,39,.03);
    overflow: hidden;
  }
  .profile-table td {
    display: grid;
    grid-template-columns: minmax(96px, 36%) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 7px 8px;
    border-bottom: 1px solid var(--line);
    white-space: normal !important;
  }
  .profile-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .profile-table td:last-child {
    border-bottom: 0;
  }
  .fee-register-panel table {
    min-width: 0;
  }
  .payment-kpi-grid,
  .payment-summary-strip {
    grid-template-columns: 1fr;
  }
  .payment-kpi-grid article,
  .payment-summary-strip div {
    padding: 12px;
  }
  .payments-page .managed-table,
  .payments-page .managed-table thead,
  .payments-page .managed-table tbody,
  .payments-page .managed-table th,
  .payments-page .managed-table td,
  .payments-page .managed-table tr {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .payments-page .managed-table thead {
    display: none;
  }
  .payments-page .table-scroll {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .payments-page .managed-table tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(16,24,39,.03);
    overflow: hidden;
  }
  .payments-page .managed-table td {
    display: grid;
    grid-template-columns: minmax(92px, 35%) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    white-space: normal !important;
  }
  .payments-page .managed-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .payments-page .managed-table td:last-child {
    border-bottom: 0;
  }
  .table-nav-bar nav,
  .table-nav-bar .button {
    width: 100%;
  }
  .table-nav-bar nav strong {
    flex: 1;
    text-align: center;
  }
  .payments-page .page-hero.compact-hero,
  .payments-page .panel,
  .payments-page .records-filter {
    padding: 12px;
  }
  .payments-page .payment-quick-links {
    grid-template-columns: 1fr;
  }
  .payments-page .payment-quick-links a {
    min-height: 54px;
  }
  .payments-page .panel-subtitle,
  .payments-page .payment-quick-links small,
  .payments-page .payment-kpi-grid small {
    display: none;
  }
  .payments-page .managed-table td {
    padding: 7px 8px;
  }
  .payments-page .records-panel table {
    min-width: 0;
  }
  .payments-page .transaction-payments-table,
  .payments-page .student-payments-table {
    min-width: 0;
  }
  .bar-chart {
    gap: 8px;
    min-height: 215px;
  }
  .bar-column {
    grid-template-rows: 22px minmax(105px, 1fr) 22px;
  }
  .bar-value {
    font-size: 10px;
  }
  .channel-row,
  .class-bar-row {
    grid-template-columns: 1fr;
  }
  .class-bar-row strong {
    justify-self: start;
  }
  .donut {
    width: min(180px, 100%);
  }
  .inline-form,
  .payroll-run-actions,
  .payslip-footer,
  .record-actions,
  .bulk-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .inline-form label,
  .inline-form button,
  .payroll-run-actions button,
  .payroll-run-actions form,
  .bulk-actions label,
  .bulk-actions button,
  .record-actions .button {
    width: 100%;
  }
  .payslip-sheet {
    width: calc(100vw - 24px);
    padding: 16px;
  }
  .payslip-header,
  .payslip-meta,
  .payslip-columns {
    grid-template-columns: 1fr;
  }
  .payslip-header h1 {
    font-size: 24px;
  }
}

/* System-wide compact responsive polish */
.content:not(.login-page) {
  padding: 18px;
}
.content > h1,
.page-hero,
.dashboard-hero {
  margin-bottom: 12px;
}
.page-hero,
.dashboard-hero,
.content > h1 {
  padding: 18px;
}
.page-hero h1,
.dashboard-hero h1,
.content > h1 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.08;
}
.page-hero p,
.dashboard-hero p {
  font-size: 13px;
  line-height: 1.5;
}
.panel {
  padding: 14px;
  margin-bottom: 12px;
}
.panel-title {
  gap: 8px;
  margin-bottom: 10px;
}
.panel-title h2,
h2 {
  font-size: 16px;
}
.split,
.three-col,
.form-grid,
.dashboard-grid,
.dashboard-grid.lower,
.analytics-grid {
  gap: 12px;
}
.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
label {
  margin-bottom: 8px;
  gap: 5px;
  font-size: 12px;
}
input,
select,
textarea,
button,
.button {
  min-height: 38px;
}
input,
select,
textarea {
  padding: 8px 10px;
  font-size: 13px;
}
button,
.button {
  padding: 8px 12px;
  font-size: 12px;
}
.kpi-grid {
  gap: 10px;
  margin-bottom: 12px;
}
.kpi-grid article {
  padding: 13px;
}
.kpi-grid strong {
  margin: 5px 0;
  font-size: 20px;
}
.records-panel table,
.panel table {
  font-size: 12px;
}
th,
td {
  padding: 9px 10px;
}
.table-toolbar,
.table-pager,
.filters,
.table-nav-bar {
  gap: 8px;
}
.table-toolbar,
.table-pager {
  margin-bottom: 10px;
}
.action-stack,
.table-actions {
  gap: 6px;
}
.mini,
.button.mini,
button.mini {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .content:not(.login-page) {
    padding: 16px;
  }
  .split,
  .three-col,
  .dashboard-grid,
  .dashboard-grid.lower,
  .analytics-grid,
  .inventory-workspace,
  .users-workspace,
  .results-workspace,
  .analytics-grid.wide-left {
    grid-template-columns: 1fr !important;
  }
  .kpi-grid,
  .kpi-grid.compact {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .content:not(.login-page) {
    padding: 12px;
  }
  .content > h1,
  .page-hero,
  .dashboard-hero,
  .panel {
    padding: 12px;
  }
  .page-hero,
  .dashboard-hero {
    grid-template-columns: 1fr !important;
  }
  .hero-actions,
  .page-head,
  .panel-title,
  .filters,
  .table-toolbar,
  .table-pager,
  .table-nav-bar,
  .action-stack,
  .record-actions,
  .bulk-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .hero-actions .button,
  .filters label,
  .filters button,
  .table-toolbar label,
  .table-toolbar input,
  .table-toolbar select,
  .table-pager button,
  .table-nav-bar .button,
  .action-stack .button,
  .action-stack button,
  .action-stack form,
  .record-actions .button,
  .bulk-actions label,
  .bulk-actions button {
    width: 100%;
  }
  .kpi-grid,
  .kpi-grid.compact,
  .inventory-summary-grid,
  .users-summary-grid,
  .results-summary-grid,
  .result-quick-links,
  .form-grid,
  .flow,
  .statement-list {
    grid-template-columns: 1fr !important;
  }
  .hero-balance {
    width: 100%;
  }
  .records-panel > table,
  .panel > table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    white-space: nowrap;
  }
  .table-shell table,
  .profile-table,
  .managed-table {
    min-width: 0;
  }
  .inventory-category-list {
    grid-template-columns: 1fr;
  }
  .inventory-category-list article {
    align-items: stretch;
    flex-direction: column;
  }
  .result-student,
  .result-psycho,
  .result-sheet footer {
    grid-template-columns: 1fr;
  }
  .result-letterhead,
  .broadsheet-letterhead,
  .result-student-card,
  .result-lower-grid,
  .result-signatures,
  .result-remarks {
    grid-template-columns: 1fr;
  }
  .result-letterhead b {
    justify-self: start;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 12px;
  }
  .topbar {
    min-height: 56px;
  }
  .topbar-school strong {
    font-size: 13px;
  }
  .topbar-school span {
    font-size: 11px;
  }
  .user-chip {
    gap: 6px;
  }
  .user-chip > span {
    display: none;
  }
  .content > h1,
  .page-hero h1,
  .dashboard-hero h1 {
    font-size: 22px;
  }
  .page-hero p,
  .dashboard-hero p,
  .panel-title p {
    display: none;
  }
  .kpi-grid article,
  .panel {
    border-radius: 8px;
  }
  th,
  td {
    padding: 8px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
  .sidebar,
  .topbar,
  .no-print,
  .ai-assistant {
    display: none !important;
  }
  .content,
  .results-print-page {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .results-print-page .page-hero {
    display: none;
  }
  .result-sheet {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 0;
    height: 277mm;
    page-break-after: always;
    padding: 6mm;
    overflow: hidden;
  }
  .result-letterhead,
  .broadsheet-letterhead {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 10px;
  }
  .result-logo-wrap {
    width: 58px;
    height: 58px;
  }
  .result-letterhead strong,
  .broadsheet-letterhead strong {
    font-size: 15px;
  }
  .result-letterhead span,
  .broadsheet-letterhead span,
  .result-letterhead small,
  .broadsheet-letterhead small {
    font-size: 10px;
    line-height: 1.25;
  }
  .result-student-card {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }
  .result-lower-grid {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }
  .result-signatures,
  .result-remarks {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin: 6px 0;
  }
  .result-student-card div,
  .result-box,
  .result-signatures div,
  .result-remarks div {
    padding: 5px;
  }
  .result-remarks div {
    min-height: 38px;
  }
  .result-score-table th,
  .result-score-table td {
    padding: 4px 5px;
    font-size: 10px;
    line-height: 1.2;
  }
  .result-box h3 {
    font-size: 11px;
    margin-bottom: 4px;
  }
  .result-psycho {
    gap: 4px;
    font-size: 10px;
    margin: 4px 0;
  }
  .result-grade-key {
    font-size: 9px;
    padding-top: 4px;
  }
  .broadsheet-document {
    border: 0;
    box-shadow: none;
    padding: 6mm;
  }
  .receipt-page {
    padding: 0;
  }
  .payslip-sheet {
    width: 100%;
    margin: 0;
    border: 0;
    box-shadow: none;
  }
}

/* Compact, responsive results management layer */
.results-page.compact-profile-page,
.results-print-page {
  gap: 10px;
}
.results-page .page-hero,
.results-print-page .page-hero {
  padding: 14px;
}
.results-page .page-hero h1,
.results-print-page .page-hero h1 {
  font-size: clamp(22px, 3vw, 32px);
}
.results-page .panel,
.results-print-page .panel,
.results-page .filters,
.results-print-page .filters {
  padding: 12px;
}
.results-page .form-grid {
  gap: 9px;
}
.results-page label,
.results-print-page label {
  font-size: 12px;
}
.results-page input,
.results-page select,
.results-page textarea,
.results-print-page input,
.results-print-page select,
.results-print-page textarea {
  min-height: 38px;
  padding: 8px 10px;
}
.results-page .button,
.results-page button,
.results-print-page .button,
.results-print-page button {
  min-height: 38px;
  padding: 8px 11px;
}
.results-page .profile-table-scroll,
.results-print-page .profile-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.results-page .profile-table,
.results-print-page .profile-table {
  font-size: 12px;
}
.results-page .profile-table th,
.results-page .profile-table td,
.results-print-page .profile-table th,
.results-print-page .profile-table td {
  padding: 8px;
  vertical-align: middle;
}
.results-page .profile-table input,
.results-page .profile-table select {
  width: 100%;
  min-width: 72px;
}
.results-psychomotor-table {
  min-width: max(920px, 100%);
}
.score-sheet-document {
  max-width: 210mm;
  margin-inline: auto;
}
.score-sheet-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.score-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  table-layout: fixed;
}
.score-sheet-table th,
.score-sheet-table td {
  border: 1px solid var(--line);
  height: 28px;
}
.score-sheet-table th:first-child,
.score-sheet-table td:first-child {
  width: 34px;
  text-align: center;
}
.score-sheet-table th:nth-child(2),
.score-sheet-table td:nth-child(2) {
  width: 31%;
}
.score-sheet-table th:nth-child(3),
.score-sheet-table td:nth-child(3) {
  width: 18%;
}
.score-sheet-signatures strong:empty::after,
.result-signatures strong:empty::after {
  content: "";
  display: block;
  height: 18px;
  border-bottom: 1px solid #98a2b3;
  margin-top: 14px;
}
.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.result-analysis-page {
  gap: 10px;
}
.result-analysis-page .analysis-hero {
  min-height: 0;
}
.result-analysis-page .analysis-hero p {
  max-width: 680px;
}
.result-analysis-page .hero-balance {
  padding: 12px;
}
.result-analysis-page .hero-balance strong {
  font-size: 28px;
}
.analysis-filter {
  align-items: end;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.analysis-filter label,
.analysis-filter button {
  width: 100%;
}
.analysis-grid-wide {
  grid-template-columns: 1fr;
}
.analysis-card {
  min-width: 0;
  overflow: hidden;
  padding: 12px;
}
.analysis-bars {
  display: grid;
  gap: 7px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}
.analysis-bar-row {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(100px, 160px) minmax(0, 1fr) 56px;
  gap: 8px;
  font-size: 12px;
}
.analysis-bar-row span {
  color: var(--ink);
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analysis-bar-row div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}
.analysis-bar-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #14b8a6);
}
.analysis-bar-row strong {
  color: var(--primary-2);
  font-size: 12px;
  text-align: right;
}
.grade-chart {
  align-items: end;
  display: grid;
  grid-template-columns: repeat(9, minmax(34px, 1fr));
  gap: 6px;
  min-height: 190px;
  overflow: hidden;
}
.grade-column {
  align-items: center;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 5px;
  height: 190px;
  text-align: center;
}
.grade-column span {
  align-self: end;
  width: 100%;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #22c55e, var(--primary));
}
.grade-column strong {
  font-size: 12px;
}
.grade-column small {
  color: var(--muted);
  font-size: 10px;
}
.ai-insight-card {
  background: linear-gradient(135deg, rgba(15, 118, 110, .08), rgba(255, 255, 255, .96));
}
.ai-recommendations {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}
.ai-recommendations article {
  border: 1px solid rgba(15, 118, 110, .16);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, .82);
}
.ai-recommendations strong {
  display: block;
  color: var(--primary-2);
  font-size: 12px;
  margin-bottom: 4px;
}
.ai-recommendations p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.analysis-table {
  min-width: 760px;
}
.result-analysis-page .records-panel {
  min-width: 0;
}
.result-analysis-page .profile-summary-grid article {
  padding: 12px;
}
.attendance-page {
  gap: 10px;
}
.attendance-hero p {
  max-width: 660px;
}
.attendance-filter {
  align-items: end;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.attendance-filter label,
.attendance-filter button {
  width: 100%;
}
.attendance-summary-grid article {
  padding: 12px;
}
.attendance-panel {
  min-width: 0;
}
.attendance-table {
  min-width: 760px;
}
.attendance-table td,
.attendance-table th {
  white-space: normal;
}
.attendance-status-select {
  border-width: 1px;
  font-weight: 850;
}
.attendance-status-select.status-present {
  border-color: rgba(34, 197, 94, .35);
  background: rgba(34, 197, 94, .08);
  color: #166534;
}
.attendance-status-select.status-late {
  border-color: rgba(245, 158, 11, .4);
  background: rgba(245, 158, 11, .1);
  color: #92400e;
}
.attendance-status-select.status-absent {
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .08);
  color: #991b1b;
}
.attendance-status-select.status-excused {
  border-color: rgba(59, 130, 246, .35);
  background: rgba(59, 130, 246, .08);
  color: #1d4ed8;
}
.attendance-rate {
  color: var(--primary-2);
  font-weight: 950;
}
.attendance-table small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.attendance-save-button {
  margin-top: 10px;
  width: min(260px, 100%);
}
.sis-print-page {
  gap: 10px;
}
.sis-print-filter {
  align-items: end;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.sis-print-filter label,
.sis-print-filter button,
.sis-print-filter .button {
  width: 100%;
}
.sis-print-document,
.sis-student-report {
  position: relative;
  overflow: hidden;
  background: #fff;
}
.sis-print-document > *:not(.result-watermark),
.sis-student-report > *:not(.result-watermark) {
  position: relative;
  z-index: 1;
}
.sis-print-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.sis-register-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.sis-register-table th,
.sis-register-table td {
  border: 1px solid var(--line);
  padding: 5px 6px;
}
.sis-report-summary {
  margin: 8px 0;
}
.biometric-page {
  gap: 10px;
}
.biometric-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.biometric-person-card {
  margin: 10px 0;
}
.biometric-capture-card {
  display: grid;
  gap: 10px;
  max-width: 760px;
}
.biometric-capture-card button,
.biometric-workspace button {
  width: 100%;
}
.biometric-capture-card .record-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.promotion-filter,
.student-letter-filter {
  align-items: end;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.promotion-actions {
  align-items: end;
}
.inline-form {
  align-items: center;
  display: flex;
  gap: 6px;
}
.student-letter-document {
  max-width: 210mm;
  margin-inline: auto;
}
.student-letter-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.student-letter-body {
  display: grid;
  gap: 12px;
  margin: 22px 0;
  font-size: 15px;
  line-height: 1.75;
}
.student-letter-body p {
  margin: 0;
}
.student-letter-signatures {
  margin-top: 40px;
}

.id-card-page {
  gap: 12px;
}
.id-card-page .page-hero.compact-hero {
  margin-bottom: 0;
  padding: 18px;
}
.id-card-page .page-hero h1 {
  font-size: clamp(24px, 3vw, 34px);
}
.id-card-filter {
  gap: 8px;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-bottom: 0;
  padding: 12px;
}
.id-card-filter label {
  font-size: 12px;
  min-width: 0;
}
.id-card-filter input,
.id-card-filter select {
  min-height: 38px;
  padding: 8px 10px;
}
.id-card-filter button {
  min-height: 36px;
  padding: 8px 10px;
}
.id-card-sheet {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  width: 100%;
}
.staff-id-sheet {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.student-id-sheet {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.id-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #eef6ff 100%);
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
  color: #0f172a;
  isolation: isolate;
  overflow: hidden;
  page-break-inside: avoid;
  position: relative;
}
.id-card.student-card {
  aspect-ratio: 85.6 / 53.98;
  min-height: 208px;
  padding: 11px;
}
.id-card.staff-card {
  aspect-ratio: 53.98 / 85.6;
  min-height: 330px;
  padding: 13px;
}
.id-card::before {
  background-image: var(--id-logo-watermark);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 68%;
  content: "";
  inset: 18px;
  opacity: 0.065;
  position: absolute;
  z-index: -1;
}
.id-card::after {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.17), rgba(16, 185, 129, 0.13));
  border-radius: 999px;
  content: "";
  height: 150px;
  position: absolute;
  right: -55px;
  top: -70px;
  width: 150px;
  z-index: -1;
}
.id-card header,
.id-school-header {
  align-items: center;
  display: grid;
  gap: 7px;
  grid-template-columns: 32px 1fr;
  min-height: 36px;
  position: relative;
  z-index: 1;
}
.id-card header span,
.id-school-header span {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 9px;
  display: flex;
  height: 32px;
  justify-content: center;
  overflow: hidden;
  width: 32px;
}
.id-card header span img,
.id-school-header span img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}
.id-school-header div {
  min-width: 0;
}
.id-card header strong,
.id-school-header strong {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: uppercase;
}
.id-school-header small {
  color: #64748b;
  display: block;
  font-size: 7.5px;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.id-card.student-card .id-school-header {
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 30px;
}
.id-card.student-card .id-school-header span {
  border-radius: 8px;
  height: 28px;
  width: 28px;
}
.id-card.student-card .id-school-header strong {
  display: -webkit-box;
  font-size: clamp(7.2px, 2.45vw, 9.2px);
  line-height: 1.05;
  max-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.id-card.student-card .id-school-header small {
  font-size: 6.5px;
  line-height: 1.05;
}
.student-landscape-body {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 80px minmax(0, 1fr);
  margin-top: 10px;
  position: relative;
  z-index: 1;
}
.student-landscape-info {
  min-width: 0;
}
.id-card.student-card .student-photo {
  border-radius: 50%;
  height: 78px;
  width: 78px;
}
.id-card.student-card h2 {
  font-size: 15px;
  line-height: 1.08;
}
.id-card.student-card > p,
.student-landscape-info p {
  color: #475569;
  font-size: 10px;
  font-weight: 850;
  margin-top: 3px;
}
.id-card.student-card dl {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 7px;
}
.id-card.student-card dl div {
  padding: 4px 6px;
}
.id-card.student-card dt {
  font-size: 7px;
}
.id-card.student-card dd {
  font-size: 9px;
}
.id-card.student-card.id-card-front .id-type {
  bottom: 8px;
  left: 11px;
  right: auto;
  transform: none;
}
.id-photo {
  align-items: center;
  background: linear-gradient(135deg, #0f172a, #2563eb);
  border: 3px solid #fff;
  border-radius: 12px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 28px;
  font-weight: 950;
  height: 78px;
  justify-content: center;
  width: 70px;
}
.id-photo img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}
.id-card.staff-card .id-photo {
  border-radius: 50%;
  height: 92px;
  margin: 16px auto 8px;
  width: 92px;
}
.id-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 72px minmax(0, 1fr);
  margin-top: 13px;
  position: relative;
  z-index: 1;
}
.id-card h2,
.id-card h3,
.id-card p {
  margin: 0;
  position: relative;
  z-index: 1;
}
.id-card h2 {
  font-size: 16px;
  font-weight: 950;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.id-card.staff-card h2 {
  margin-top: 6px;
  text-align: center;
}
.id-card h3 {
  font-size: 15px;
  font-weight: 950;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.id-card p {
  color: #475569;
  font-size: 11px;
  line-height: 1.45;
}
.id-card.staff-card > p {
  margin-top: 4px;
  text-align: center;
}
.id-card dl {
  display: grid;
  gap: 6px;
  margin: 9px 0 0;
  position: relative;
  z-index: 1;
}
.id-card dl div {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: 9px;
  padding: 5px 7px;
}
.id-card dt {
  color: #64748b;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}
.id-card dd {
  color: #0f172a;
  font-size: 10.5px;
  font-weight: 850;
  line-height: 1.2;
  margin: 1px 0 0;
  overflow-wrap: anywhere;
}
.id-type {
  background: #0f172a;
  border-radius: 999px;
  bottom: 9px;
  color: #fff;
  font-size: 8px;
  font-weight: 950;
  left: 12px;
  letter-spacing: 0;
  padding: 5px 9px;
  position: absolute;
  z-index: 1;
}
.security-barcode {
  display: grid;
  gap: 2px;
  margin-top: 7px;
  max-width: 100%;
  position: relative;
  z-index: 1;
}
.barcode-bars {
  align-items: stretch;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  display: flex;
  height: 22px;
  overflow: hidden;
  padding: 3px 4px;
}
.barcode-bars i {
  display: block;
  flex: 0 0 auto;
}
.barcode-bars .bar {
  background: #0f172a;
}
.barcode-bars .space {
  background: transparent;
}
.barcode-bars .narrow {
  width: 1px;
}
.barcode-bars .wide {
  width: 2.4px;
}
.barcode-bars .gap {
  width: 2px;
}
.security-barcode small {
  color: #334155;
  display: block;
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
}
.id-card-barcode {
  margin-right: 72px;
}
.staff-card .id-card-barcode {
  margin-inline: 0;
}
.back-barcode {
  margin: 9px 0 0;
}
.security-qr {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  justify-items: center;
  margin: 7px auto 0;
  padding: 6px;
  position: relative;
  width: min(96px, 100%);
  z-index: 1;
}
.security-qr svg {
  border-radius: 6px;
  display: block;
  height: 68px;
  width: 68px;
}
.security-qr small {
  color: #334155;
  display: block;
  font-size: 7px;
  font-weight: 900;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-align: center;
}
.id-card.student-card .security-qr {
  border-radius: 10px;
  gap: 3px;
  margin-top: 4px;
  padding: 5px;
  width: min(76px, 100%);
}
.id-card.student-card .security-qr svg {
  height: 52px;
  width: 52px;
}
.id-card.student-card .security-qr small {
  font-size: 6px;
}
.id-watermark {
  color: #0f172a;
  font-weight: 950;
  opacity: 0.075;
  pointer-events: none;
  position: absolute;
  user-select: none;
  z-index: 0;
}
.id-staff-word {
  bottom: 14px;
  font-size: 46px;
  line-height: 1;
  right: -8px;
  transform: rotate(-18deg);
}
.id-admission-watermark {
  bottom: 8px;
  font-size: 24px;
  line-height: 1;
  right: 10px;
  transform: rotate(-11deg);
}
.id-card-back {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.id-card-back p {
  color: #334155;
  font-size: 12px;
}
.id-card.student-card.id-card-back h3 {
  font-size: 12px;
  margin-bottom: 4px;
}
.id-card.student-card.id-card-back p {
  font-size: 8.6px;
  line-height: 1.25;
}
.id-card.student-card .id-back-info {
  gap: 4px;
  margin-top: 6px;
}
.id-card.student-card .id-back-info span {
  font-size: 7px;
  line-height: 1.2;
  padding: 4px 5px;
}
.id-card.student-card .id-sign {
  font-size: 7px;
  margin: 10px 10px 0;
  padding-top: 4px;
}
.id-back-info {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.id-back-info span {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 9px;
  color: #475569;
  display: block;
  font-size: 9.5px;
  line-height: 1.35;
  padding: 6px 7px;
}
.id-sign {
  border-top: 1px solid rgba(15, 23, 42, 0.48);
  color: #334155;
  font-size: 9px;
  font-weight: 850;
  margin: 24px 12px 0;
  padding-top: 5px;
  position: relative;
  text-align: center;
  z-index: 1;
}

@media (max-width: 1180px) {
  .results-workspace {
    grid-template-columns: 1fr;
  }
  .results-table,
  .results-broadsheet-table {
    min-width: 760px;
  }
  .analysis-grid {
    grid-template-columns: 1fr;
  }
  .analysis-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .attendance-filter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sis-print-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .biometric-workspace {
    grid-template-columns: 1fr;
  }
  .promotion-filter,
  .student-letter-filter,
  .id-card-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .results-page .settings-tiles,
  .results-page .profile-summary-grid,
  .score-sheet-meta {
    grid-template-columns: 1fr !important;
  }
  .results-page .panel-title,
  .results-print-page .panel-title {
    gap: 8px;
  }
  .results-page .table-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .results-page .table-actions .button,
  .results-page .table-actions button {
    width: 100%;
  }
  .score-sheet-document {
    padding: 12px;
  }
  .analysis-bar-row {
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 5px;
  }
  .analysis-bar-row span,
  .analysis-bar-row div {
    grid-column: 1 / -1;
  }
  .analysis-bar-row strong {
    grid-column: 2;
    text-align: right;
  }
  .grade-chart {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 0;
  }
  .grade-column {
    height: 130px;
  }
  .analysis-filter {
    grid-template-columns: 1fr;
  }
  .attendance-filter {
    grid-template-columns: 1fr;
  }
  .sis-print-filter,
  .sis-print-meta {
    grid-template-columns: 1fr;
  }
  .biometric-capture-card .record-actions {
    grid-template-columns: 1fr;
  }
  .promotion-filter,
  .student-letter-filter,
  .id-card-filter,
  .student-letter-meta {
    grid-template-columns: 1fr;
  }
  .id-card-page .page-hero.compact-hero,
  .id-card-filter {
    padding: 12px;
  }
  .id-card-sheet,
  .staff-id-sheet,
  .student-id-sheet {
    grid-template-columns: 1fr;
  }
  .id-card.student-card,
  .id-card.staff-card {
    min-height: 0;
  }
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }
  .attendance-table {
    min-width: 620px;
  }
  .attendance-save-button {
    width: 100%;
  }
  .analysis-bars,
  .ai-recommendations {
    max-height: none;
  }
  .analysis-table {
    min-width: 680px;
  }
}

@media print {
  .score-sheet-print-page {
    background: #fff !important;
  }
  .score-sheet-document {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    max-width: none;
    margin: 0;
    padding: 6mm;
    box-sizing: border-box;
    page-break-after: always;
  }
  .score-sheet-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }
  .score-sheet-table {
    font-size: 8.8px;
    table-layout: fixed;
  }
  .score-sheet-table th,
  .score-sheet-table td {
    height: 21px;
    padding: 2px 3px;
  }
  .score-sheet-table th:first-child,
  .score-sheet-table td:first-child {
    width: 28px;
  }
  .score-sheet-table th:nth-child(2),
  .score-sheet-table td:nth-child(2) {
    width: 30%;
  }
  .score-sheet-table th:nth-child(3),
  .score-sheet-table td:nth-child(3) {
    width: 17%;
  }
  .score-sheet-signatures {
    margin-top: 6px;
  }
  .sis-print-page {
    background: #fff !important;
  }
  .sis-print-document,
  .sis-student-report {
    border: 0;
    box-shadow: none;
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 7mm;
    page-break-after: always;
  }
  .sis-print-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }
  .sis-register-table {
    font-size: 8.5px;
  }
  .sis-register-table th,
  .sis-register-table td {
    padding: 3px 4px;
  }
  .sis-student-report .profile-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .student-letter-document {
    border: 0;
    box-shadow: none;
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 10mm;
  }
  .student-letter-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .student-letter-body {
    font-size: 13px;
  }
  .id-card-page {
    background: #fff !important;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
  }
  .id-card-sheet {
    display: grid;
    gap: 6mm;
    grid-template-columns: repeat(2, 85.6mm);
    width: auto;
  }
  .staff-id-sheet {
    grid-template-columns: repeat(3, 53.98mm);
  }
  .student-id-sheet {
    grid-template-columns: repeat(2, 85.6mm);
  }
  .id-card {
    border: 0.25mm solid #111827;
    border-radius: 3mm;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .id-card.student-card {
    height: 53.98mm;
    min-height: 0;
    padding: 3mm;
    width: 85.6mm;
  }
  .id-card.staff-card {
    height: 85.6mm;
    min-height: 0;
    padding: 3mm;
    width: 53.98mm;
  }
  .id-card header,
  .id-school-header {
    gap: 1.5mm;
    grid-template-columns: 8mm 1fr;
    min-height: 8mm;
  }
  .id-card header span,
  .id-school-header span {
    border-radius: 2mm;
    height: 8mm;
    width: 8mm;
  }
  .id-card header strong,
  .id-school-header strong {
    font-size: 7.2pt;
  }
  .id-school-header small {
    font-size: 5.2pt;
  }
  .id-card.student-card .id-school-header {
    gap: 1.2mm;
    grid-template-columns: 7mm minmax(0, 1fr);
    min-height: 7mm;
  }
  .id-card.student-card .id-school-header span {
    border-radius: 1.8mm;
    height: 7mm;
    width: 7mm;
  }
  .id-card.student-card .id-school-header strong {
    font-size: 5.6pt;
    line-height: 1.03;
    max-height: 11.6pt;
  }
  .id-card.student-card .id-school-header small {
    font-size: 4.2pt;
  }
  .id-row {
    gap: 3mm;
    grid-template-columns: 18mm minmax(0, 1fr);
    margin-top: 3mm;
  }
  .student-landscape-body {
    gap: 2.4mm;
    grid-template-columns: 20mm minmax(0, 1fr);
    margin-top: 2.2mm;
  }
  .id-card.student-card .student-photo {
    height: 19.5mm;
    width: 19.5mm;
  }
  .id-card.student-card h2 {
    font-size: 9.2pt;
    line-height: 1.05;
  }
  .student-landscape-info p {
    font-size: 6.4pt;
    margin-top: 0.6mm;
  }
  .id-card.student-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9mm;
    margin-top: 1.3mm;
  }
  .id-card.student-card dl div {
    padding: 0.8mm 1.2mm;
  }
  .id-card.student-card dt {
    font-size: 4.8pt;
  }
  .id-card.student-card dd {
    font-size: 6.1pt;
  }
  .id-photo {
    border-width: 0.7mm;
    border-radius: 2.4mm;
    font-size: 18pt;
    height: 20mm;
    width: 18mm;
  }
  .id-card.staff-card .id-photo {
    height: 23mm;
    margin: 4mm auto 2mm;
    width: 23mm;
  }
  .id-card h2 {
    font-size: 10pt;
  }
  .id-card h3 {
    font-size: 9.5pt;
    margin-bottom: 2mm;
  }
  .id-card.student-card.id-card-back h3 {
    font-size: 7.4pt;
    margin-bottom: 1mm;
  }
  .id-card p,
  .id-card-back p {
    font-size: 7.2pt;
  }
  .id-card.student-card.id-card-back p {
    font-size: 5.4pt;
    line-height: 1.18;
  }
  .id-card dl {
    gap: 1.5mm;
    margin-top: 2mm;
  }
  .id-card dl div {
    border-radius: 2mm;
    padding: 1mm 1.7mm;
  }
  .id-card dt {
    font-size: 5.8pt;
  }
  .id-card dd {
    font-size: 7pt;
  }
  .id-type {
    bottom: 2.3mm;
    font-size: 5.8pt;
    left: 3mm;
    padding: 1.2mm 2mm;
  }
  .id-staff-word {
    font-size: 30pt;
  }
  .id-admission-watermark {
    font-size: 15pt;
  }
  .id-back-info {
    gap: 1.3mm;
    margin-top: 3mm;
  }
  .id-back-info span {
    border-radius: 2mm;
    font-size: 6pt;
    padding: 1.2mm 1.7mm;
  }
  .id-sign {
    font-size: 6pt;
    margin: 6mm 3mm 0;
    padding-top: 1.3mm;
  }
  .security-barcode {
    gap: 0.5mm;
    margin-top: 1.3mm;
  }
  .barcode-bars {
    height: 5.5mm;
    padding: 0.7mm 1mm;
  }
  .barcode-bars .narrow {
    width: 0.25mm;
  }
  .barcode-bars .wide {
    width: 0.55mm;
  }
  .barcode-bars .gap {
    width: 0.45mm;
  }
  .security-barcode small {
    font-size: 4.8pt;
  }
  .id-card-barcode {
    margin-right: 19mm;
  }
  .id-card.staff-card .id-card-barcode,
  .back-barcode {
    margin-right: 0;
  }
  .security-qr {
    border-radius: 2.5mm;
    gap: 0.8mm;
    margin-top: 2mm;
    padding: 1.3mm;
    width: 21mm;
  }
  .security-qr svg {
    border-radius: 1.2mm;
    height: 15.5mm;
    width: 15.5mm;
  }
  .security-qr small {
    font-size: 4.2pt;
  }
  .id-card.student-card .security-qr {
    border-radius: 2mm;
    gap: 0.5mm;
    margin-top: 1mm;
    padding: 1mm;
    width: 16.5mm;
  }
  .id-card.student-card .security-qr svg {
    height: 11.5mm;
    width: 11.5mm;
  }
  .id-card.student-card .security-qr small {
    font-size: 3.6pt;
  }
  .id-card.student-card .id-back-info {
    gap: 0.8mm;
    margin-top: 1.2mm;
  }
  .id-card.student-card .id-back-info span {
    font-size: 4.2pt;
    padding: 0.8mm 1mm;
  }
  .id-card.student-card .id-sign {
    font-size: 4.4pt;
    margin: 2.5mm 3mm 0;
    padding-top: 0.8mm;
  }
}

/* Ultimate responsive fit overrides. Keep this at the end of the stylesheet. */
@media screen {
  .content:not(.login-page) {
    max-width: 100%;
    overflow-x: hidden;
    padding: clamp(10px, 1.25vw, 16px) !important;
  }
  .page-hero,
  .dashboard-hero,
  .panel,
  .records-panel,
  .detail-panel,
  .chart-panel,
  .focus-panel {
    max-width: 100%;
    min-width: 0;
    border-radius: 8px;
  }
  .page-hero,
  .dashboard-hero {
    gap: 10px;
    padding: clamp(12px, 1.5vw, 18px) !important;
  }
  .panel,
  .records-panel,
  .detail-panel,
  .chart-panel,
  .focus-panel {
    padding: clamp(10px, 1vw, 13px) !important;
  }
  .page-hero h1,
  .dashboard-hero h1,
  .content > h1 {
    font-size: clamp(20px, 2.1vw, 30px) !important;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }
  .page-hero p,
  .dashboard-hero p,
  .panel-subtitle {
    font-size: 12px !important;
    line-height: 1.42;
  }
  .panel-title h2,
  .panel h2 {
    font-size: clamp(14px, 1.35vw, 16px) !important;
    line-height: 1.2;
  }
  .filters,
  .records-filter,
  .form-grid,
  .settings-tiles,
  .profile-summary-grid,
  .kpi-grid,
  .payment-kpi-grid,
  .dashboard-feature-grid,
  .statement-list {
    gap: 8px !important;
  }
  .settings-tiles a,
  .profile-quick-links a,
  .student-quick-links a,
  .fee-quick-links a,
  .payment-quick-links a,
  .payroll-quick-links a,
  .outstanding-quick-links a,
  .dashboard-feature-card,
  .kpi-grid article,
  .payment-kpi-grid article,
  .profile-summary-grid article {
    min-width: 0;
    padding: 9px !important;
    border-radius: 8px;
  }
  input,
  select,
  textarea,
  button,
  .button {
    max-width: 100%;
    min-height: 34px !important;
    border-radius: 8px;
    font-size: 12px !important;
  }
  input,
  select,
  textarea {
    min-width: 0;
    padding: 7px 9px !important;
  }
  button,
  .button {
    padding: 7px 10px !important;
  }
  .button.mini,
  button.mini,
  .mini {
    min-height: 28px !important;
    padding: 4px 7px !important;
    font-size: 11px !important;
  }
  .table-shell,
  .table-scroll,
  .profile-table-scroll,
  .records-panel {
    max-width: 100%;
    overflow-x: auto;
  }
  table {
    max-width: 100%;
  }
  th,
  td,
  .profile-table th,
  .profile-table td,
  .managed-table th,
  .managed-table td {
    padding: 7px 8px !important;
    font-size: 11.5px !important;
    line-height: 1.28;
    overflow-wrap: anywhere;
  }
  .table-actions,
  .action-stack,
  .record-actions,
  .bulk-actions {
    gap: 5px !important;
  }
  .student-passport-thumb {
    height: 28px;
    width: 28px;
  }
}

@media screen and (max-width: 1180px) {
  .split,
  .three-col,
  .dashboard-grid,
  .dashboard-grid.lower,
  .analytics-grid,
  .analytics-grid.wide-left,
  .student-workspace,
  .payment-workspace,
  .inventory-workspace,
  .users-workspace,
  .results-workspace,
  .profile-record-grid,
  .result-lower-grid {
    grid-template-columns: 1fr !important;
  }
  .settings-tiles,
  .dashboard-feature-grid,
  .profile-summary-grid,
  .kpi-grid,
  .payment-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media screen and (max-width: 760px) {
  .page-hero,
  .dashboard-hero,
  .filters,
  .records-filter,
  .panel-title,
  .hero-actions,
  .bulk-actions,
  .record-actions,
  .table-toolbar,
  .table-pager,
  .table-nav-bar {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr !important;
  }
  .settings-tiles,
  .dashboard-feature-grid,
  .profile-summary-grid,
  .kpi-grid,
  .kpi-grid.compact,
  .payment-kpi-grid,
  .form-grid,
  .statement-list,
  .result-quick-links,
  .fee-quick-links,
  .payment-quick-links,
  .payroll-quick-links,
  .student-quick-links,
  .outstanding-quick-links {
    grid-template-columns: 1fr !important;
  }
  .filters label,
  .filters button,
  .records-filter label,
  .records-filter button,
  .hero-actions .button,
  .record-actions .button,
  .bulk-actions label,
  .bulk-actions button,
  .action-stack .button,
  .action-stack button,
  .action-stack form,
  .table-toolbar label,
  .table-pager button,
  .table-nav-bar .button {
    width: 100% !important;
  }
  .table-shell table,
  .table-scroll table,
  .profile-table,
  .managed-table,
  .records-panel > table,
  .panel > table {
    min-width: 680px;
  }
}

@media screen and (max-width: 520px) {
  body {
    font-size: 12px;
  }
  .content:not(.login-page) {
    padding: 9px !important;
  }
  .page-hero,
  .dashboard-hero,
  .panel,
  .records-panel,
  .detail-panel {
    padding: 9px !important;
  }
  .page-hero h1,
  .dashboard-hero h1,
  .content > h1 {
    font-size: 20px !important;
  }
  th,
  td,
  .profile-table th,
  .profile-table td,
  .managed-table th,
  .managed-table td {
    font-size: 11px !important;
    padding: 6px !important;
  }
  .student-passport-thumb {
    height: 24px;
    width: 24px;
  }
}

/* Settings scaffold */
.settings-scaffold {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: 260px minmax(0, 1fr);
  margin-top: 12px;
  max-width: 100%;
}

.settings-scaffold.is-collapsed {
  grid-template-columns: 66px minmax(0, 1fr);
}

.settings-scaffold-nav {
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .08);
  max-width: 100%;
  overflow: hidden;
  padding: 10px;
  position: sticky;
  top: 82px;
}

.settings-scaffold-toggle {
  align-items: center;
  background: linear-gradient(135deg, rgba(15, 23, 42, .98), rgba(30, 64, 175, .94));
  border: 0;
  border-radius: 10px;
  color: #fff;
  display: grid;
  gap: 8px;
  grid-template-columns: 30px minmax(0, 1fr) 20px;
  min-height: 42px !important;
  padding: 8px !important;
  text-align: left;
  width: 100%;
}

.settings-scaffold-toggle .icon {
  background: rgba(255, 255, 255, .14);
  border-radius: 8px;
  height: 30px;
  padding: 7px;
  width: 30px;
}

.settings-scaffold-title {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.settings-scaffold-title strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-scaffold-title small {
  color: rgba(255, 255, 255, .76);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-scaffold-arrow {
  align-items: center;
  background: rgba(255, 255, 255, .16);
  border-radius: 999px;
  display: inline-flex;
  font-size: 18px;
  height: 20px;
  justify-content: center;
  line-height: 1;
  transition: transform .18s ease;
  width: 20px;
}

.settings-scaffold-nav nav {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.settings-scaffold-nav a {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #334155;
  display: grid;
  gap: 8px;
  grid-template-columns: 30px minmax(0, 1fr);
  min-width: 0;
  padding: 8px;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.settings-scaffold-nav a:hover,
.settings-scaffold-nav a:focus-visible {
  background: rgba(37, 99, 235, .08);
  border-color: rgba(37, 99, 235, .18);
  color: #1d4ed8;
  transform: translateX(2px);
}

.settings-scaffold-nav a .icon {
  background: linear-gradient(135deg, #2563eb, #0891b2);
  border-radius: 8px;
  color: #fff;
  height: 30px;
  padding: 7px;
  width: 30px;
}

.settings-scaffold-nav a span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.settings-scaffold-nav a strong,
.settings-scaffold-nav a small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-scaffold-nav a strong {
  font-size: 12px;
}

.settings-scaffold-nav a small {
  color: #64748b;
  font-size: 10.5px;
}

.settings-scaffold-content {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.settings-section-wide {
  grid-column: 1 / -1;
}

.settings-section-card {
  scroll-margin-top: 90px;
}

.settings-section-card .panel-title {
  border-bottom: 1px solid rgba(15, 23, 42, .08);
  margin-bottom: 2px;
  padding-bottom: 8px;
}

.settings-scaffold.is-collapsed .settings-scaffold-nav {
  padding: 8px;
}

.settings-scaffold.is-collapsed .settings-scaffold-toggle {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 8px !important;
}

.settings-scaffold.is-collapsed .settings-scaffold-title,
.settings-scaffold.is-collapsed .settings-scaffold-arrow,
.settings-scaffold.is-collapsed .settings-scaffold-nav a span {
  display: none;
}

.settings-scaffold.is-collapsed .settings-scaffold-nav nav {
  margin-top: 7px;
}

.settings-scaffold.is-collapsed .settings-scaffold-nav a {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 7px;
}

.settings-scaffold.is-collapsed .settings-scaffold-nav a .icon {
  height: 28px;
  padding: 6px;
  width: 28px;
}

.settings-scaffold:not(.is-collapsed) .settings-scaffold-arrow {
  transform: rotate(0deg);
}

.settings-scaffold.is-collapsed .settings-scaffold-arrow {
  transform: rotate(180deg);
}

@media screen and (max-width: 1180px) {
  .settings-scaffold {
    grid-template-columns: 1fr;
  }

  .settings-scaffold.is-collapsed {
    grid-template-columns: 1fr;
  }

  .settings-scaffold-nav {
    position: static;
  }

  .settings-scaffold-nav nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .settings-scaffold-nav a:hover,
  .settings-scaffold-nav a:focus-visible {
    transform: translateY(-1px);
  }
}

@media screen and (max-width: 760px) {
  .settings-scaffold {
    gap: 9px;
  }

  .settings-scaffold-nav {
    margin-inline: -2px;
    overflow-x: auto;
  }

  .settings-scaffold-toggle {
    grid-template-columns: 26px minmax(0, 1fr) 20px;
    position: sticky;
    left: 0;
  }

  .settings-scaffold-nav nav {
    display: flex;
    gap: 7px;
    min-width: max-content;
  }

  .settings-scaffold-nav a {
    grid-template-columns: 26px minmax(112px, 1fr);
    padding: 7px;
    width: 160px;
  }

  .settings-scaffold-nav a .icon {
    height: 26px;
    padding: 6px;
    width: 26px;
  }

  .settings-section-card {
    scroll-margin-top: 16px;
  }

  .settings-scaffold-content {
    grid-template-columns: 1fr;
  }

  .settings-scaffold.is-collapsed .settings-scaffold-toggle {
    grid-template-columns: 26px minmax(0, 1fr) 20px;
    justify-items: stretch;
  }

  .settings-scaffold.is-collapsed .settings-scaffold-title,
  .settings-scaffold.is-collapsed .settings-scaffold-arrow {
    display: grid;
  }

  .settings-scaffold.is-collapsed .settings-scaffold-arrow {
    display: inline-flex;
  }

  .settings-scaffold.is-collapsed .settings-scaffold-nav nav {
    display: none;
  }
}
