/* ==========================================================================
   School Management System - application shell
   Navy sidebar + royal-blue primary, soft tinted cards. Light / Dark / Auto.
   Every module inherits these tokens; change colours here, nowhere else.
   ========================================================================== */

@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/poppins-700.woff2") format("woff2"); }

:root {
  /* surfaces */
  --bg:            #F3F7FD;
  --surface:       #FFFFFF;
  --surface-2:     #F5F8FE;
  --header-bg:     rgba(243, 247, 253, .88);
  --border:        #E4EAF4;
  --border-strong: #D3DCEA;

  /* ink */
  --text:       #0E1C45;
  --text-muted: #5B6987;
  --text-faint: #95A1BA;

  /* primary (kept under the old --accent names so every module follows) */
  --accent:       #1F6FEB;
  --accent-2:     #2F80FF;
  --accent-hover: #1858C9;
  --accent-soft:  #EAF2FF;
  --accent-text:  #1A5FD8;
  --on-accent:    #FFFFFF;

  /* sidebar */
  --sidebar-from:   #0A2463;
  --sidebar-to:     #0D3486;
  --sidebar-text:   rgba(255, 255, 255, .80);
  --sidebar-hover:  rgba(255, 255, 255, .08);
  --sidebar-active: linear-gradient(90deg, #3A82FF 0%, #2463EB 100%);

  /* status */
  --success:      #0E9F6E;
  --success-soft: #E6F7F0;
  --danger:       #E5484D;
  --danger-soft:  #FDECEC;
  --warning:      #D97706;
  --warning-soft: #FFF4E2;
  --info:         #1F6FEB;

  /* KPI tints: card wash / icon gradient */
  --tint-blue:     #EEF5FF; --icon-blue:   linear-gradient(135deg, #5B9BFF, #2563EB);
  --tint-green:    #EAF8F2; --icon-green:  linear-gradient(135deg, #3ED3A0, #0E9F6E);
  --tint-purple:   #F3EFFF; --icon-purple: linear-gradient(135deg, #A98BFF, #7C5CF2);
  --tint-orange:   #FFF5E9; --icon-orange: linear-gradient(135deg, #FFBE5C, #F59312);
  --tint-pink:     #FFEFF2; --icon-pink:   linear-gradient(135deg, #FF8FA3, #E5484D);

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(14, 38, 94, .04), 0 4px 14px rgba(14, 38, 94, .05);
  --shadow-md: 0 10px 28px rgba(14, 38, 94, .12);

  --sidebar-w:           260px;
  --sidebar-w-collapsed: 76px;
  --header-h:            68px;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg:            #0A1120;
  --surface:       #111A2D;
  --surface-2:     #16213A;
  --header-bg:     rgba(10, 17, 32, .88);
  --border:        #1F2C49;
  --border-strong: #2B3A5C;

  --text:       #E6ECF8;
  --text-muted: #9AA8C6;
  --text-faint: #6B7A99;

  --accent:       #4C8DFF;
  --accent-2:     #6AA2FF;
  --accent-hover: #6AA2FF;
  --accent-soft:  #15284D;
  --accent-text:  #8DB8FF;
  --on-accent:    #FFFFFF;

  --sidebar-from:   #06122E;
  --sidebar-to:     #0A1E4B;

  --success:      #2FBF8F;
  --success-soft: #0F2E28;
  --danger:       #F06B6F;
  --danger-soft:  #3A1A22;
  --warning:      #F0A53A;
  --warning-soft: #33250F;
  --info:         #4C8DFF;

  --tint-blue:   #13223F;
  --tint-green:  #102A27;
  --tint-purple: #1E1A3D;
  --tint-orange: #2E2214;
  --tint-pink:   #33182A;

  --shadow:    0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, .5);

  color-scheme: dark;
}

/* --------------------------------------------------------------- base --- */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 600; letter-spacing: -.01em; }

code { color: var(--accent-text); }

.text-muted { color: var(--text-muted) !important; }
.text-faint { color: var(--text-faint); }
.text-danger { color: var(--danger) !important; }

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ------------------------------------------------------------ sidebar --- */

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1045;
  transition: width .18s ease, transform .22s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  color: #fff;
}

.sidebar-brand:hover { color: #fff; }

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.brand-mark img { width: 34px; height: 34px; object-fit: contain; }

.brand-text { min-width: 0; display: flex; flex-direction: column; }

.brand-name {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.25;
  color: rgba(255, 255, 255, .85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 14px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 6px; }

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 3px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sidebar-text);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}

