/* ==========================================================
   KCSMS — Design System
   ========================================================== */
:root {
  --navy-900: #0a1a33;
  --navy-800: #12294f;
--navy-700: #1a3a6b;
  --blue-800: #143a8a;
  --blue-700: #1b49aa;
  --blue-600: #2158c9;
  --blue-500: #2f6fe4;
  --gold-500: #d4a72c;
  --gold-400: #e6bf4f;
  --green-600: #1a8f5e;
  --red-600: #d33f3f;
  --amber-600: #c8811a;
  --gray-50: #f5f7fb;
  --gray-100: #eef1f6;
  --gray-200: #e2e6ee;
  --gray-300: #cbd2e0;
  --gray-500: #7c869c;
  --gray-700: #3d4658;
  --gray-900: #1c2233;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08), 0 2px 6px rgba(15,23,42,.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .12);
  --ease: cubic-bezier(.4,0,.2,1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Semantic aliases used by the sidebar/topbar chrome (nav folders,
     dropdowns, dashboard cards) — point at the branding-driven tones
     above so the whole shell reacts to the school's brand colors. */
  --sp-primary: var(--navy-900);
  --sp-secondary: var(--gold-500);
  --sp-accent: var(--blue-600);
  --sp-success: var(--green-600);
  --sp-warning: var(--amber-600);
  --sp-danger: var(--red-600);
  --sp-surface: #fff;
  --sp-border: var(--gray-200);
  --sp-muted: var(--gray-500);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--gray-50);
  background-image: radial-gradient(circle at 0% 0%, rgba(47,111,228,.04), transparent 40%);
  color: var(--gray-900);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(47,111,228,.2); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 8px; color: var(--navy-900); font-weight: 700; }