.nav-link-item > i:first-child {
  font-size: 18px;
  flex: 0 0 22px;
  text-align: center;
}

.nav-link-item:hover { background: var(--sidebar-hover); color: #fff; }

.nav-link-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(31, 99, 235, .35);
}

.nav-chevron {
  margin-left: auto;
  font-size: 12px;
  opacity: .75;
  transition: transform .18s ease;
}

.nav-group.open > .nav-group-toggle .nav-chevron { transform: rotate(180deg); }
.nav-group.has-active > .nav-group-toggle { color: #fff; }

.nav-sub {
  display: none;
  margin: -2px 0 6px 25px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, .14);
}

.nav-group.open > .nav-sub { display: block; }

.nav-sub-item {
  display: block;
  padding: 7px 12px;
  margin-bottom: 2px;
  border-radius: 9px;
  color: rgba(255, 255, 255, .70);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-sub-item:hover { color: #fff; background: var(--sidebar-hover); }

.nav-sub-item.active {
  color: #fff;
  font-weight: 600;
  background: rgba(58, 130, 255, .35);
}

/* bottom poster */
.sidebar-poster {
  position: relative;
  margin: auto 0 2px;
  height: 196px;
  flex: 0 0 auto;
  border-radius: 16px;
  overflow: hidden;
  background: #8EC5FF;
}

.sidebar-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.sidebar-poster-text {
  position: absolute;
  top: 16px;
  left: 18px;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  text-shadow: 0 2px 6px rgba(10, 36, 99, .35);
}

.sidebar-poster-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 7px 16px;
  color: #fff;
  font-size: 12.5px;
  text-align: center;
  background: linear-gradient(0deg, rgba(10, 36, 99, .75), rgba(10, 36, 99, 0));
}

/* keep a little air between the last menu row and the poster */
.sidebar-scroll > .nav-link-item:last-of-type, .sidebar-scroll > .nav-group:last-of-type { margin-bottom: 14px; }

/* collapsed state, desktop only */
body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-main    { margin-left: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-link-item span,
body.sidebar-collapsed .nav-chevron,
body.sidebar-collapsed .nav-sub,
body.sidebar-collapsed .sidebar-poster { display: none; }
body.sidebar-collapsed .sidebar-scroll { padding-left: 10px; padding-right: 10px; }
body.sidebar-collapsed .nav-link-item { justify-content: center; padding: 11px; }
body.sidebar-collapsed .nav-group.has-active > .nav-group-toggle { background: var(--sidebar-active); }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }

/* ------------------------------------------------------------- header --- */

.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left .18s ease;
}

.app-header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  z-index: 1030;
}

.header-search {
  position: relative;
  max-width: 540px;
  flex: 1 1 280px;
}

.header-search i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 16px;
  pointer-events: none;
}

.header-search input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow);
}

.header-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 19px;
  position: relative;
}

.icon-btn:hover { background: var(--surface-2); color: var(--accent-text); }

.icon-btn-plain { border-color: transparent; background: transparent; }
.icon-btn-plain:hover { background: var(--surface); }

.icon-btn .badge {
  font-size: 10px;
  padding: 3px 5px;
  min-width: 18px;
  border: 2px solid var(--bg);
}

.icon-btn .badge-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
}

.header-divider { width: 1px; height: 32px; background: var(--border-strong); margin: 0 6px; }

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.header-user:hover { background: var(--surface); }
.header-user-meta { line-height: 1.25; }
.header-user-name { display: block; font-weight: 600; font-size: 14.5px; }
.header-user-role { display: block; font-size: 12.5px; color: var(--text-muted); }
.header-user-chevron { color: var(--text-muted); font-size: 13px; margin-left: 4px; }

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3A82FF, #1B4FCB);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 600;
  object-fit: cover;
}

.avatar-lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 15px; box-shadow: 0 0 0 3px var(--surface); }

.app-content { padding: 18px 26px 40px; }

.page-heading h1 { font-weight: 700; }

.dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  padding: 6px;
  color: var(--text);
}

.dropdown-item { border-radius: 8px; color: var(--text); padding: 8px 10px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--accent-soft); color: var(--accent-text); }
.dropdown-divider { border-color: var(--border); }
.dropdown-header { color: var(--text-faint); font-weight: 600; }

.theme-switch {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.theme-switch button {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  width: 34px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 13px;
}

.theme-switch button.active { background: var(--accent); color: var(--on-accent); }

/* -------------------------------------------------------------- cards --- */

.card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-soft .card-body { padding: 20px; }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.stat-icon.blue   { background: var(--accent-soft);  color: var(--accent-text); }
.stat-icon.green  { background: var(--success-soft); color: var(--success); }
.stat-icon.red    { background: var(--danger-soft);  color: var(--danger); }
.stat-icon.amber,
.stat-icon.orange { background: var(--warning-soft); color: var(--warning); }
.stat-icon.purple { background: var(--tint-purple);  color: #7C5CF2; }

/* ------------------------------------------------------ form controls --- */

.form-label { font-weight: 500; font-size: 13px; color: var(--text); margin-bottom: 5px; }
.form-text { color: var(--text-muted); }

.form-control, .form-select {
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
}

.form-control:focus, .form-select:focus {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-control::placeholder { color: var(--text-faint); }
.form-control:disabled, .form-control[readonly] { background-color: var(--surface-2); }

.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px; padding: 9px 16px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }

.btn-accent {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border: 1px solid var(--accent);
  color: var(--on-accent);
  box-shadow: 0 4px 12px rgba(31, 111, 235, .22);
}

.btn-accent:hover, .btn-accent:focus, .btn-accent:active {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

.btn-soft {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-soft:hover, .btn-soft:focus { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-text); }

/* ------------------------------------------------------------- tables --- */

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.table-clean { margin: 0; color: var(--text); width: 100%; border-collapse: collapse; }

.table-clean > thead > tr > th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 12px 14px;
  white-space: nowrap;
  text-align: left;
}

.table-clean > tbody > tr > td {
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  vertical-align: middle;
}

.table-clean > tbody > tr:last-child > td { border-bottom: 0; }
.table-clean > tbody > tr:hover > td { background: var(--surface-2); }

.table { --bs-table-bg: transparent; --bs-table-color: var(--text); border-color: var(--border); }

/* ------------------------------------------------- bootstrap overrides --- */

.alert { border-radius: 12px; border-width: 1px; }
.alert-info    { background: var(--accent-soft);  border-color: transparent; color: var(--accent-text); }
.alert-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.alert-warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.alert-danger  { background: var(--danger-soft);  border-color: transparent; color: var(--danger); }

.badge.bg-primary, .text-bg-primary { background-color: var(--accent) !important; }

.pagination { --bs-pagination-color: var(--accent-text); --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border);
  --bs-pagination-hover-bg: var(--accent-soft); --bs-pagination-hover-color: var(--accent-text); --bs-pagination-hover-border-color: var(--border);
  --bs-pagination-active-bg: var(--accent); --bs-pagination-active-border-color: var(--accent);
  --bs-pagination-disabled-bg: var(--surface-2); --bs-pagination-disabled-color: var(--text-faint); --bs-pagination-disabled-border-color: var(--border);
  --bs-pagination-focus-box-shadow: 0 0 0 4px var(--accent-soft); }

.nav-tabs { border-color: var(--border); }
.nav-tabs .nav-link { color: var(--text-muted); border-radius: 10px 10px 0 0; font-weight: 500; }
.nav-tabs .nav-link:hover { color: var(--accent-text); border-color: transparent; }
.nav-tabs .nav-link.active { color: var(--accent-text); background: var(--surface); border-color: var(--border) var(--border) var(--surface); border-bottom: 2px solid var(--accent); }

.modal-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.modal-header, .modal-footer { border-color: var(--border); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* --------------------------------------------------------------- misc --- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.pill.green  { background: var(--success-soft); color: var(--success); }
.pill.red    { background: var(--danger-soft);  color: var(--danger); }
.pill.amber  { background: var(--warning-soft); color: var(--warning); }
.pill.blue   { background: var(--accent-soft);  color: var(--accent-text); }
.pill.gray   { background: var(--surface-2);    color: var(--text-muted); }

.empty-state { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.empty-state > i { font-size: 30px; color: var(--text-faint); display: block; margin-bottom: 10px; }

.toast-stack {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-faint);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toast-in .2s ease;
}

.toast-item.success { border-left-color: var(--success); }
.toast-item.error   { border-left-color: var(--danger); }
.toast-item.warning { border-left-color: var(--warning); }
.toast-item.info    { border-left-color: var(--info); }
.toast-item.success > i { color: var(--success); }
.toast-item.error   > i { color: var(--danger); }
.toast-item.warning > i { color: var(--warning); }
.toast-item.info    > i { color: var(--info); }
.toast-item.hide    { opacity: 0; transform: translateX(12px); transition: .25s ease; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: none; }
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 18, 46, .5);
  z-index: 1040;
  display: none;
}