p { margin: 0 0 12px; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 254px;
  flex-shrink: 0;
  background: linear-gradient(190deg, var(--navy-900), var(--navy-800) 65%, #0e2344);
  color: #dbe4f5;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 40;
  box-shadow: 2px 0 0 rgba(0,0,0,.03);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .logo-badge {
  width: 58px; height: 58px; flex: 0 0 58px; border-radius: 14px;
  background: #fff; padding: 5px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--navy-900); font-size: 17px;
  box-shadow: 0 5px 16px rgba(0,0,0,.22);
}
.school-logo-image { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 10px; }
.sidebar-brand .brand-text { font-weight: 700; color: #fff; font-size: 14.5px; line-height: 1.3; letter-spacing: -.01em; }
.sidebar-brand .brand-text small { display: block; font-weight: 600; color: var(--sp-secondary); font-size: 11px; letter-spacing: 0; margin-top: 1px; }

/* ---------- Sidebar: identity card ---------- */
.student-id-card {
  margin: 4px 18px 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 11px;
}
.student-id-card .sid-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 40px;
  background: linear-gradient(135deg, var(--sp-accent), var(--sp-primary));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; overflow: hidden;
}
.student-id-card .sid-avatar img { width: 100%; height: 100%; object-fit: cover; }
.student-id-card .sid-meta { min-width: 0; line-height: 1.3; }
.student-id-card .sid-name { color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-id-card .sid-sub { color: #a9bde3; font-size: 11px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Collapsible folder nav ---------- */
.nav-folder { margin-bottom: 2px; }
.nav-folder-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 9px 10px; border-radius: 8px; color: #c3d1ec;
  font-size: 13px; font-weight: 700; letter-spacing: -.005em;
  font-family: inherit;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-folder-toggle:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-folder-toggle .nf-icon { flex-shrink: 0; display: flex; opacity: .85; }
.nav-folder-toggle .nf-label { flex: 1; min-width: 0; }
.nav-folder-toggle .nf-chevron { flex-shrink: 0; transition: transform .2s var(--ease); opacity: .7; }
.nav-folder.open .nav-folder-toggle .nf-chevron { transform: rotate(180deg); }
.nav-folder.has-active .nav-folder-toggle { color: #fff; }
.nav-folder.has-active .nav-folder-toggle .nf-icon { color: var(--sp-secondary); opacity: 1; }

.nav-folder-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .22s var(--ease);
}
.nav-folder.open .nav-folder-body { grid-template-rows: 1fr; }
.nav-folder-body > div { overflow: hidden; }
.nav-folder-items { padding: 2px 4px 6px 30px; display: flex; flex-direction: column; gap: 1px; }

.nav-sublink {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 7px; color: #a9bde3;
  font-size: 13px; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-sublink:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav-sublink.active { background: rgba(255,255,255,.08); color: #fff; font-weight: 700; }
.nav-sublink.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 15px; background: var(--sp-secondary); border-radius: 3px;
}

/* ---------- Sidebar footer ---------- */
.sidebar-footer {
  margin-top: auto;
  padding: 10px 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer .nav-sublink { color: #c3d1ec; }
.sidebar-footer .nav-sublink.logout-link { color: #f3b3b3; }
.sidebar-footer .nav-sublink.logout-link:hover { background: rgba(211,63,63,.14); color: #ffd4d4; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--sp-muted); margin-top: 2px;
}
.breadcrumbs a { color: var(--sp-muted); }
.breadcrumbs a:hover { color: var(--sp-accent); }
.breadcrumbs .bc-sep { opacity: .5; }
.breadcrumbs .bc-current { color: var(--gray-900); font-weight: 600; }

/* ---------- Topbar: notifications + profile dropdown ---------- */
.topbar-icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--gray-700);
  transition: background .15s var(--ease);
}
.topbar-icon-btn:hover { background: var(--gray-100); }
.topbar-icon-btn .notif-count {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 3px;
  background: var(--sp-danger); color: #fff; border-radius: 20px;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

.dropdown-wrap { position: relative; }
.dropdown-panel {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px;
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
  display: none;
}
.dropdown-panel.open { display: block; }
.dropdown-panel a, .dropdown-panel button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border-radius: 7px; font-size: 13px; color: var(--gray-700);
  background: none; border: none; text-align: left; cursor: pointer; font-family: inherit;
}
.dropdown-panel a:hover, .dropdown-panel button:hover { background: var(--gray-100); text-decoration: none; }
.dropdown-panel .dd-danger { color: var(--sp-danger); }
.dropdown-panel .dd-sep { height: 1px; background: var(--gray-100); margin: 5px 2px; }

/* ---------- Mobile drawer backdrop ---------- */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(10,15,30,.45);
  z-index: 39; opacity: 0; transition: opacity .2s var(--ease);
}
@media (max-width: 960px) {
  .sidebar-backdrop.open { display: block; opacity: 1; }
}

/* ---------- Dashboard: quick actions ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.quick-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px; background: var(--sp-surface); border: 1px solid var(--sp-border);
  border-radius: var(--radius); transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease);
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: transparent; text-decoration: none; }
.quick-action .qa-icon {
  width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: rgba(33,88,201,.08); color: var(--sp-accent);
}
.quick-action .qa-label { font-size: 13px; font-weight: 700; color: var(--gray-900); }

/* Clickable dashboard summary card, built on the existing .stat-card */
a.stat-card-link { display: block; text-decoration: none; }
a.stat-card-link:hover { text-decoration: none; }
.stat-card .stat-cta { font-size: 11.5px; font-weight: 700; color: var(--sp-accent); margin-top: 8px; display: inline-flex; align-items: center; gap: 3px; }

/* ---------- Expandable dashboard section (Academic Performance) ---------- */
.dash-expand { margin-bottom: 20px; }
.dash-expand-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: none; border: none; cursor: pointer; font-family: inherit; padding: 0;
}
.dash-expand-toggle .de-title { font-size: 15px; font-weight: 700; color: var(--navy-900); }
.dash-expand-toggle .de-chevron { transition: transform .2s var(--ease); color: var(--sp-muted); }
.dash-expand.open .dash-expand-toggle .de-chevron { transform: rotate(180deg); }
.dash-expand-body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .22s var(--ease);
}
.dash-expand.open .dash-expand-body { grid-template-rows: 1fr; }
.dash-expand-body > div { overflow: hidden; }
.dash-expand-body .card-body { padding-top: 16px; }

/* ---------- Greeting header ---------- */
.portal-greeting { margin-bottom: 22px; }
.portal-greeting h1 { font-size: 22px; margin-bottom: 4px; }
.portal-greeting .pg-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--sp-muted); font-size: 13px; }
.portal-greeting .pg-meta .badge { font-size: 10.5px; }

/* ---------- Modal ---------- */
.modal {
  display: none; position: fixed; inset: 0; z-index: 80;
  background: rgba(10,15,30,.5);
  align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; }
.modal-dialog {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { margin: 0; font-size: 15.5px; }
.modal-close {
  background: none; border: none; cursor: pointer; color: var(--gray-500);
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }
.modal-body { padding: 20px 22px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--gray-100);
}
@media (max-width: 720px) {
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
}

.main {
  margin-left: 250px;
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
}

.topbar {
  height: 64px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 700; color: var(--navy-900); font-size: 16.5px; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 30px; transition: background .15s var(--ease); }
.user-chip:hover { background: var(--gray-100); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-600)); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; box-shadow: 0 2px 8px rgba(47,111,228,.35);
}
.user-meta { line-height: 1.25; }
.user-meta .u-name { font-weight: 600; font-size: 13px; color: var(--gray-900); }
.user-meta .u-role { font-size: 11px; color: var(--gray-500); text-transform: capitalize; }