body.sidebar-open .sidebar-backdrop { display: block; }

/* ==========================================================================
   Dashboard
   Two modes:
   - flow (default, small screens): cards stack and the page scrolls;
   - fit  (>= 1600 x 860): the whole dashboard fills exactly one screen.
     Rows share the height by weight, charts stretch with their card, and
     lists hide the rows that do not fit (assets/js/dashboard.js).
   ========================================================================== */

.dash-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 540px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: -18px -26px 16px;
  padding: 14px 26px 0;
  min-height: 150px;
  background:
    radial-gradient(1200px 260px at 70% -40%, #D8E9FF 0%, rgba(216, 233, 255, 0) 70%),
    linear-gradient(180deg, #EAF3FF 0%, var(--bg) 100%);
}

[data-theme="dark"] .dash-hero {
  background:
    radial-gradient(1200px 260px at 70% -40%, #16305F 0%, rgba(22, 48, 95, 0) 70%),
    linear-gradient(180deg, #0E1C38 0%, var(--bg) 100%);
}

.dash-hero-text { padding-bottom: 14px; min-width: 0; }
.dash-hero h1 { font-size: 30px; font-weight: 700; margin: 0 0 4px; }
.dash-hero h1 span { color: var(--accent); }
.dash-hero p { color: var(--text-muted); font-size: 15px; margin: 0; }

.dash-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dash-quick .btn { box-shadow: var(--shadow); }

.dash-hero-art {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  height: 150px;
}

.dash-hero-art img { height: 100%; width: auto; max-width: 68%; object-fit: contain; object-position: center bottom; }

.dash-hero-quote {
  flex: 0 1 220px;
  padding-top: 14px;
  text-align: right;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.35;
  color: var(--text);
}

.dash-hero-date {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  text-align: right;
}

.dash-hero-date strong { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; }
.dash-hero-date span { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

.dash-hero-date .cal-btn {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 23px;
  box-shadow: var(--shadow);
}

/* grid: content + 300px right rail */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.dash-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-row  { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* KPI tiles */
.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--surface);
  color: var(--text);
  min-width: 0;
}

a.kpi-card:hover { color: var(--text); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card.blue   { background: linear-gradient(135deg, var(--tint-blue) 0%, var(--surface) 90%); }
.kpi-card.green  { background: linear-gradient(135deg, var(--tint-green) 0%, var(--surface) 90%); }
.kpi-card.purple { background: linear-gradient(135deg, var(--tint-purple) 0%, var(--surface) 90%); }
.kpi-card.orange { background: linear-gradient(135deg, var(--tint-orange) 0%, var(--surface) 90%); }
.kpi-card.needs-action { border-color: rgba(229, 72, 77, .45); }

.kpi-icon {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 26px;
  box-shadow: 0 8px 18px rgba(14, 38, 94, .14);
}

.kpi-card.blue   .kpi-icon { background: var(--icon-blue); }
.kpi-card.green  .kpi-icon { background: var(--icon-green); }
.kpi-card.purple .kpi-icon { background: var(--icon-purple); }
.kpi-card.orange .kpi-icon { background: var(--icon-orange); }

.kpi-body { display: block; min-width: 0; }
.kpi-label { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-row { display: flex; align-items: center; gap: 12px; }
.kpi-value { font-size: 27px; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.kpi-delta { font-size: 11.5px; line-height: 1.3; color: var(--text-muted); min-width: 0; }
.kpi-delta b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.kpi-delta .up   { color: var(--success); }
.kpi-delta .down { color: var(--danger); }
.kpi-delta .flat { color: var(--text-muted); }

/* generic dashboard card */
.dash-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 18px;
  min-width: 0;
}

.dash-card-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.dash-card-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-card-head h2 i { font-size: 19px; flex: 0 0 auto; }
.dash-card-head h2 i.blue   { color: var(--accent); }
.dash-card-head h2 i.green  { color: var(--success); }
.dash-card-head h2 i.purple { color: #7C5CF2; }
.dash-card-head h2 i.orange { color: #F59312; }
.dash-card-head h2 i.red    { color: var(--danger); }

.dash-link { font-size: 12.5px; font-weight: 500; white-space: nowrap; }

.mini-select {
  height: 30px;
  padding: 0 22px 0 8px;
  font-size: 11.5px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  background-position: right 6px center;
  background-size: 12px 9px;
  color: var(--text);
  width: auto;
}

.dash-card .empty-state { padding: 14px 8px; font-size: 13px; margin: auto 0; }
.dash-card .empty-state > i { font-size: 24px; margin-bottom: 6px; }

/* attendance donut */
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-box { position: relative; width: 150px; height: 150px; flex: 0 0 auto; container-type: size; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center strong { font-size: clamp(15px, 16cqh, 25px); font-weight: 700; line-height: 1.1; }
.donut-center span { font-size: clamp(10px, 8.5cqh, 12.5px); color: var(--text-muted); }

.legend-list { list-style: none; padding: 0; margin: 0; flex: 1 0 112px; display: grid; gap: 10px; min-width: 0; }
.legend-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-list li b { margin-left: auto; font-weight: 600; }
.legend-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px; }

/* fee headline */
.fee-head { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 16px; margin-bottom: 6px; }
.fee-head .amount { font-size: 21px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.fee-head .rate { font-size: 21px; font-weight: 700; line-height: 1.2; color: var(--success); padding-left: 16px; border-left: 1px solid var(--border); }
.fee-head small { display: block; font-size: 12px; color: var(--text-muted); font-weight: 400; }

.chart-box { position: relative; height: 170px; min-height: 0; }

/* rows used by exams, events, announcements, top students */
.list-rows { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }

.list-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  min-width: 0;
}

.list-row:last-child { border-bottom: 0; }
a.list-row:hover { color: var(--text); background: var(--surface-2); }
.list-row .meta, .activity-item .meta { min-width: 0; flex: 1 1 auto; }
.list-row .meta strong { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .meta span { display: block; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.date-chip {
  width: 42px;
  flex: 0 0 42px;
  padding: 4px 0;
  border-radius: 10px;
  text-align: center;
  line-height: 1.05;
}

.date-chip b { display: block; font-size: 16px; font-weight: 700; }
.date-chip small { display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.date-chip.red    { background: var(--danger-soft);  color: var(--danger); }
.date-chip.blue   { background: var(--accent-soft);  color: var(--accent-text); }
.date-chip.orange { background: var(--warning-soft); color: var(--warning); }
.date-chip.purple { background: var(--tint-purple);  color: #7C5CF2; }
.date-chip.green  { background: var(--success-soft); color: var(--success); }

.due-pill {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-text);
  white-space: nowrap;
}

.due-pill.red { background: var(--danger-soft); color: var(--danger); }

.round-icon, .rank-badge {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.round-icon.blue   { background: var(--accent-soft);  color: var(--accent); }
.round-icon.green  { background: var(--success-soft); color: var(--success); }
.round-icon.purple { background: var(--tint-purple);  color: #7C5CF2; }
.round-icon.orange { background: var(--warning-soft); color: #F59312; }
.round-icon.red    { background: var(--danger-soft);  color: var(--danger); }

.rank-badge { font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-muted); }
.rank-badge.r1 { background: var(--icon-orange); color: #fff; }
.rank-badge.r2 { background: var(--accent-soft); color: var(--accent-text); }
.rank-badge.r3 { background: var(--tint-purple); color: #7C5CF2; }

/* timetable */
.tt-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.tt-row:last-child { border-bottom: 0; }
.tt-time { padding: 4px 7px; border-radius: 8px; font-weight: 600; font-size: 12px; border-left: 4px solid; white-space: nowrap; }
.tt-time.c0 { background: var(--warning-soft); border-color: #F59312; }
.tt-time.c1 { background: var(--success-soft); border-color: var(--success); }
.tt-time.c2 { background: var(--danger-soft);  border-color: var(--danger); }
.tt-time.c3 { background: var(--accent-soft);  border-color: var(--accent); }
.tt-subject { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-row .muted { color: var(--text-muted); white-space: nowrap; }
.tt-row .tt-room { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }

/* mini calendar */
.mini-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mini-cal-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.mini-cal-nav { display: flex; gap: 4px; }
.mini-cal-nav a { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--text); }
.mini-cal-nav a:hover { background: var(--accent-soft); color: var(--accent-text); }

.mini-cal { width: 100%; border-collapse: collapse; text-align: center; table-layout: fixed; }
.mini-cal th { font-size: 11px; font-weight: 500; color: var(--text-muted); padding: 2px 0 5px; }
.mini-cal td { padding: 1px 0; font-size: 12.5px; }
.mini-cal td span { position: relative; display: inline-grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; }
.mini-cal td.out span { color: var(--text-faint); }
.mini-cal td.today span { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 4px 10px rgba(31, 111, 235, .35); }
.mini-cal td.event span::after { content: ""; position: absolute; bottom: 2px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--warning); }
.mini-cal td.today.event span::after { background: #fff; }

/* recent activity */
.activity-item { display: flex; gap: 11px; align-items: center; padding: 6px 0; }
.activity-item .meta strong { display: block; font-size: 12.5px; font-weight: 500; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-item .meta span { display: block; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* big-number tiles (admissions, library) */
.big-stat { display: flex; align-items: center; gap: 14px; min-width: 0; margin: auto 0; }
.big-stat-art { width: 64px; height: 60px; flex: 0 0 64px; border-radius: 14px; display: grid; place-items: center; font-size: 30px; }
.big-stat-art.blue   { background: var(--accent-soft);  color: var(--accent); }
.big-stat-art.green  { background: var(--success-soft); color: var(--success); }
.big-stat-value { font-size: 30px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.big-stat-label { font-size: 12.5px; line-height: 1.35; color: var(--text-muted); }
.big-stat-side { margin-left: auto; text-align: right; font-size: 12.5px; white-space: nowrap; }
.status-list { list-style: none; margin: 0 0 0 auto; padding: 0 0 0 14px; border-left: 1px solid var(--border); display: grid; gap: 6px; font-size: 12.5px; }
.status-list li { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.status-list li b { min-width: 18px; font-weight: 600; }

.trend-up   { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger);  font-weight: 600; }

/* users & roles: inline password reset */
.user-reset > summary { list-style: none; }
.user-reset > summary::-webkit-details-marker { display: none; }
.user-reset-form { display: flex; gap: 6px; margin-top: 6px; min-width: 260px; }

/* search results page */
.search-group + .search-group { margin-top: 18px; }

/* ---------------------------------------------------- one-screen mode --- */
/* The dashboard is designed for a 1360 x 839 content area. dashboard.js turns
   this mode on for laptops and PCs and scales the page (CSS zoom) so that
   design fits the real screen - 1366x768, 1536x864 (125%/250% scaling),
   1920x1080 alike. Phones, tablets and very small windows keep the normal
   scrolling layout. */

.dash-page { container: dash / inline-size; }

body.dash-fit .app-content { padding-bottom: 16px; }

/* dashboard.js sets the zoom (--dz) and the height of .dash-page */
body.dash-fit .dash-page { display: flex; flex-direction: column; }

body.dash-fit .dash-hero {
  flex: 0 0 auto;
  min-height: 0;
  height: 132px;
  margin: calc(-18px / var(--dz, 1)) calc(-26px / var(--dz, 1)) 14px;
  padding: 12px calc(26px / var(--dz, 1)) 0;
}
body.dash-fit .dash-hero-art { height: 120px; align-self: end; }
body.dash-fit .dash-hero-text { padding-bottom: 10px; }
body.dash-fit .dash-hero h1 { font-size: 28px; }
body.dash-fit .dash-quick { margin-top: 10px; }
body.dash-fit .dash-grid { flex: 1 1 auto; min-height: 0; gap: 14px; align-items: stretch; }

body.dash-fit .dash-main,
body.dash-fit .dash-rail { height: 100%; min-height: 0; gap: 14px; }

body.dash-fit .dash-kpis { flex: 0 0 auto; gap: 14px; }

body.dash-fit .dash-row {
  min-height: 0;
  gap: 14px;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

body.dash-fit .dash-row-1 { flex: 1.08 1 0; }
body.dash-fit .dash-row-2 { flex: 1 1 0; }
body.dash-fit .dash-row-3 { flex: 1 1 0; }

/* compact rows so three items fit in each list card */
body.dash-fit .dash-card { padding: 11px 16px; }
body.dash-fit .dash-card-head { margin-bottom: 5px; }
body.dash-fit .list-row .meta strong,
body.dash-fit .activity-item .meta strong { line-height: 1.3; }
body.dash-fit .list-row .meta span,
body.dash-fit .activity-item .meta span { line-height: 1.3; }
body.dash-fit .list-row,
body.dash-fit .tt-row { padding: 4px 0; }
body.dash-fit .activity-item { padding: 4px 0; }
body.dash-fit .round-icon,
body.dash-fit .rank-badge { width: 31px; height: 31px; flex-basis: 31px; font-size: 14px; border-radius: 10px; }
body.dash-fit .date-chip { padding: 2px 0; width: 38px; flex-basis: 38px; }
body.dash-fit .date-chip b { font-size: 14.5px; }
body.dash-fit .mini-cal td span { width: 27px; height: 27px; }
body.dash-fit .mini-cal-head { margin-bottom: 2px; }

body.dash-fit .dash-card { min-height: 0; overflow: hidden; }
body.dash-fit .chart-box { flex: 1 1 auto; height: auto; }
body.dash-fit .donut-wrap { flex: 1 1 auto; min-height: 0; }
body.dash-fit .donut-box { width: auto; height: 100%; max-height: 150px; max-width: calc(100% - 128px); aspect-ratio: 1; }
body.dash-fit .tt-row { grid-template-columns: 100px minmax(0, 1fr) auto; }
body.dash-fit .tt-row .tt-room { display: none; }
body.dash-fit .fit-list { flex: 1 1 auto; min-height: 0; overflow: hidden; }

body.dash-fit .rail-calendar { flex: 0 0 auto; }
body.dash-fit .dash-rail > .dash-card:not(.rail-calendar) { flex: 1 1 0; }

/* --------------------------------------------------------- responsive --- */

@container dash (max-width: 1287px) {
  .dash-hero-quote { display: none; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

@container dash (max-width: 887px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-hero { grid-template-columns: minmax(0, 1fr) auto; }
  .dash-hero-art { display: none; }
}

@container dash (max-width: 600px) {
  .dash-hero { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .dash-hero-date { justify-content: flex-end; flex-direction: row-reverse; text-align: left; }
  .dash-hero h1 { font-size: 24px; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut-box { margin: 0 auto; }
  .tt-row { grid-template-columns: 100px minmax(0, 1fr) auto; }
  .tt-row .tt-room { display: none; }
}

@container dash (max-width: 547px) {
  .dash-kpis { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 24px; }
  .big-stat { flex-wrap: wrap; }
  .status-list { margin-left: 0; border-left: 0; padding-left: 0; }
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
  body.sidebar-open .app-sidebar { transform: none; }
  .app-main { margin-left: 0; }
  body.sidebar-collapsed .app-main { margin-left: 0; }
  body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w); }
  body.sidebar-collapsed .brand-text { display: flex; }
  body.sidebar-collapsed .nav-link-item span,
  body.sidebar-collapsed .nav-chevron,
  body.sidebar-collapsed .sidebar-poster { display: revert; }
  body.sidebar-collapsed .nav-group.open > .nav-sub { display: block; }
  body.sidebar-collapsed .nav-link-item { justify-content: flex-start; padding: 10px 14px; }
  body.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding-left: 20px; padding-right: 20px; }
  .app-content { padding: 14px 14px 32px; }
  .app-header { padding: 0 14px; }
  .dash-hero { margin: -14px -14px 14px; padding: 18px 14px 4px; }
  .toast-stack { right: 12px; left: 12px; max-width: none; }
}

@media (max-width: 575.98px) {
  .header-search { display: none; }
}

/* short laptop screens: a tighter sidebar and header so the menu needs less scrolling */
@media (min-width: 992px) and (max-height: 780px) {
  :root { --header-h: 60px; }
  .sidebar-brand { padding: 14px 20px 12px; }
  .brand-mark { width: 38px; height: 38px; flex-basis: 38px; font-size: 19px; }
  .nav-link-item { padding: 8px 14px; font-size: 14px; margin-bottom: 2px; }
  .nav-sub-item { padding: 5px 12px; }
  .header-search input { height: 40px; }
  .avatar-lg { width: 40px; height: 40px; flex-basis: 40px; }
}

/* -------------------------------------------------------------- print --- */

@media print {
  .app-sidebar, .app-header, .toast-stack, .sidebar-backdrop, .no-print { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 0 !important; }
  body { background: #fff; }
  .card-soft, .dash-card { border: 0; box-shadow: none; }
}