.content { padding: 26px 28px 40px; flex: 1; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 21px; letter-spacing: -.02em; }
.page-header .subtitle, .subtitle { color: var(--gray-500); font-size: 13px; margin-top: 3px; }

/* ---------- Cards ---------- */
.card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease);
}
.card-body { padding: 20px 22px; }
.card-header { padding: 17px 22px; border-bottom: 1px solid var(--gray-100); font-weight: 700; color: var(--navy-900); font-size: 14.5px; display:flex; align-items:center; justify-content:space-between; letter-spacing: -.005em; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
/* Fixed-column-count variants for pages that want an exact desktop layout
   (rather than the auto-fit default above) without losing mobile
   responsiveness. Use class="stat-grid stat-grid-N" instead of an inline
   style="grid-template-columns:..." -- an inline style always wins over
   every rule below, including the @media overrides further down, and
   silently breaks on small screens (see report_cards.php's old bug). */
.stat-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* Weekly calendar grid (attendance day-boxes, Mon-Fri) -- collapses to a
   stacked single column on mobile rather than squeezing 5 day-cards into
   one row. */
.wk-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 720px) {
  .wk-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .wk-grid { grid-template-columns: 1fr; }
}
.stat-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 19px 21px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
  width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 19px; margin-bottom: 12px;
}
.stat-card .stat-value { font-size: 25px; font-weight: 800; color: var(--navy-900); letter-spacing: -.02em; line-height: 1.15; }
.stat-card .stat-label { font-size: 12.5px; color: var(--gray-500); font-weight: 600; margin-top: 2px; }
.stat-card .stat-delta { font-size: 11.5px; margin-top: 8px; font-weight: 700; color: var(--blue-600); display: inline-block; }
.bg-blue { background: linear-gradient(135deg,#e8f0fe,#dbe8fd); color: var(--blue-600); }
.bg-gold { background: linear-gradient(135deg,#fbf1da,#f7e6bd); color: var(--amber-600); }
.bg-green { background: linear-gradient(135deg,#e3f6ec,#cdeedc); color: var(--green-600); }
.bg-red { background: linear-gradient(135deg,#fbe7e7,#f7d4d4); color: var(--red-600); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .15s var(--ease);
  letter-spacing: -.005em;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(180deg, var(--blue-500), var(--blue-600)); color: #fff; box-shadow: 0 2px 8px rgba(33,88,201,.28); }
.btn-primary:hover { background: linear-gradient(180deg, #3a78ec, #1b49aa); box-shadow: 0 4px 14px rgba(33,88,201,.38); }
.btn-gold { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); color: #1c1503; box-shadow: 0 2px 8px rgba(212,167,44,.3); }
.btn-gold:hover { background: #c19824; }
.btn-outline { background: #fff; border-color: var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--blue-500); color: var(--blue-600); background: #f7faff; }
.btn-danger { background: linear-gradient(180deg,#e35555,var(--red-600)); color: #fff; box-shadow: 0 2px 8px rgba(211,63,63,.28); }
.btn-danger:hover { background: #b52f2f; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; }
.form-group { margin-bottom: 16px; }
.form-control, select.form-control, textarea.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: var(--font); background: #fff; color: var(--gray-900);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-control:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(47,111,228,.14); }
.form-control:disabled { background: var(--gray-50); color: var(--gray-500); }
input[type="file"].form-control { padding: 7px 10px; cursor: pointer; color: var(--gray-500); font-size: 13px; }
input[type="file"].form-control::file-selector-button,
input[type="file"].form-control::-webkit-file-upload-button {
  margin-right: 12px; padding: 7px 14px; border: none; border-radius: var(--radius-sm);
  background: var(--blue-600); color: #fff; font-size: 12.5px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: background .15s var(--ease);
}
input[type="file"].form-control:hover::file-selector-button,
input[type="file"].form-control:hover::-webkit-file-upload-button { background: var(--blue-700); }
.photo-upload-row { display: flex; align-items: center; gap: 14px; }
.photo-upload-preview {
  width: 72px; height: 88px; border: 1px dashed var(--gray-300); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
  background: var(--gray-50); color: var(--gray-500); font-size: 9px; text-align: center; line-height: 1.3;
}
.photo-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-hint { font-size: 11.5px; color: var(--gray-500); margin-top: 4px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-500); }
.input-icon-wrap .form-control { padding-left: 36px; }
.password-field-wrap { position: relative; }
.password-field-wrap .form-control { padding-right: 52px; }
.password-toggle-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 11.5px; font-weight: 700;
  color: var(--blue-600); padding: 6px 8px; border-radius: var(--radius-sm);
}
.password-toggle-btn:hover { background: var(--gray-50); }
.form-section {
  background: #f8fbff;
  border: 1px solid rgba(47,111,228,.12);
  border-radius: calc(var(--radius) - 2px);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.section-title {
  margin: 0 0 18px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -.01em;
}
.section-subtitle {
  margin: 0 0 18px;
  color: var(--gray-500);
  font-size: 13px;
}
.auth-card { width: 100%; max-width: 520px; background: #fff; border-radius: 22px; box-shadow: 0 30px 90px rgba(0,0,0,.16); overflow: hidden; border: 1px solid rgba(255,255,255,.08); }
.auth-body { padding: 16px 36px 34px; }
.auth-header { padding: 34px 32px 12px; text-align: center; }
.auth-header h2 { font-size: 26px; margin-bottom: 8px; }
.auth-header .text-muted { font-size: 13.5px; }
.auth-footer { text-align: center; padding: 18px 24px; font-size: 12px; color: var(--gray-500); background: #f7faff; border-top: 1px solid rgba(47,111,228,.08); }
.btn-primary { width: 100%; padding: 12px 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th {
  text-align: left; background: var(--gray-50); color: var(--gray-700);
  padding: 11px 16px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
table.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #f8fafd; }
table.data-table tfoot td { font-weight: 700; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items:center; gap:5px; padding: 3px 10px; border-radius: 20px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; opacity:.8; }
.badge-green { background: #e3f6ec; color: var(--green-600); }
.badge-red { background: #fbe7e7; color: var(--red-600); }
.badge-amber { background: #fbf1da; color: var(--amber-600); }
.badge-blue { background: #e8f0fe; color: var(--blue-600); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: #e3f6ec; color: #146342; border-color: #bfe6d1; }
.alert-error { background: #fbe7e7; color: #9c2a2a; border-color: #f3c6c6; }
.alert-info { background: #e8f0fe; color: #1b49aa; border-color: #c9dafb; }

/* ---------- Login page ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 15% 10%, rgba(212,167,44,.12), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(47,111,228,.18), transparent 45%),
    linear-gradient(160deg, #0d2144, var(--navy-900) 55%, #081428);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 410px; background: #fff; border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45); overflow: hidden;
  border: 1px solid rgba(255,255,255,.06);
}
.auth-header { padding: 34px 32px 12px; text-align: center; }
.auth-header .logo-badge {
  width: 132px; height: 132px; border-radius: 22px; margin: 0 auto 20px;
  background: #fff; padding: 8px;
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--navy-900); font-size: 42px;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
}
.auth-header .logo-badge img {
  width: 100%; height: 100%; object-fit: contain; border-radius: 15px;
}
.auth-header h2 { letter-spacing: -.02em; }
.auth-header .auth-title-note { margin: 12px auto 0; color: var(--gray-500); max-width: 340px; line-height: 1.6; }
.auth-body { padding: 12px 32px 32px; }
.auth-body .btn-primary {
  background: linear-gradient(180deg, var(--blue-600), var(--blue-700));
  border: none;
  color: #fff;
  box-shadow: 0 14px 28px rgba(23, 74, 212, .18);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.auth-body .btn-primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, var(--blue-700), var(--blue-800));
}
.auth-body .btn-primary:disabled {
  opacity: .85;
  cursor: not-allowed;
}
.auth-intro { margin-bottom: 18px; padding: 14px 16px; border-radius: 14px; background: rgba(47,111,228,.08); color: var(--navy-900); font-size: 13px; border: 1px solid rgba(47,111,228,.16); }
.auth-footer { text-align: center; padding: 16px; font-size: 11.5px; color: var(--gray-500); background: var(--gray-50); border-top: 1px solid var(--gray-100); }

/* ---------- Login page (glassmorphism, photo backdrop) ----------
   Scoped to .login-* so it only affects index.php -- the shared
   .auth-* classes above stay untouched for register/forgot-password/
   reset/verify/404, which use plain white cards. Written mobile-first:
   base rules target small phones, min-width queries add refinement
   for larger viewports. */
html:has(body.login-page), body.login-page { height: 100%; }
body.login-page { margin: 0; overscroll-behavior: none; }
.login-bg {
  position: fixed; inset: 0; z-index: -2;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.login-scrim {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 18% 8%, rgba(230,191,79,.14), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(33,88,201,.14), transparent 48%),
    linear-gradient(190deg, rgba(8,18,36,.32), rgba(9,20,40,.42) 55%, rgba(6,14,28,.56));
}
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px 14px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, rgba(10,26,51,.42), rgba(10,26,51,.58));
  border: 1px solid rgba(255,255,255,.30);
  border-radius: 20px;
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 24px 60px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,.28);
  overflow: hidden;
  color: #fff;
}
.login-header { padding: 26px 20px 12px; text-align: center; }
.login-logo {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 16px;
  background: rgba(255,255,255,.95); padding: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--navy-900); font-size: 30px;
  box-shadow: 0 10px 24px rgba(0,0,0,.32);
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.login-school-name {
  font-size: 18px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 4px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.login-subtitle { font-size: 12.5px; color: rgba(255,255,255,.78); }
.login-body { padding: 8px 20px 22px; }
.login-body .form-group { margin-bottom: 15px; }
.login-body label {
  color: rgba(255,255,255,.85); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.login-body .form-control {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.30);
  color: #fff;
  padding: 12px 13px;
  font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
  border-radius: 12px;
}
.login-body .form-control::placeholder { color: rgba(255,255,255,.48); }
/* The <select> itself inherits the white text above, which is correct for
   its closed state -- but the open dropdown's option list is rendered by
   the OS/browser with its own native (near-white) popup background that
   this CSS can't restyle. White-on-white made every option invisible
   until the native hover highlight kicked in. Options need their own
   dark color so they're readable against that native popup. */
.login-body select.form-control option {
  color: var(--gray-900);
  background: #fff;
}
.login-body .form-control:focus {
  background: rgba(255,255,255,.18);
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(230,191,79,.24);
}
/* A plain white/transparent toggle loses contrast the moment the input
   behind it lightens -- on focus, or when the browser's own autofill
   highlight kicks in as the user types. Giving it its own opaque chip
   keeps "Show"/"Hide" readable no matter what's happening underneath. */
.login-body .password-toggle-btn {
  color: #fff;
  background: rgba(10,26,51,.55);
  border-radius: 8px;
}
.login-body .password-toggle-btn:hover { background: rgba(10,26,51,.75); }
.login-body .form-control:-webkit-autofill,
.login-body .form-control:-webkit-autofill:hover,
.login-body .form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px rgba(255,255,255,.14) inset;
  caret-color: #fff;
  transition: background-color 5000s ease-in-out 0s;
}
.login-body .btn-primary {
  background: linear-gradient(180deg, var(--gold-400), var(--gold-500));
  color: var(--navy-900); font-weight: 800; border: none;
  padding: 13px 18px; font-size: 14.5px;
  box-shadow: 0 14px 30px rgba(212,167,44,.32);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.login-body .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 18px 38px rgba(212,167,44,.42); }
.login-body .btn-primary:active { transform: translateY(0); }
.login-body .alert-error {
  background: rgba(211,63,63,.20); color: #fff;
  border-color: rgba(255,255,255,.25);
}
.login-body .alert-success {
  background: rgba(26,143,94,.22); color: #fff;
  border-color: rgba(255,255,255,.25);
}
.login-body .alert-info {
  background: rgba(255,255,255,.12); color: #fff;
  border-color: rgba(255,255,255,.25);
}
.login-body .form-hint { color: rgba(255,255,255,.6); }
.login-body input[type="file"].form-control { color: rgba(255,255,255,.7); }
/* Checkbox/option labels (e.g. the staff registration form's department
   picker) are a different UI pattern than a field label -- reset the
   uppercase/bold field-label treatment so the option text reads naturally
   next to its checkbox. */
.login-body label:has(input[type="checkbox"]) {
  display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,.9); text-transform: none; letter-spacing: normal;
  font-weight: 500; font-size: 13px; margin-bottom: 0;
}
.login-body .btn-outline {
  background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.35); color: #fff;
}
.login-body .btn-outline:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.5); color: #fff; }
/* The admission form's own .form-section "wells" (Section A, B, C...) were
   a light-blue card-on-card look designed for the plain white auth card.
   Restyled as translucent dark panels so they read as part of the glass
   card instead of clashing with it. */
.login-body .form-section {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.16);
}
.login-body .section-title { color: var(--gold-400); }
.login-body .section-subtitle { color: rgba(255,255,255,.65); }
.login-body .photo-upload-preview {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.35);
  color: rgba(255,255,255,.6);
}
.login-links { margin-top: 16px; text-align: center; font-size: 12.5px; }
.login-links a { color: rgba(255,255,255,.88); }
.login-links a:hover { color: #fff; text-decoration: underline; }
.login-links-sep { margin: 0 8px; color: rgba(255,255,255,.4); }
.login-footer {
  text-align: center; padding: 14px; font-size: 10.5px; line-height: 1.5;
  color: rgba(255,255,255,.65);
  background: rgba(255,255,255,.05);
  border-top: 1px solid rgba(255,255,255,.14);
}

@media (min-width: 400px) {
  .login-wrap { padding: 24px 18px; }
  .login-card { max-width: 408px; border-radius: 24px; }
  .login-header { padding: 34px 30px 14px; }
  .login-logo { width: 92px; height: 92px; border-radius: 18px; }
  .login-school-name { font-size: 21px; }
  .login-body { padding: 10px 30px 28px; }
}
@media (min-width: 640px) {
  .login-card { max-width: 428px; }
  .login-logo { width: 104px; height: 104px; }
  .login-school-name { font-size: 23px; }
}
@media (min-width: 1024px) {
  .login-wrap { padding: 40px; }
  .login-card { max-width: 440px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-body .btn-primary { transition: none; }
}

/* ---------- Utilities ---------- */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 12.5px; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
/* .grid-3 was used across 5 pages (IT dashboard, Settings, Classes,
   Communication, Fees) with no matching CSS rule at all -- cards were
   silently stacking as unstyled blocks instead of a 3-column layout. */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .grid-3 { grid-template-columns: 1fr; } }

.empty-state { text-align: center; padding: 50px 20px; color: var(--gray-500); }
.empty-state .icon { font-size: 36px; margin-bottom: 10px; }

.pagination { display: flex; gap: 6px; margin-top: 16px; }
.pagination a, .pagination span {
  padding: 6px 12px; border-radius: 7px; border: 1px solid var(--gray-200); font-size: 12.5px; color: var(--gray-700);
  transition: all .15s var(--ease);
}
.pagination a:hover { text-decoration: none; border-color: var(--blue-500); color: var(--blue-600); }
.pagination .active { background: var(--blue-600); color: #fff; border-color: var(--blue-600); box-shadow: 0 2px 8px rgba(33,88,201,.3); }

/* ---------- Mini bar chart (dashboards) — no JS/library, pure CSS ---------- */
.mini-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 4px; }
.mini-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.mini-chart-val { font-size: 11px; font-weight: 700; color: var(--gray-700); }
.mini-chart-bar-wrap { width: 100%; height: 90px; display: flex; align-items: flex-end; }
.mini-chart-bar { width: 100%; background: linear-gradient(180deg, var(--blue-500), var(--blue-600)); border-radius: 5px 5px 2px 2px; min-height: 4px; transition: height .3s var(--ease); }
.mini-chart-label { font-size: 11px; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Misc polish ---------- */
.card, .stat-card { animation: fadeInUp .25s var(--ease); }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Sidebar toggle (mobile) ---------- */
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-700); }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .sidebar-toggle { display: block; }
}

/* ---------- Print (report cards / receipts) ---------- */
@media print {
  .no-print { display: none !important; }
  .sidebar, .topbar { display: none !important; }
  .main { margin-left: 0 !important; }
  body { background: #fff; }
}

/* ---------- Live Date & Time Styling ---------- */
.live-clock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(33, 88, 201, 0.08);
  border: 1px solid rgba(33, 88, 201, 0.18);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue-600);
}
.live-clock-badge .clock-icon {
  font-size: 14px;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--green-600);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(26, 143, 94, 0.4);
  animation: pulseDot 1.8s infinite;
}
@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(26, 143, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(26, 143, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(26, 143, 94, 0); }
}
.auth-live-clock {
  margin-top: 8px;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
}

/* ---------- Timetable Grid ---------- */
.timetable-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.timetable-grid th {
  background: var(--navy-900);
  color: #fff;
  padding: 10px 8px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
  border-bottom: 3px solid var(--gold-500);
}
.timetable-grid th:first-child {
  width: 90px;
  min-width: 90px;
  background: #0a1a33;
}
.timetable-grid td {
  border: 1px solid var(--gray-200);
  padding: 0;
  vertical-align: top;
  height: 70px;
  background: #fff;
}
.timetable-grid td:first-child {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--navy-900);
  text-align: center;
  vertical-align: middle;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  width: 90px;
  min-width: 90px;
}
.timetable-grid .lesson-cell {
  padding: 8px 10px;
  height: 100%;
  min-height: 60px;
  border-left: 3px solid var(--blue-600);
  background: linear-gradient(180deg, #f8faff, #fff);
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease;
}
.timetable-grid .lesson-cell:hover {
  box-shadow: 0 2px 8px rgba(33,88,201,.12);
  transform: translateY(-1px);
}
.timetable-grid .lesson-cell .subject-name {
  font-weight: 700;
  color: var(--navy-900);
  font-size: 13px;
  margin-bottom: 3px;
}
.timetable-grid .lesson-cell .time-range {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
}
.timetable-grid .lesson-cell .teacher-name {
  font-size: 11px;
  color: var(--green-600);
  margin-top: 3px;
}
.timetable-grid .lesson-cell .room-name {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}
.timetable-grid .empty-cell {
  background: #fafbfc;
}
.timetable-grid .empty-cell:hover {
  background: #f5f7fb;
}

/* ---------- Professional Timetable ---------- */
.professional-timetable {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.professional-timetable th {
  background: linear-gradient(180deg, var(--navy-900), #0f2448);
  color: #fff;
  padding: 12px 10px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: center;
  border-bottom: 3px solid var(--gold-500);
  white-space: nowrap;
}
.professional-timetable th:first-child {
  width: 80px;
  min-width: 80px;
  background: #0a1a33;
}
.professional-timetable td {
  border: 1px solid var(--gray-200);
  padding: 8px;
  vertical-align: top;
  min-height: 90px;
  background: #fff;
  transition: background .15s ease;
}
.professional-timetable td:first-child {
  background: var(--gray-50);
  font-weight: 700;
  color: var(--navy-900);
  text-align: center;
  vertical-align: middle;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  width: 80px;
  min-width: 80px;
}
.professional-timetable .lesson-cell {
  padding: 10px;
  min-height: 80px;
  border-left: 3px solid var(--blue-600);
  background: linear-gradient(180deg, #f8faff, #fff);
  cursor: pointer;
  border-radius: 0 6px 6px 0;
  transition: box-shadow .15s ease, transform .15s ease;
}
.professional-timetable .lesson-cell:hover {
  box-shadow: 0 2px 8px rgba(33,88,201,.12);
  transform: translateY(-1px);
}
.professional-timetable .lesson-cell .subject-name {
  font-weight: 700;
  color: var(--navy-900);
  font-size: 13px;
  margin-bottom: 3px;
}
.professional-timetable .lesson-cell .time-range {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
}
.professional-timetable .lesson-cell .teacher-name {
  font-size: 11px;
  color: var(--green-600);
  margin-top: 3px;
}
.professional-timetable .lesson-cell .room-name {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}
.professional-timetable .lesson-cell .notes-name {
  font-size: 10px;
  color: var(--amber-600);
  margin-top: 2px;
  font-style: italic;
}
.professional-timetable .break-row {
  background: #fffbf0;
}
.professional-timetable .break-row td:first-child {
  background: #fff7e0;
}
.professional-timetable .break-cell {
  background: repeating-linear-gradient(
    45deg,
    #fffbf0,
    #fffbf0 10px,
    #fff7e0 10px,
    #fff7e0 20px
  );
  vertical-align: middle;
  text-align: center;
}
.professional-timetable .break-content {
  padding: 8px;
}
.professional-timetable .break-content strong {
  color: var(--amber-600);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.professional-timetable .break-name {
  display: block;
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}
.professional-timetable .empty-slot {
  padding: 10px;
  color: var(--blue-600);
  font-size: 12px;
  font-weight: 600;
  opacity: 0.5;
  transition: opacity .15s;
  text-align: center;
  cursor: pointer;
  border-radius: 6px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.professional-timetable .empty-slot:hover {
  opacity: 1;
  background: rgba(33, 88, 201, 0.04);
}
.professional-timetable .lesson-row:hover td {
  background: #fafbfd;
}

@media (max-width: 960px) {
  .professional-timetable {
    font-size: 11px;
  }
  .professional-timetable .lesson-cell {
    padding: 6px 8px;
  }
  .professional-timetable td {
    min-height: 70px;
  }
  .timetable-grid th,
  .professional-timetable th {
    font-size: 10px;
    padding: 8px 6px;
  }
  .timetable-grid td,
  .professional-timetable td {
    padding: 6px;
  }
}

@media (max-width: 768px) {
  .page-header .d-flex {
    width: 100%;
  }
  .page-header .d-flex .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ---------- Responsive application shell ---------- */
html { overflow-x: hidden; }
body { overflow-x: hidden; }
body.drawer-open { overflow: hidden; }
button, a.btn, input, select, textarea { min-height: 44px; }
button, a, input, select, textarea { touch-action: manipulation; }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table.data-table { min-width: 640px; }
.topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { min-width: 0; }
.content > *, .page-header > *, .card, .stat-card { min-width: 0; }

@media (max-width: 960px) {
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 32px; }
  .sidebar { width: min(86vw, 320px); }
  .topbar-right { gap: 6px; }
  .live-clock-badge { display: none; }
  .user-meta { display: none; }
  .user-chip { padding: 4px; }
  .sidebar-toggle { width: 44px; height: 44px; align-items: center; justify-content: center; }
}

@media (max-width: 720px) {
  .content { padding: 16px 12px 28px; }
  .page-header { align-items: stretch; margin-bottom: 16px; }
  .page-header h1 { font-size: clamp(18px, 6vw, 21px); overflow-wrap: anywhere; }
  .page-header .subtitle { font-size: 12px; }
  .page-header > .btn, .page-header > a.btn { width: 100%; justify-content: center; }
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; gap: 10px; flex-wrap: wrap; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: clamp(20px, 7vw, 25px); overflow-wrap: anywhere; }
  .form-row { grid-template-columns: 1fr; gap: 10px; }
  .form-row .form-group { min-width: 0; }
  .d-flex { flex-wrap: wrap; }
  .d-flex > .btn, .d-flex > a.btn { max-width: 100%; }
  .btn { justify-content: center; text-align: center; }
  .modal { padding: 10px; align-items: flex-end; }
  .modal-dialog { max-height: calc(100vh - 20px); border-radius: var(--radius) var(--radius) 0 0; }
  .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
  .modal-footer { flex-direction: column-reverse; align-items: stretch; }
  .modal-footer .btn { width: 100%; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .quick-action { padding: 12px; min-width: 0; }
  .quick-action .qa-label { overflow-wrap: anywhere; }
  .pagination { flex-wrap: wrap; }
  .pagination a, .pagination span { min-height: 44px; display: inline-flex; align-items: center; }
  .auth-wrap { padding: 12px; align-items: flex-start; }
  .auth-card { margin-top: 12px; border-radius: 14px; }
  .auth-header { padding: 24px 18px 10px; }
  .auth-header .logo-badge { width: 96px; height: 96px; margin-bottom: 14px; }
  .auth-header h2 { font-size: 22px; }
  .auth-body { padding: 12px 18px 24px; }
}

@media (max-width: 380px) {
  .topbar { padding: 0 10px; }
  .topbar-title { font-size: 14px; }
  .content { padding-left: 8px; padding-right: 8px; }
  .stat-grid, .quick-actions { grid-template-columns: 1fr; }
  .card-body { padding: 12px; }
  .table-wrap table.data-table { min-width: 560px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

