/* Curated font choices for the admin Appearance panel — one combined
   request, font-display=swap so text never goes invisible while loading. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Poppins:wght@400;500;600;700;800;900&family=Manrope:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Nunito:wght@400;500;600;700;800;900&family=Work+Sans:wght@400;500;600;700;800;900&family=Lexend:wght@400;500;600;700;800&display=swap');

/* Theme variables — overridable at runtime by the admin appearance picker */
:root {
  --app-bg: linear-gradient(135deg, #eaf2ff 0%, #f4f0ff 30%, #fdf1f9 55%, #eefcff 80%, #eef4ff 100%);
  --app-glow:
    radial-gradient(42rem 42rem at 10% 12%, rgba(99,102,241,0.18), transparent 62%),
    radial-gradient(38rem 38rem at 92% 8%,  rgba(56,189,248,0.16), transparent 62%),
    radial-gradient(46rem 46rem at 85% 92%, rgba(236,72,153,0.12), transparent 62%),
    radial-gradient(34rem 34rem at 18% 95%, rgba(16,185,129,0.12), transparent 62%);
  --app-font: 'Inter', sans-serif;
  --view-heading: #1e293b;
  --view-subtext: #94a3b8;
}

/* Main content ("view panel") heading/subtext colors ride the active theme
   too, not just the sidebar — set per-preset from applyTheme() in app.js.
   Scoped to #view-container only: modals, the login screen and the sidebar
   itself keep their own separate, always-neutral text treatment. */
#view-container .text-slate-800 { color: var(--view-heading) !important; }
#view-container .text-slate-400,
#view-container .text-slate-500 { color: var(--view-subtext) !important; }

body {
  font-family: var(--app-font) !important;
  background: var(--app-bg) !important;
  background-size: 320% 320% !important;
  animation: auroraShift 26s ease-in-out infinite;
  min-height: 100vh;
  position: relative;
}

/* slow, smooth drift of the gradient */
@keyframes auroraShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* soft colour glows floating behind the UI */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--app-glow);
  animation: glowFloat 30s ease-in-out infinite alternate;
}

@keyframes glowFloat {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(0, -2%, 0) scale(1.06); }
}

/* ══════════════════════════════════════════════════════
   GLASSMORPHISM — translucent surfaces so the gradient
   shows through every card / form / panel
   ══════════════════════════════════════════════════════ */
.bg-white {
  background-color: rgba(255, 255, 255, 0.55) !important;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}
.bg-slate-50  { background-color: rgba(255, 255, 255, 0.40) !important; }
.bg-slate-100 { background-color: rgba(255, 255, 255, 0.52) !important; }

/* Fully transparent so the gradient shows straight through, no frosting */
#content-header {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6) !important;
}

/* Keep the login screen crisp & solid (it sits on a dark backdrop) */
#login-screen .bg-white {
  background-color: #ffffff !important;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
#login-screen .bg-slate-100 { background-color: #f1f5f9 !important; }

/* respect users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  body::before { animation: none; }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1) !important;
  outline: none !important;
}

/* ── Generic form inputs (outside profile form) ── */
input[type="text"]:not(.pf-input),
input[type="email"]:not(.pf-input),
input[type="password"]:not(.pf-input),
input[type="number"]:not(.pf-input),
input[type="tel"]:not(.pf-input),
input[type="search"]:not(.pf-input) {
  transition: border-color .18s, box-shadow .18s;
}

/* ── Data table cells ── */
table thead th {
  font-size: .6rem; font-weight: 900; text-transform: uppercase;
  letter-spacing: .12em; color: #94a3b8;
}
table tbody tr { transition: background .12s; }
table tbody td { font-size: .8rem; }

/* ══════════════════════════════════════════════════════
   PROFILE FORM — shared across TeacherView / preview
   ══════════════════════════════════════════════════════ */

/* ── Section card ── */
.pcard {
  background: rgba(255,255,255,.55);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 1.125rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.025);
  transition: box-shadow .2s;
}
.pcard:hover { box-shadow: 0 2px 8px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.04); }
.pcard-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem 1.25rem;
  background: linear-gradient(to right, #fef3c7 0%, #fffbeb 55%, #fff 100%);
  border-bottom: 1px solid #fde68a;
  border-left: 3px solid #f59e0b;
  font-size: .6rem; font-weight: 900; text-transform: uppercase; letter-spacing: .12em;
  color: #92400e;
}
.pcard > .space-y-4, .pcard > .space-y-3, .pcard > .space-y-2,
.pcard > textarea, .pcard > input, .pcard > .flex, .pcard > p { padding: 1.25rem 1.5rem; }

/* Horizontal field rows container */
.pf-rows { display: flex; flex-direction: column; }

/* ── Horizontal field row ── */
.pf-wrap {
  display: flex; flex-direction: row; align-items: flex-start;
  gap: 0; padding: .55rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}
.pf-wrap:last-child { border-bottom: none; }

/* ── Label — left column, fixed width  ·  COLOR: VIOLET ── */
.pf-lbl {
  width: 12.5rem; min-width: 12.5rem; flex-shrink: 0;
  padding-top: .62rem; padding-right: 1rem;
  font-size: .58rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em;
  color: #6d28d9; line-height: 1.5;
}
.pf-wrap.req .pf-lbl::after { content: ' *'; color: #f87171; }

/* ── Input — right column  ·  BORDER: TEAL  ·  FILL: LIGHT BLUE ── */
.pf-input {
  flex: 1; min-width: 0;
  padding: .55rem .9rem;
  background: #ecfeff;
  border: 1.5px solid #14b8a6;
  border-radius: .5rem;
  font-weight: 600; font-size: .8rem; color: #0f172a;
  outline: none; transition: border-color .18s, box-shadow .18s, background .18s;
  -webkit-appearance: none; appearance: none;
  box-shadow: 0 1px 2px rgba(20,184,166,.08);
}
.pf-input::placeholder { color: #a1a1aa; font-weight: 500; font-style: italic; }
.pf-input:hover:not([readonly]):not(:disabled) {
  border-color: #0d9488;
  background: #f0fdfa;
  box-shadow: 0 1px 4px rgba(20,184,166,.15);
}
.pf-input:focus:not([readonly]) {
  border-color: #0f766e !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(20,184,166,.18) !important;
}
select.pf-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2314b8a6'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: 1rem;
  background-color: #ecfeff;
  padding-right: 2.25rem;
}
textarea.pf-input { resize: vertical; line-height: 1.55; }

/* ── System / read-only field ── */
.pf-input.pf-system {
  background: #f1f5f9 !important; color: #94a3b8 !important;
  cursor: not-allowed; font-family: 'SF Mono',ui-monospace,monospace;
  letter-spacing: .05em; border-color: #e8edf3 !important; box-shadow: none !important;
}

/* ── Tab buttons ── */
.ptab-btn {
  display: flex; flex-direction: column; align-items: stretch; gap: .28rem;
  padding: .48rem .85rem; border-radius: .875rem;
  font-size: .575rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em;
  background: #f8fafc; color: #94a3b8; border: 1.5px solid #e8edf3;
  transition: all .18s; white-space: nowrap; min-width: 5rem; cursor: pointer;
}
.ptab-btn:hover { background: #f0f5fb; color: #475569; border-color: #cbd5e1; }
.ptab-btn.active-ptab {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 16px rgba(59,130,246,.3);
}
.tab-dot { display:inline-block; width:.35rem; height:.35rem; border-radius:9999px; background:currentColor; opacity:.18; transition:all .2s; flex-shrink:0; }
.tab-dot.filled { opacity:1; background:#10b981; }
.ptab-btn.active-ptab .tab-dot.filled { background:rgba(255,255,255,.9); }
.tab-pct { font-size:.55rem; font-weight:900; line-height:1; opacity:.75; color:currentColor; }
.ptab-btn.active-ptab .tab-pct { opacity:1; color:rgba(255,255,255,.9); }
.tab-bar-wrap { width:100%; height:2.5px; background:rgba(0,0,0,.06); border-radius:9999px; overflow:hidden; }
.ptab-btn.active-ptab .tab-bar-wrap { background:rgba(255,255,255,.2); }
.tab-bar-fill { height:100%; width:0%; border-radius:9999px; background:#10b981; transition:width .45s cubic-bezier(.4,0,.2,1); }

/* ── Add-row button ── */
.add-row-btn {
  font-size: .575rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  color: #fff; padding: .33rem .8rem; border-radius: 9999px;
  transition: all .18s; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(59,130,246,.22);
}
.add-row-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(59,130,246,.35); }

/* ── Dynamic rows (countries, siblings, banks…) ── */
[data-drow] {
  background: #f8fafc !important;
  border: 1.5px solid #f0f4f8 !important;
  border-radius: .875rem !important;
  padding: .875rem 1rem !important;
  margin-bottom: .5rem !important;
  transition: border-color .18s, box-shadow .18s;
}
[data-drow]:last-child { margin-bottom: 0 !important; }
[data-drow]:hover { border-color: #dbeafe !important; box-shadow: 0 2px 10px rgba(59,130,246,.06); }
[data-drow] input, [data-drow] select {
  background: #fff !important; border: 1.5px solid #e8edf3 !important;
  border-radius: .625rem !important; padding: .48rem .75rem !important;
  font-weight: 600 !important; font-size: .78rem !important; color: #0f172a !important;
  outline: none; transition: border-color .18s, box-shadow .18s !important;
  width: 100%; -webkit-appearance: none; appearance: none;
}
[data-drow] input:focus, [data-drow] select:focus {
  border-color: #3b82f6 !important; box-shadow: 0 0 0 3px rgba(59,130,246,.1) !important;
}
[data-drow] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right .6rem center !important;
  background-size: .9rem !important; padding-right: 1.8rem !important; cursor: pointer;
}
[data-drow] label { font-size: .575rem !important; font-weight: 800 !important; text-transform: uppercase !important; letter-spacing: .09em !important; color: #64748b !important; }

/* ── Font size levels ── */
#profileRoot.fs-1 { font-size:10px; } #profileRoot.fs-2 { font-size:12px; }
#profileRoot       { font-size:14px; }
#profileRoot.fs-4 { font-size:16px; } #profileRoot.fs-5 { font-size:18px; }
#profileRoot .pf-lbl   { font-size:.85em; }
#profileRoot .pf-input { font-size:.9em; }
#profileRoot .pcard-hdr { font-size:.8em; }
.fs-btn.active-fs { background:#2563eb !important; color:#fff !important; border-color:#2563eb !important; }

/* ── Locked / view-only state ── */
#teacherForm.form-locked .pcard {
  border-color: #f0f5fa; background: #fafbfd;
  box-shadow: 0 1px 4px rgba(15,23,42,.025);
}
#teacherForm.form-locked .pf-wrap {
  border-bottom-color: #f0fdfa;
}
#teacherForm.form-locked input,
#teacherForm.form-locked select,
#teacherForm.form-locked textarea,
#teacherForm.form-locked select:disabled {
  background: transparent !important; border-color: transparent !important;
  border-bottom: 1.5px solid #99f6e4 !important; border-radius: 0 !important;
  padding-left: 0 !important; padding-bottom: .25rem !important;
  color: #1e293b !important; font-weight: 700 !important;
  opacity: 1 !important; cursor: default; pointer-events: none;
  box-shadow: none !important; -webkit-text-fill-color: #1e293b;
}
#teacherForm.form-locked select {
  background-image: none !important; padding-right: 0 !important;
}
#teacherForm.form-locked .pf-input.pf-system {
  color: #94a3b8 !important; -webkit-text-fill-color: #94a3b8;
  border-bottom-color: transparent !important;
}
#teacherForm.form-locked [data-drow] {
  background: transparent !important; border: none !important;
  border-bottom: 1px solid #f5f7fa !important; border-radius: 0 !important;
  padding: .5rem 0 !important;
}
#teacherForm.form-locked [data-drow] input,
#teacherForm.form-locked [data-drow] select {
  border: none !important; border-bottom: 1px solid #f0f4f8 !important; border-radius: 0 !important;
}
#teacherForm.form-locked .add-row-btn,
#teacherForm.form-locked button[type="button"] { display: none; }

/* ── Preview / print sections ── */
.prev-section { background:#fff; border:1px solid #f0f4f8; border-radius:1.125rem; overflow:hidden; box-shadow:0 1px 4px rgba(15,23,42,.04); }
.prev-hdr {
  background: linear-gradient(to right,#eef4ff 0%,#f8fafc 55%,#fff 100%);
  border-left:3px solid #3b82f6; border-bottom:1px solid #e9f0fb;
  padding:.65rem 1.25rem; font-size:.6rem; font-weight:900; text-transform:uppercase; letter-spacing:.12em; color:#2563eb;
}
.prev-body { padding:1.125rem 1.375rem; }
.pv-field { display:flex; flex-direction:column; gap:.2rem; }
.pv-lbl { font-size:.575rem; font-weight:900; text-transform:uppercase; letter-spacing:.1em; color:#cbd5e1; }
.pv-val { font-size:.875rem; font-weight:700; color:#1e293b; line-height:1.4; }
.pv-val.empty { color:#e2e8f0; }

@media print {
  #main-sidebar, .print\:hidden { display:none !important; }
  #profilePreviewMode { display:block !important; }
  #profileEditMode { display:none !important; }
  .prev-section { break-inside:avoid; }
  /* keep printed/exported documents on solid white, no glass */
  .pcard, .stat-card {
    background:#fff !important;
    backdrop-filter:none !important; -webkit-backdrop-filter:none !important;
  }
}

/* ── Group Forms roster print (admin + reviewer tabs) ─────────────────────
   printGroupFormRoster()/_printGfReviewRoster() toggle body.gf-printing and
   .gf-print-area on the live on-screen list, then call window.print() —
   same dashboard markup, not a separate print layout. Classic visibility
   isolation (not display:none on ancestors) so hiding everything else can't
   also hide what's genuinely nested inside the roster list itself. */
/* <body> itself carries h-screen + overflow-hidden (the SPA shell's own
   scroll-locking, see .ac-main and friends) — that caps the page's layout
   height to one screen's worth REGARDLESS of what's absolutely positioned
   inside it, so the print engine paginates against that one-screen height
   and silently truncates everything past page 1. Stripping height/overflow
   from every ancestor (safe: all of them are invisible anyway under
   gf-printing) lets the true, full content height drive pagination instead. */
body.gf-printing * { visibility: hidden !important; overflow: visible !important; max-height: none !important; }
body.gf-printing { height: auto !important; overflow: visible !important; }
body.gf-printing .gf-print-area,
body.gf-printing .gf-print-area * { visibility: visible !important; }
body.gf-printing .gf-print-area {
  position: absolute; left: 0; top: 0; width: 100%;
  display: flex !important; flex-direction: column; gap: 10px;
}
body.gf-printing .gf-print-area > div {
  break-inside: avoid; border-color: #94a3b8 !important; background: #fff !important;
}
body.gf-printing .gf-no-print { display: none !important; }
/* Reference number: the dark-filled pill (fine on screen) risks printing as
   a smudge or illegible white-on-dark on a low-ink/grayscale printer — a
   bold bordered badge on plain white reads clearly either way, and larger
   so it's legible at a glance, not just up close. */
body.gf-printing .gf-refno {
  background: #fff !important; color: #000 !important;
  border: 1.5px solid #000 !important; font-size: 12px !important;
  padding: 2px 10px !important;
}
body.gf-printing .gf-roster-serial { font-size: 13px !important; color: #000 !important; }

.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

button { user-select: none; }

/* ── Designer Credit — smallest text size in the app, deliberately ── */
.designer-credit {
  position: fixed; bottom: 10px; right: 14px; font-size: 8px; color: #94a3b8;
  font-weight: 700; z-index: 1102; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(10px);
  border: 1px solid rgba(226,232,240,0.8); pointer-events: none;
}
@media (max-width: 767px) {
  .designer-credit { bottom: 6px; right: 8px; padding: 3px 8px; }
}

/* ── Toast ── */
#toast-container { position:fixed; top:1.5rem; right:1.5rem; z-index:500; display:flex; flex-direction:column; gap:.5rem; pointer-events:none; }
.toast { display:flex; align-items:center; gap:.75rem; padding:.75rem 1.25rem; border-radius:1rem; font-size:.7rem; font-weight:900; text-transform:uppercase; letter-spacing:.07em; box-shadow:0 10px 40px rgba(0,0,0,.12); animation: toastIn .3s cubic-bezier(.34,1.56,.64,1); pointer-events:auto; min-width:220px; max-width:340px; border-left:4px solid; }
.toast-success { background:#fff; color:rgb(5 150 105); border-color:rgb(16 185 129); }
.toast-error   { background:#fff; color:rgb(220 38 38);  border-color:rgb(239 68 68); }
.toast-info    { background:#fff; color:rgb(37 99 235);  border-color:rgb(59 130 246); }
@keyframes toastIn { from { opacity:0; transform:translateX(110%); } to { opacity:1; transform:translateX(0); } }

/* ── Role chips ── */
.role-chip-wrap { cursor:pointer; user-select:none; }
.role-chip-wrap input { display:none; }
.role-chip-wrap span { display:inline-block; padding:.375rem .9rem; border-radius:9999px; font-size:.625rem; font-weight:900; text-transform:uppercase; letter-spacing:.1em; background:rgb(248 250 252); color:rgb(148 163 184); border:2px solid rgb(226 232 240); transition:all .15s; }
.role-chip-wrap input:checked + span { background:rgb(37 99 235); color:#fff; border-color:rgb(37 99 235); box-shadow:0 4px 12px rgba(37,99,235,.25); }

.custom-scrollbar-light::-webkit-scrollbar { width: 4px; }
.custom-scrollbar-light::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar-light::-webkit-scrollbar-thumb { background: rgb(226 232 240); border-radius: 10px; }

.stat-card {
  background:rgba(255,255,255,.55);
  backdrop-filter:saturate(160%) blur(14px); -webkit-backdrop-filter:saturate(160%) blur(14px);
  border:1px solid rgba(255,255,255,.6); border-radius:1.5rem; padding:1.5rem;
}

.modal-wrap { animation: backdropIn .2s ease; }
@keyframes backdropIn { from { opacity:0; } to { opacity:1; } }
.modal-box { animation: modalUp .25s cubic-bezier(.34,1.56,.64,1); }
@keyframes modalUp { from { opacity:0; transform:scale(.95) translateY(1rem); } to { opacity:1; transform:scale(1) translateY(0); } }
/* A dialog floating over a dark backdrop scrim needs a solid, high-contrast
   surface — the page-wide glassmorphism (.bg-white at 55% opacity, meant to
   let the gradient show through content cards) makes low-contrast elements
   like a plain-gray close icon nearly invisible until :hover adds an opaque
   chip behind it. Opt every modal surface back out of that translucency. */
.modal-box, .modal-box.bg-white { background-color: #fff !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }

@media (max-width: 767px) {
  main { padding: 1rem !important; }
  .modal-btn-row { flex-direction: column; }
  .modal-box-inner { width: calc(100vw - 2rem) !important; max-width: none !important; border-radius: 1.5rem !important; }
  #gradingStats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  table { min-width: 500px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 767px) {
  button, a[href], select { min-height: 2.75rem; }
}
@supports (padding: max(0px)) {
  #app-screen { padding-bottom: max(0px, env(safe-area-inset-bottom)); }
}

/* ── Sidebar ──
   Colors are CSS variables (set from applyTheme() in app.js, one set per
   admin-selected theme preset) so the whole sidebar re-skins along with the
   page gradient — these :root defaults are only the pre-JS/no-theme
   fallback, matching the original Aurora-era hardcoded dark-navy look. */
:root {
  --sidebar-bg: linear-gradient(180deg,#0d1b2e 0%,#0a1628 60%,#080f1e 100%);
  /* Brightened partway toward --sidebar-text-hover (same as applyTheme()'s
     runtime blend, see app.js) so resting nav text is readable even before
     the theme JS applies — not the original dim #64748b. */
  --sidebar-text: #a3aec2;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-icon-bg: rgba(255,255,255,0.04);
  --sidebar-icon-color: #a3aec2;
  --sidebar-accent-1: #1d4ed8;
  --sidebar-accent-2: #4f46e5;
  --sidebar-accent-soft-1: rgba(37,99,235,0.22);
  --sidebar-accent-soft-2: rgba(99,102,241,0.14);
  --sidebar-accent-glow: rgba(99,102,241,0.18);
  --sidebar-accent-text: #a5b4fc;
  --sidebar-section-label: rgba(226,232,240,0.55);
  --sidebar-border: rgba(255,255,255,0.05);
}
#main-sidebar { background: var(--sidebar-bg) !important; }
/* Blanket redirect: any leftover hardcoded slate text color anywhere inside
   the sidebar (subtitle, footer, inactive role-switcher buttons, etc.) rides
   the same theme-reactive color as .nav-link instead of staying a fixed gray
   that goes unreadable against a vivid/dark sidebar gradient preset. */
#main-sidebar .text-slate-400,
#main-sidebar .text-slate-500,
#main-sidebar .text-slate-600,
#main-sidebar .text-slate-700 { color: var(--sidebar-text) !important; }
.nav-link { display:flex; align-items:center; gap:8px; padding:5px 8px; border-radius:8px; transition:all 0.18s; color:var(--sidebar-text); text-decoration:none; position:relative; }
.nav-link:hover { background:rgba(255,255,255,0.05); color:var(--sidebar-text-hover); }
.nav-link:hover .nav-icon-box { background:var(--sidebar-accent-glow); color:var(--sidebar-accent-text); }
.nav-link.active { background:linear-gradient(135deg,var(--sidebar-accent-soft-1),var(--sidebar-accent-soft-2)); color:#fff; box-shadow:0 2px 10px var(--sidebar-accent-soft-1),inset 0 0 0 1px var(--sidebar-accent-soft-2); }
.nav-link.active .nav-icon-box { background:linear-gradient(135deg,var(--sidebar-accent-1),var(--sidebar-accent-2)); color:#fff; box-shadow:0 3px 8px var(--sidebar-accent-soft-1); }
.nav-icon-box { width:26px; height:26px; border-radius:7px; display:flex; align-items:center; justify-content:center; background:var(--sidebar-icon-bg); color:var(--sidebar-icon-color); transition:all 0.18s; flex-shrink:0; }
.nav-icon { width:13px; height:13px; }
.nav-text { font-size:12px; font-weight:600; white-space:nowrap; transition:all 0.3s; letter-spacing:0.01em; }
.nav-link.active .nav-text { font-weight:800; }
.nav-section-label { display:flex; align-items:center; gap:8px; padding:8px 8px 3px; }
.nav-section-label-text { font-size:8px; font-weight:900; color:var(--sidebar-section-label); text-transform:uppercase; letter-spacing:0.2em; white-space:nowrap; transition:all 0.3s; }

/* ── "Student Portal" accordion header + its nested sub-links ──
   nav-link's own onclick (_studentPortalNavClick) toggles `.expanded` on
   itself and `.collapsed` on the sibling #erp-links host — this is the
   CSS half of that behavior (chevron rotation + show/hide + sub-link
   sizing/indent so the nested items read as children, not more headers). */
.nav-chevron { width:12px; height:12px; margin-left:auto; flex-shrink:0; color:#475569; transition:transform 0.2s; }
.nav-link.expanded .nav-chevron { transform:rotate(90deg); color:#a5b4fc; }
#erp-links { overflow:hidden; max-height:1000px; transition:max-height 0.25s ease; padding-left:14px; border-left:1px solid rgba(255,255,255,0.06); margin-left:19px; }
#erp-links.collapsed { max-height:0; }
.nav-sublink { padding:4px 8px; gap:7px; }
.nav-sublink .nav-icon-box { width:20px; height:20px; border-radius:6px; background:transparent; }
.nav-sublink .nav-icon { width:11px; height:11px; }
.nav-sublink .nav-text { font-size:11px; font-weight:500; color:#94a3b8; }
.nav-sublink:hover .nav-text, .nav-sublink.active .nav-text { color:#fff; }
.nav-sublink.active { background:rgba(99,102,241,0.14); }
.sb-divider { height:1px; background:rgba(255,255,255,0.05); margin:8px 4px; }
.sb-logout-btn:hover { background:rgba(239,68,68,0.18) !important; border-color:rgba(239,68,68,0.35) !important; color:#fff !important; }
.sidebar-collapsed { width:68px !important; }
.sidebar-collapsed #sidebar-logo-text, .sidebar-collapsed .nav-text, .sidebar-collapsed .nav-section-label-text,
.sidebar-collapsed #user-info-text, .sidebar-collapsed #sidebar-footer-text, .sidebar-collapsed #role-switcher-label,
.sidebar-collapsed #logout-text { opacity:0; width:0; overflow:hidden; pointer-events:none; }
.sidebar-collapsed .nav-link { justify-content:center; padding:5px 0; margin:0 4px; }
.sidebar-collapsed .nav-section-label { justify-content:center; padding:6px 4px 3px; }
.sidebar-collapsed #role-switcher { padding-left:6px; padding-right:6px; }
.sidebar-collapsed #sidebar-user-section { padding-left:6px; padding-right:6px; }
.sidebar-collapsed .sb-user-card { padding:8px; }
.sidebar-collapsed #logout-btn { justify-content:center; gap:0; padding:9px 0; margin:0 4px; }
.sidebar-collapsed #chg-pass-btn { justify-content:center; gap:0; padding:9px 0; margin:0 4px 8px; }
.sidebar-collapsed #chg-pass-text { opacity:0; width:0; overflow:hidden; pointer-events:none; }
.sidebar-collapsed #collapse-btn { width:100%; margin:0; border-radius:12px; }
.custom-scrollbar::-webkit-scrollbar { width:3px; }
.custom-scrollbar::-webkit-scrollbar-track { background:transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.04); border-radius:10px; }
.custom-scrollbar:hover::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.1); }

/* ════════════════════════════════════════════════════════════════
   PROFILE PHOTO HEADER — sticky, scroll-driven smooth shrink
   ════════════════════════════════════════════════════════════════ */

/* Mobile: sticky top, horizontal row, JS-driven shrink */
#photoHeader {
  align-items: center;
  will-change: padding, gap;
}
#photoPanelLarge {
  will-change: width;
}

/* ════════════════════════════════════════════════════════════════
   PROFILE LAYOUT — DESKTOP: two-column grid, photo floated right
   ════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  #profileRoot {
    display: grid !important;
    grid-template-columns: 1fr 196px;
    grid-template-rows: auto 1fr;
    column-gap: 1rem;
    align-items: start;
  }

  /* Title row spans both columns */
  #profileTitleBlock {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  /* Photo card: right column, sticky top-right */
  #photoHeader {
    grid-column: 2;
    grid-row: 2;
    position: sticky !important;
    top: 0 !important;
    flex-direction: column !important;
    align-items: stretch !important;
    border-radius: 0.75rem !important;
    padding: 0.75rem !important;
    gap: 0.75rem !important;
  }

  /* Photo fills the column width */
  #photoPanelLarge {
    width: 100% !important;
    transition: none !important;
  }

  /* Action buttons always stacked vertically on desktop */
  #actionButtons {
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
  }

  /* Always show all action elements on desktop (JS hides these on mobile compact) */
  #previewLabel, #printLabel {
    display: inline !important;
  }
  #fontSizeWrap {
    display: block !important;
  }
  #photoHint, #photoStatusText {
    display: block !important;
  }

  /* Form: left column */
  #profileRoot > .flex-1 {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
  }

  /* Tab bar on desktop: no offset needed (photo is to the right, not above) */
  #profileTabBar {
    top: 0 !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE ENHANCEMENTS — 100% Mobile Responsive
   ════════════════════════════════════════════════════════════════ */

/* ── Mobile Navigation Header ── */
@media (max-width: 767px) {
  /* Mobile header — menu | logo | account in one line */
  .md\:hidden[class*="bg-slate-900"] {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    width: 100% !important;
    padding: 0.5rem 0.75rem !important;
  }

  /* Mobile header button stays small */
  .md\:hidden[class*="bg-slate-900"] > button {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    width: auto !important;
    padding: 0.5rem !important;
  }

  /* Mobile header logo area takes center space */
  .md\:hidden[class*="bg-slate-900"] > div:nth-child(2) {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
  }

  /* Mobile header account icon stays small */
  .md\:hidden[class*="bg-slate-900"] > div:last-child {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    width: auto !important;
  }

  /* Ensure mobile header stays visible and in one line */
  body { overflow: auto !important; }

  /* Better touch targets */
  button, input, select, textarea, a[role="button"], .nav-link {
    min-height: 44px;
    min-width: 44px;
  }

  /* Mobile spacing */
  body {
    font-size: 14px;
  }

  /* Better form spacing on mobile */
  .space-y-4 { gap: 1.25rem !important; }
  .space-y-3 { gap: 1rem !important; }
  .space-y-2 { gap: 0.75rem !important; }

  /* Stack grid layouts */
  .grid { gap: 1rem !important; }
  .grid.grid-cols-2 { grid-template-columns: 1fr !important; }
  .grid.grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .grid.grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  /* Responsive padding */
  main {
    padding: 1rem !important;
  }
  .p-8 { padding: 1.5rem !important; }
  .px-8 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
  .py-8 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

  /* Responsive modals */
  .modal-wrap {
    padding: 1rem !important;
  }
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 1.5rem !important;
    margin: 1rem !important;
  }

  /* Profile form responsive */
  .pf-wrap {
    flex-direction: column !important;
    gap: 0.5rem !important;
    padding: 1rem !important;
    align-items: stretch !important;
  }
  .pf-lbl {
    width: 100% !important;
    min-width: 100% !important;
    padding: 0 !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.65rem !important;
  }
  .pf-input {
    width: 100% !important;
  }

  /* Responsive tables — horizontal scroll on mobile */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table {
    width: 100%;
    min-width: 100%;
    font-size: 12px;
  }

  /* Responsive tabs — scoped to actual tab-ROW containers only (every
     direct child is an .admin-tab-btn/.ptab-btn, e.g. the Administration
     sub-tabs). Bare ".flex.flex-wrap.gap-2" matched hundreds of unrelated
     toolbars/filter-bars/chip-lists app-wide (e.g. Admission Admin's
     search+filters+action-buttons row), force-stacking each control onto
     its own full-width line instead of letting them wrap naturally —
     same overly-broad-selector bug as ".flex.gap-3" above, same fix
     shape: require every direct child to actually be a tab button. */
  .flex.flex-wrap.gap-2:not(:has(> :not(.admin-tab-btn):not(.ptab-btn))) {
    flex-direction: column;
    gap: 0.5rem !important;
  }
  .admin-tab-btn, .ptab-btn {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
  }

  /* Responsive list items */
  .pcard {
    margin-bottom: 1rem;
  }

  /* Better checkbox/radio sizing */
  input[type="checkbox"], input[type="radio"] {
    width: 20px !important;
    height: 20px !important;
    cursor: pointer;
    accent-color: #1d4ed8;
  }

  /* Responsive combobox */
  [id$="SearchInput"], [id$="Search"] {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    font-size: 14px !important;
  }

  /* Better dropdown for mobile */
  [id$="Dropdown"], [id$="Drop"] {
    max-height: 280px !important;
    max-width: 100vw !important;
  }

  /* Responsive selected members display */
  #selectedMembers {
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }
  #selectedMembers span {
    max-width: 100%;
    font-size: 11px !important;
  }

  /* Toast mobile positioning */
  #toast-container {
    top: auto !important;
    bottom: 1.5rem !important;
    right: 1rem !important;
    left: 1rem !important;
    width: calc(100% - 2rem) !important;
  }
  .toast {
    width: 100% !important;
    min-width: auto !important;
    max-width: none !important;
  }

  /* Better button layout on mobile — scoped to actual button-ROW
     containers only (every direct child is a <button>, e.g. a Save/Cancel
     pair). Bare ".flex.gap-3" matched 150+ unrelated elements app-wide
     (list rows with an avatar + text, e.g. the Messages conversation list
     and My Class Roster cards), stacking them into separate lines on
     mobile — ":has(> :not(button))" excludes anything with a non-button
     direct child instead of only ever targeting real button groups. */
  .flex.gap-3:not(:has(> :not(button))) {
    flex-direction: column;
    gap: 0.75rem !important;
  }
  .flex.gap-3:not(:has(> :not(button))) > button {
    width: 100%;
    min-height: 44px !important;
  }

  /* Sidebar adjustment */
  #main-sidebar {
    width: 280px !important;
    max-width: 85vw !important;
  }

  /* Mobile top header — menu | logo | account */
  .md\:hidden[class*="flex"][class*="justify-between"] {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
  }

  /* Better header sizing */
  #content-header {
    padding: 0.75rem 1rem !important;
    min-height: 50px !important;
    flex-wrap: wrap;
  }
  #content-header-title {
    font-size: 11px !important;
  }
  #content-header-role {
    font-size: 8px !important;
    padding: 0.5rem 0.75rem !important;
  }

  /* Form section cards */
  .pcard {
    border-radius: 1rem !important;
    margin-bottom: 1rem !important;
  }
  .pcard-hdr {
    padding: 1rem !important;
    font-size: 11px !important;
  }

  /* Better input sizing */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  input[type="date"],
  input[type="file"],
  select,
  textarea {
    min-height: 44px !important;
    padding: 0.75rem 1rem !important;
    font-size: 14px !important;
  }

  /* Dynamic row responsive */
  [data-drow] {
    padding: 1rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.75rem !important;
  }
  [data-drow] .flex {
    flex-direction: column !important;
  }
  [data-drow] input, [data-drow] select {
    padding: 0.75rem !important;
  }

  /* Better flex layouts */
  .flex.items-center.justify-between {
    flex-wrap: wrap;
    gap: 1rem !important;
  }

  /* Reduce text sizes on mobile for better fit */
  .text-xl { font-size: 1.25rem !important; }
  .text-lg { font-size: 1.125rem !important; }
  .text-sm { font-size: 0.875rem !important; }
  .text-xs { font-size: 0.75rem !important; }

  /* Better login form */
  #loginForm {
    width: 100% !important;
    max-width: 100% !important;
  }
  #loginForm input {
    min-height: 48px !important;
    padding: 1rem !important;
    font-size: 16px !important;
  }
  #loginForm button {
    min-height: 48px !important;
    font-size: 14px !important;
  }
}

/* ── Tablet Optimizations (768px - 1024px) ── */
@media (min-width: 768px) and (max-width: 1024px) {
  main {
    padding: 1.5rem !important;
  }
  .grid.grid-cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .grid.grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ── Large screens (1025px+) ── */
@media (min-width: 1025px) {
  .grid.md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .grid.md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .grid.md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* ── Safe Area Support (notch devices) ── */
@supports (padding: max(0px)) {
  #app-screen {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

/* ── Landscape mode adjustments ── */
@media (max-height: 600px) {
  #main-sidebar {
    max-height: 100vh;
    overflow-y: auto;
  }
  main {
    padding: 0.75rem !important;
  }
  .pcard {
    margin-bottom: 0.75rem !important;
  }
}

/* ── Bus Tracker (public/js/bus-tracking.js) — scoped styles for the
   list/info-panel/marker/alert markup that file generates. app.html
   carries no Bootstrap, so everything here is bespoke Tailwind-adjacent
   CSS rather than Bootstrap-class shims. ── */
#bus-map-container .bt-fit-btn {
  position: absolute; bottom: 16px; right: 12px; z-index: 1000;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; border: none;
  background: #fff; color: #334155; font-weight: 800; font-size: 11px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12); cursor: pointer; transition: all 0.15s;
}
#bus-map-container .bt-fit-btn:hover { background: #2563eb; color: #fff; }

#bus-map-container .bt-mylocation-btn {
  position: absolute; bottom: 56px; right: 12px; z-index: 1000;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; border: none;
  background: #fff; color: #334155; font-weight: 800; font-size: 11px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12); cursor: pointer; transition: all 0.15s;
}
#bus-map-container .bt-mylocation-btn:hover { background: #0ea5e9; color: #fff; }
#bus-map-container .bt-mylocation-btn.bt-mylocation-active { background: #0ea5e9; color: #fff; }
#bt-mylocation-toggle-inline.bt-mylocation-active { background: rgba(14,165,233,0.18) !important; color: #0ea5e9 !important; }

/* Subtle, cohesive tile tone — only the base map, never markers/circles */
.leaflet-tile-pane { filter: saturate(0.9) brightness(1.02); }

/* Zoom buttons: small, half-transparent pair instead of Leaflet's
   default solid squares (which looked out of place floating on the map). */
.leaflet-control-zoom {
  border: 1px solid rgba(226,232,240,0.6) !important;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08) !important;
}
.leaflet-control-zoom a {
  width: 22px !important; height: 22px !important; line-height: 22px !important;
  background: rgba(255,255,255,0.5) !important; color: #475569 !important;
  font-weight: 700 !important; font-size: 13px !important; border: none !important;
}
.leaflet-control-zoom a:hover { background: rgba(255,255,255,0.75) !important; color: #2563eb !important; }
.leaflet-control-zoom-in { border-radius: 10px 10px 0 0 !important; }
.leaflet-control-zoom-out { border-radius: 0 0 10px 10px !important; }

/* Attribution: just a quiet pill in the corner, not a banner */
.leaflet-control-attribution {
  background: rgba(255,255,255,0.82) !important;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid #e2e8f0 !important; box-shadow: none !important;
  border-radius: 999px !important;
  padding: 2px 9px !important;
  font-size: 9px !important; color: #94a3b8 !important;
  line-height: 1.6;
}
.leaflet-control-attribution a { color: #94a3b8 !important; }

.bt-empty, .bt-info-empty {
  color: #94a3b8; font-size: 11px; font-weight: 700;
  background: #fff; border: 1px solid #e2e8f0;
}
.bt-empty {
  text-align: center; padding: 16px 14px; border-radius: 16px;
}
.bt-empty i { display: block; margin: 0 auto 6px; color: #cbd5e1; }
.bt-info-empty {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 14px; font-size: 10px;
}
.bt-info-empty i { color: #cbd5e1; }

.bt-fleet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px 4px;
}
.bt-fleet-title {
  font-size: 11px; font-weight: 800; color: #475569;
  display: flex; align-items: center; gap: 6px;
}
.bt-fleet-count {
  background: #eff6ff; border: 1px solid #dbeafe; color: #2563eb;
  font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px;
}
.bt-fleet-actions { display: flex; gap: 5px; }
.bt-fleet-actions button {
  border: 1px solid #e2e8f0; background: #fff; color: #94a3b8;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 3px 9px; border-radius: 999px; cursor: pointer; transition: all 0.15s;
}
.bt-fleet-actions button:hover { background: #2563eb; border-color: #2563eb; color: #fff; }

/* Same reasoning as .bt-info-card above — these rows fill the sidebar's
   interior, so a solid background here defeats the container's own
   translucency almost entirely. */
.bt-list-item {
  padding: 6px 9px; border-radius: 12px; border: 1px solid #e2e8f0;
  background: rgba(255,255,255,0.55); cursor: pointer; transition: all 0.15s ease;
}
.bt-list-item:hover { border-color: #93c5fd; background: rgba(248,250,252,0.75); }
.bt-list-item.active { border-color: #2563eb; background: rgba(239,246,255,0.8); box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
.bt-list-item.dimmed { opacity: 0.45; }

.bt-check {
  width: 14px; height: 14px; flex-shrink: 0; cursor: pointer;
  accent-color: #2563eb; border-radius: 3px;
}
/* Beats the global "Better touch targets" mobile rule (input[type=checkbox]
   { width/height: 20px !important }) — 20px reads oversized against the
   22px avatar in this compact row, so pin it back down on small screens. */
#bus-list input.bt-check {
  width: 15px !important; height: 15px !important;
}

.bt-watch-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #7c3aed; display: inline-block; margin-right: 4px;
  animation: btWatchPulse 1.6s ease-in-out infinite;
}
@keyframes btWatchPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(1.35); }
}
.bt-watch-count { color: #7c3aed; font-weight: 800; }

/* Fleet list row — row 1: checkbox + name (never truncated; the panel's
   own width grows to fit, see #bus-sidebar). Row 2: status badge +
   location. Mobile media query below just shrinks these, doesn't
   restructure them. */
.bt-row1 { display: flex; align-items: center; gap: 8px; }
.bt-row1-name { font-size: 13px; font-weight: 800; color: #1e293b; white-space: nowrap; }
/* Animated moving/idle indicator right after the name — quick at-a-
   glance state without having to read the row 2 badge text. */
.bt-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; animation: btStatusPulse 1.8s ease-in-out infinite; }
.bt-status-dot.moving { background: #22c55e; box-shadow: 0 0 0 rgba(34,197,94,0.5); }
.bt-status-dot.idle   { background: #f97316; box-shadow: 0 0 0 rgba(249,115,22,0.5); }
@keyframes btStatusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.3); }
}
.bt-row2 { display: flex; align-items: center; gap: 6px; margin-top: 4px; white-space: nowrap; }
.bt-badge-mini {
  padding: 2px 8px; border-radius: 999px; font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.03em; flex-shrink: 0;
}
.bt-badge-mini.moving { background: rgba(37,99,235,0.12); color: #2563eb; }
.bt-badge-mini.idle   { background: rgba(180,83,9,0.12); color: #b45309; }
.bt-row2 .bt-addr { font-size: 10px; color: #94a3b8; font-weight: 600; }

/* Solid white here would fill nearly the whole sidebar and mask its own
   transparency (see #bus-sidebar) almost completely, since this card is
   what actually occupies most of that space — kept translucent too. */
.bt-info-card { background: rgba(255,255,255,0.6); border: 1px solid #e2e8f0; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.bt-info-head {
  padding: 7px 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(135deg,#eff6ff,#eef2ff); border-bottom: 1px solid #e2e8f0;
}
.bt-badge { padding: 3px 8px; border-radius: 999px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.bt-badge.moving { background: #dbeafe; color: #2563eb; }
.bt-badge.idle   { background: #fef3c7; color: #b45309; }
.bt-info-body { padding: 7px 11px 8px; display: flex; flex-direction: column; gap: 5px; }
.bt-stat { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 4px 7px; }
.bt-stat-label { font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; }
.bt-stat-val { font-size: 12px; font-weight: 800; color: #1e293b; }
.bt-info-addr { display: flex; gap: 6px; font-size: 10px; color: #475569; font-weight: 600; line-height: 1.3; }
.bt-info-addr i { flex-shrink: 0; margin-top: 1px; }
.bt-eta { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #eef2ff; border: 1px solid #e0e7ff; border-radius: 10px; padding: 4px 7px; font-size: 10px; font-weight: 700; color: #4338ca; }

/* Leaflet markers */
.bt-marker-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.bt-marker-pulse { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid #2563eb; animation: btMarkerRing 2s ease-out infinite; pointer-events: none; }
@keyframes btMarkerRing { 0% { transform: scale(0.9); opacity: 0.7; } 100% { transform: scale(1.6); opacity: 0; } }
.bt-marker-circle { border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,0.28); position: relative; z-index: 1; border: 2px solid #fff; }
.bt-marker-circle svg { width: 18px; height: 18px; fill: #fff; }
.bt-marker-label { background: rgba(15,23,42,0.92); color: #fff; font-weight: 700; font-size: 10px; padding: 3px 9px; border-radius: 8px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.bt-marker-label::before { display: none; }

/* Geofence alert toasts */
#geofenceAlerts .alert {
  position: relative; pointer-events: auto;
  padding: 8px 36px 8px 14px; border-radius: 999px;
  font-size: 11px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  animation: btSlideIn 0.3s ease;
}
@keyframes btSlideIn { from { transform: translateX(-16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
#geofenceAlerts .alert-success { background: #dcfce7; color: #15803d; }
#geofenceAlerts .alert-warning { background: #fef3c7; color: #b45309; }
#geofenceAlerts .btn-close {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; font-size: 16px; line-height: 1;
  cursor: pointer; opacity: 0.5;
}
#geofenceAlerts .btn-close:hover { opacity: 1; }

/* ── Full-bleed map-app layout, all screen sizes ─────────────────────────
   The map is the base layer filling the whole panel; the toolbar, fleet
   list and fit/zoom controls all float over it instead of sitting in a
   side-by-side flex row. .bt-shell sits inside the admin shell's own
   padded content wrapper (`px-4 pb-4` / `md:px-8 md:pb-8`) — negative
   margins matching that padding pull it out to the true edge of the
   viewport instead of leaving a visible gutter on every side. ── */
.bt-shell {
  position: relative; overflow: hidden;
  margin: 0 -16px -16px;
}
@media (min-width: 768px) {
  .bt-shell { margin: 0 -32px -32px; }
}

#bus-map-container { position: absolute; inset: 0; }

#geofenceAlerts {
  position: absolute; top: 68px; left: 10px; right: 10px; z-index: 999;
}

/* Fleet status summary (Total/Moving/Engine Off/Idle/Offline) — same
   overlay row as #geofenceAlerts, just below the toolbar; alerts render
   above this when present since geofence events matter more than a
   glanceable count. */
#bt-status-bar { position: absolute; top: 68px; left: 10px; right: 10px; z-index: 998; }

/* Live state label following the route-playback bus marker. */
.bt-playback-tooltip { font-size: 9px; font-weight: 800; padding: 2px 6px; }
.bt-status-card {
  flex: 0 0 auto; display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(226,232,240,0.6); border-radius: 999px;
  padding: 4px 9px 4px 5px; box-shadow: 0 2px 8px rgba(15,23,42,0.08);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
.bt-status-card-icon {
  width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.bt-status-card-icon i { width: 11px; height: 11px; }
.bt-status-card-val { font-size: 11px; font-weight: 900; color: #1e293b; line-height: 1; }
.bt-status-card-label { font-size: 6.5px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: .02em; line-height: 1; margin-top: 1px; }

#bt-toolbar {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 1000;
}

/* List/Route tab switcher — lives in the toolbar next to Export so it's
   always a real, properly-sized clickable button on every screen width
   (it used to sit in the sidebar's mobile-only header, which meant it had
   no styling at all — and was therefore tiny/unclickable — above 767px). */
.bt-toolbar-tab-btn {
  padding: 6px 8px; border-radius: 999px; border: 1px solid #e2e8f0;
  background: #fff; color: #475569; font-size: 10px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
@media (min-width: 640px) { .bt-toolbar-tab-btn { padding: 6px 14px; } }
.bt-toolbar-tab-btn:hover { background: #f8fafc; }
.bt-toolbar-tab-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.bt-toolbar-tab-btn i { pointer-events: none; flex-shrink: 0; }

.bt-route-bus-option {
  padding: 8px 10px; border-radius: 8px; font-size: 12px; font-weight: 700;
  color: #334155; cursor: pointer; transition: background 0.1s;
}
.bt-route-bus-option:hover { background: #f1f5f9; }

/* Payroll: Additions/Deductions category filter + the Logical/Manual/
   Import mode switcher inside a field's Values workspace — same small
   pill-button look, two different contexts. */
.pr-cat-filter-btn, .pr-fv-mode-btn {
  padding: 7px 14px; border-radius: 999px; border: 1px solid #e2e8f0;
  background: #fff; color: #64748b; font-size: 10px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; transition: all 0.15s;
}
.pr-cat-filter-btn:hover, .pr-fv-mode-btn:hover { background: #f8fafc; }
.pr-cat-filter-btn.active, .pr-fv-mode-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Section entry "Payment Style" switcher (EMI / One-Time / Monthly, Until
   Stopped) — a 3-up grid rather than a pill row, so the longer "Monthly,
   Until Stopped" label has room without forcing the others to wrap oddly. */
.pr-sentry-mode-btn {
  padding: 8px 6px; border-radius: 10px; border: 1px solid #e2e8f0;
  background: #fff; color: #64748b; font-size: 9px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.03em; cursor: pointer; transition: all 0.15s;
  line-height: 1.3;
}
.pr-sentry-mode-btn:hover { background: #f8fafc; }
.pr-sentry-mode-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.pr-sentry-mode-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.pr-sentry-mode-btn:disabled:hover { background: #fff; }
.pr-sentry-mode-btn.active:disabled:hover { background: #2563eb; }

#bus-sidebar {
  position: absolute; z-index: 900;
  /* Semi-transparent + blurred rather than solid white — the fleet list
     sits directly on top of the map on every screen size (see the
     full-bleed layout note above), so a solid background hides whatever
     part of the map is underneath it the whole time it's open. */
  background: rgba(255,255,255,0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(15,23,42,0.18);
  overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
}

/* Floating "follow" card — shown only while a single bus is selected
   (see selectBus/exitFollowMode in bus-tracking.js), pinned to the map's
   left edge (out of the way of the fleet sidebar, which floats on the
   right/bottom) instead of requiring that sidebar to be open. Very
   light (~15% opacity) — this sits directly over the map while
   following, so it needs to stay unobtrusive, not just translucent. */
#bt-follow-card {
  position: absolute; left: 10px; top: 68px; z-index: 980;
  width: 190px; max-width: 46vw;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(226,232,240,0.5); border-radius: 14px;
  box-shadow: 0 6px 20px rgba(15,23,42,0.10);
  padding: 8px 10px;
}

/* Desktop/tablet: sidebar floats as a card on the right; always open,
   no toggle needed — there's room for both map and list at once. The
   merged header (Fit-all + list-toggle icons, mobile-only) stays hidden
   here since desktop already has its own persistent bottom-left fit
   button and never collapses the sidebar at all. */
@media (min-width: 768px) {
  #bus-sidebar {
    top: 68px; right: 10px; bottom: 10px; width: 300px;
    border-radius: 20px; padding: 8px;
  }
  #bus-map-container .bt-fit-btn { left: 56px; right: auto; }
  .bt-sheet-handle { display: none; }
  #bt-panel-header { display: none; }
}

/* Mobile: Fit-all + the list-toggle live inside the sidebar's own header
   instead of as separate floating buttons — collapsing now just hides
   the list body (#bt-panel-body), leaving that two-icon header as the
   only thing on screen, rather than sliding the whole panel away. Width
   is content-driven (not a fixed narrow column) so a bus's full name
   never truncates, capped so a very long name can't take over the
   screen. */
@media (max-width: 767px) {
  #geofenceAlerts { right: 100px; }
  #bus-map-container .bt-fit-btn, #bus-map-container .bt-mylocation-btn { display: none; }

  #bt-panel-header { padding: 2px; }
  .bt-fit-btn-inline {
    width: 30px; height: 30px; border-radius: 999px; border: none;
    background: rgba(15,23,42,0.06); color: #334155;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.15s;
  }
  .bt-fit-btn-inline:hover { background: rgba(37,99,235,0.15); color: #2563eb; }

  /* Chrome on Android auto-inflates any text it judges "too small to
     read" (a11y font-boosting) — silently overriding every small
     font-size below unless disabled here. This was making the whole
     panel render far bigger than specified regardless of the px values. */
  #bus-sidebar, #bus-sidebar * { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  #bus-sidebar {
    top: 68px; right: 10px; bottom: 10px; left: auto;
    /* Name still isn't truncated (row 1), but the address (row 2) now
       is — an address line was often far longer than any bus name,
       so sizing the whole panel to fit it made "dynamic width" useless;
       max-width here is now just a sane ceiling, not something long
       addresses were routinely hitting anyway. */
    width: auto; max-width: 148px; min-width: 60px;
    /* Lighter than the desktop sidebar (0.72) — this close to the map
       edge it needs to stay unobtrusive, not just translucent. */
    background: rgba(255,255,255,0.18);
    border-radius: 16px; padding: 3px;
  }
  #bus-sidebar.bt-collapsed { bottom: auto; }
  #bus-sidebar.bt-collapsed #bt-panel-body { display: none; }
  /* The List/Route tab buttons live in the always-visible toolbar now
     (not in this collapsible panel), so tapping "Route" while collapsed
     is already a one-tap way in — switchSidebarTab() auto-expands. */

  .bt-sheet-handle { display: none; }

  /* Row 1: checkbox + name (no truncation). Row 2: status badge + the
     location, truncated with an ellipsis instead of forcing the panel
     wide enough for a full address. */
  .bt-list-item { padding: 4px 6px; }
  .bt-row1 { display: flex; align-items: center; gap: 5px; line-height: 1; }
  .bt-row1-name { font-size: 10px; font-weight: 800; color: #1e293b; white-space: nowrap; line-height: 1; }
  .bt-status-dot { width: 5px; height: 5px; }
  .bt-row2 { display: flex; align-items: center; gap: 4px; margin-top: 0; line-height: 1; }
  .bt-badge-mini {
    padding: 1px 5px; border-radius: 999px; font-size: 6.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.02em; flex-shrink: 0;
  }
  .bt-badge-mini.moving { background: rgba(37,99,235,0.15); color: #2563eb; }
  .bt-badge-mini.idle   { background: rgba(180,83,9,0.15); color: #b45309; }
  .bt-row2 .bt-addr { font-size: 7px; color: #64748b; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  #bus-info-panel { display: none; }

  /* "Fleet N" + All/None buttons — stacked and shrunk to a minimum so
     they don't force the panel wider just to fit this one row. */
  .bt-fleet-head { flex-direction: column; align-items: stretch; gap: 2px; padding: 2px; }
  .bt-fleet-title { font-size: 8px; justify-content: center; }
  .bt-fleet-actions { gap: 2px; }
  .bt-fleet-actions button { flex: 1; padding: 1.5px 0; font-size: 7px; }
}

/* ── Forum module ──────────────────────────────────────────────────────── */
.forum-filter-chip {
  padding: 8px 14px; border-radius: 999px; font-size: 11px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
  background: #fff; border: 1px solid #e2e8f0; color: #64748b;
  transition: all 0.16s; flex-shrink: 0;
}
.forum-filter-chip:hover { border-color: #a5b4fc; color: #4f46e5; }
.forum-filter-chip.active {
  background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff;
  border-color: transparent; box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.forum-composer-trigger:hover { transform: translateY(-1px); }
.forum-card { transition: box-shadow 0.16s; }
.forum-card:hover { box-shadow: 0 4px 20px rgba(15,23,42,0.06); }

/* ── Accounts Admin (desktop) ──────────────────────────────────────────
   Plain app layout: a sticky left nav (Overview / Masters / Transactions /
   Reports) and a page area with its own title bar and actions. The
   renderers still emit the older tp-* class names for tables, inputs and
   buttons; they're styled here in the app's slate/blue palette. Scoped
   under .ac-shell so nothing leaks, and in px because applyTheme()
   rescales the root font-size. */
.ac-shell {
  display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 20px; align-items: start;
  color: #1e293b; font-size: 13px; line-height: 1.5;
}
.ac-side {
  position: sticky; top: 12px; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
  padding: 12px 8px; max-height: calc(100vh - 110px); overflow-y: auto;
}
.ac-side-head { display: flex; align-items: center; gap: 10px; padding: 4px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid #f1f5f9; color: #2563eb; }
.ac-side-head b { display: block; color: #0f172a; font-size: 14px; font-weight: 900; }
.ac-side-head span { display: block; color: #94a3b8; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.ac-nav-section { color: #94a3b8; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; padding: 12px 10px 4px; }
.ac-nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: none; background: none;
  border-radius: 10px; color: #475569; font-size: 12.5px; font-weight: 700; text-align: left; cursor: pointer;
}
.ac-nav-item:hover { background: #f1f5f9; color: #0f172a; }
.ac-nav-item.active { background: #2563eb; color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.25); }
.ac-nav-item:focus-visible, .ac-btn:focus-visible, .ac-quick:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.ac-main { min-width: 0; }
.ac-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ac-titlewrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ac-titlewrap h2 { font-size: 22px; font-weight: 900; color: #0f172a; letter-spacing: -.01em; line-height: 1.15; }
.ac-back { width: 32px; height: 32px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; color: #475569; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.ac-back:hover { background: #f1f5f9; }
.ac-crumbs { font-size: 11px; font-weight: 700; color: #94a3b8; min-height: 16px; }
.ac-crumbs a { color: #64748b; text-decoration: none; }
.ac-crumbs a:hover { color: #2563eb; text-decoration: underline; }
.ac-crumbs span { margin: 0 3px; }
.ac-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid #e2e8f0;
  background: #fff; color: #334155; font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; cursor: pointer;
}
.ac-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.ac-btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.ac-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.ac-btn-ghost { color: #64748b; }
.ac-shell kbd { font-family: inherit; font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 5px; background: rgba(15,23,42,.08); color: inherit; opacity: .8; letter-spacing: 0; }
.ac-btn-primary kbd { background: rgba(255,255,255,.2); }

.ac-body { min-height: 300px; }
.ac-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px; }
.ac-card h3 { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin-bottom: 12px; }
.ac-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ac-card-head a { font-size: 11px; font-weight: 800; color: #2563eb; }
.ac-grid2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; }
@media (max-width: 1100px) { .ac-grid2 { grid-template-columns: 1fr; } }
.ac-muted { color: #94a3b8; font-size: 11.5px; font-weight: 600; }
.ac-strong { color: #0f172a; font-weight: 900; font-size: 14px; }
.ac-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ac-formfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.ac-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .ac-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ac-kpi { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 14px 16px; border-left: 4px solid #cbd5e1; }
.ac-kpi span { display: block; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; }
.ac-kpi b { display: block; font-size: 20px; font-weight: 900; color: #0f172a; font-variant-numeric: tabular-nums; margin-top: 2px; }
.ac-kpi.good { border-left-color: #10b981; }
.ac-kpi.bad { border-left-color: #ef4444; }
.ac-kpi.bad b { color: #b91c1c; }
.ac-quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ac-quick {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid #e2e8f0; background: #f8fafc; color: #1e293b; font-size: 12px; font-weight: 800; cursor: pointer; text-align: left;
}
.ac-quick:hover { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }

.ac-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: #f1f5f9; border-radius: 12px; margin-bottom: 14px; }
.ac-seg button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; border: none; background: none; color: #64748b; font-size: 12px; font-weight: 800; cursor: pointer; }
.ac-seg button:hover:not(:disabled):not(.active) { color: #0f172a; background: #fff; }
.ac-seg button.active { background: #fff; color: #1d4ed8; box-shadow: 0 1px 3px rgba(15,23,42,.12); cursor: default; }
.ac-seg button:disabled { opacity: .45; cursor: not-allowed; }
.ac-entry-head { font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; margin: 14px 0 6px; }

.ac-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; font-size: 10.5px; font-weight: 800; }
.ac-pill-asset { background: #ecfdf5; color: #047857; }
.ac-pill-liability { background: #fef2f2; color: #b91c1c; }
.ac-pill-equity { background: #f5f3ff; color: #6d28d9; }
.ac-pill-income { background: #eff6ff; color: #1d4ed8; }
.ac-pill-expense { background: #fff7ed; color: #c2410c; }
.ac-neg { color: #b91c1c; }
.ac-inactive td { color: #94a3b8; }

/* Shared by every page's tables, forms and small buttons. */
.ac-shell .tp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
.ac-shell .tp-table th { text-align: left; background: #f8fafc; color: #64748b; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; padding: 9px 12px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.ac-shell .tp-table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; color: #1e293b; vertical-align: middle; }
.ac-shell .tp-table tbody tr:last-child td { border-bottom: none; }
.ac-shell .tp-table tbody tr:hover td { background: #f8fafc; }
.ac-shell .tp-table .tp-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-shell .tp-table tfoot td { background: #f8fafc; border-top: 2px solid #e2e8f0; font-weight: 900; color: #0f172a; }
.ac-shell .ac-row-group td { font-weight: 800; color: #0f172a; background: #fbfdff; }
.ac-shell .ac-row-group td i { display: inline-block; vertical-align: -2px; color: #94a3b8; margin-right: 4px; }
.ac-shell .ac-click { cursor: pointer; }
.ac-shell .tp-empty { color: #94a3b8; text-align: center; padding: 24px; font-size: 12px; font-weight: 600; }

.ac-shell .tp-group-head { font-weight: 900; color: #0f172a; font-size: 13px; padding: 14px 0 6px; border-top: 1px solid #e2e8f0; margin-top: 6px; }
.ac-shell .tp-group-head:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.ac-shell .tp-inline-btn { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid #e2e8f0; color: #334155; padding: 4px 10px; font-size: 10.5px; font-weight: 800; cursor: pointer; margin-right: 6px; border-radius: 8px; }
.ac-shell .tp-inline-btn:hover { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }

.ac-shell .tp-voucher-head { display: grid; grid-template-columns: 160px 160px minmax(0, 1fr); gap: 12px; margin-bottom: 4px; }
@media (max-width: 1100px) { .ac-shell .tp-voucher-head { grid-template-columns: 1fr 1fr; } }
.ac-shell .tp-field-label { color: #64748b; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; display: block; margin-bottom: 4px; }
.ac-shell .tp-input, .ac-shell .tp-select { width: 100%; background: #f8fafc; border: 1px solid #e2e8f0; color: #0f172a; font-size: 13px; font-weight: 700; padding: 7px 10px; border-radius: 10px; }
.ac-shell .tp-input:focus, .ac-shell .tp-select:focus { outline: none; border-color: #93c5fd; background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.ac-shell .tp-totals-row { display: flex; align-items: center; justify-content: flex-end; gap: 20px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #f1f5f9; font-weight: 800; color: #475569; font-variant-numeric: tabular-nums; }
.ac-shell .tp-totals-row b { color: #0f172a; }
.ac-shell .tp-flag-balanced, .ac-shell .text-emerald-600 { color: #059669; }
.ac-shell .tp-flag-unbalanced, .ac-shell .text-red-500 { color: #dc2626; }

.ac-shell .tp-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ac-shell .tp-two-col > div { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
.ac-shell .tp-col-head { background: #f8fafc; color: #64748b; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; padding: 10px 14px; border-bottom: 1px solid #e2e8f0; }
.ac-shell .tp-line-plain { display: flex; justify-content: space-between; gap: 12px; padding: 7px 14px; border-bottom: 1px solid #f1f5f9; }
.ac-shell .tp-line-plain .tp-num, .ac-shell .tp-total-line .tp-num { font-variant-numeric: tabular-nums; }
.ac-shell .tp-total-line { display: flex; justify-content: space-between; padding: 10px 14px; background: #f8fafc; color: #0f172a; font-weight: 900; border-top: 2px solid #e2e8f0; }

/* Mobile: a genuinely separate touch rendering, not a squeezed Tally
   grid — Tally's keyboard-driven UI has no faithful phone equivalent,
   so phones get plain stacked cards driving the same data loaders. */
.tpm-shell { background: #f8fafc; min-height: 100%; margin: 0 -16px -16px; padding: 12px; }
.tpm-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.tpm-header h2 { font-weight: 900; font-size: 1.1rem; color: #1e293b; }
.tpm-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; width: 100%; }
.tpm-card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tpm-actionbar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 0 2px; background: linear-gradient(transparent, #f8fafc 30%); }
.tpm-btn { flex: 1; padding: 12px; border-radius: 12px; font-weight: 900; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; text-align: center; min-height: 44px; border: none; }

/* Admission Admin — application editor's section tab bar (Application/
   Student/Father/Mother/Guardian/Tables), same shape as ccpc-admission's
   own .ftab/.ftab.active it was ported from. */
.adm-ftab { padding: 8px 16px; border-radius: 10px; font-weight: 900; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #64748b; background: #f8fafc; border: 1px solid #e2e8f0; white-space: nowrap; cursor: pointer; }
.adm-ftab.adm-ftab-on { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Applications tab, view-only committee grant ('applications':'view' but
   not 'edit') -- hide the bulk-select checkboxes, status-change select, and
   delete button; show a plain read-only status badge instead. Toggled via
   _admApplyModuleTabGating adding/removing .adm-view-only on #admAdminAppList. */
#admAdminAppList.adm-view-only .adm-row-select-cell,
#admAdminAppList.adm-view-only #adm-bulk-select-all,
#admAdminAppList.adm-view-only .adm-row-status-select,
#admAdminAppList.adm-view-only .adm-row-delete-btn { display: none !important; }
#admAdminAppList.adm-view-only .adm-row-status-badge { display: inline-block !important; }

/* Scan tab's full-screen camera overlay: the status banner is a fixed
   bottom pill shown on top of the live camera feed (or the plain page when
   the camera isn't open) -- :empty keeps it invisible with no stray empty
   bar when there's nothing to say, with no JS call-site changes needed
   anywhere that already just sets its textContent. */
#admCandScanNote:empty { display: none; }

/* Admission Admin — Admit Card Designer (settings form + live preview) and
   Form Designer (drag/resize canvas). Ported verbatim from ccpc-admission's
   own styles.css (.designer-layout/.dgroup/.toggle-lbl/.fd-*/.fdc*/.pp-*),
   just scoping #props-panel to #adm-fd-props-panel to match this module's
   adm- prefixed element ids. */
.designer-layout { display:flex; gap:0; min-height: calc(100vh - 190px); background:#fff; border:1px solid #e2e8f0; border-radius:16px; overflow:hidden; box-shadow:0 1px 4px rgba(0,0,0,.06); }
.designer-settings { width:300px; flex-shrink:0; border-right:1px solid #e2e8f0; overflow-y:auto; background:#fafafa; }
.designer-preview { flex:1; display:flex; flex-direction:column; min-width:0; background:#f0f0f0; }
.designer-preview-bar { display:flex; align-items:center; justify-content:space-between; padding:8px 14px; background:#fff; border-bottom:1px solid #e2e8f0; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.08em; color:#64748b; }
.preview-refresh-btn { display:inline-flex; align-items:center; gap:4px; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.07em; color:#2563eb; background:none; border:none; cursor:pointer; transition:color .15s; }
.preview-refresh-btn:hover { color:#000; }
.preview-iframe { flex:1; width:100%; border:none; }

.dgroup { border-bottom:1px solid #e2e8f0; }
.dgroup-hdr { display:flex; align-items:center; gap:7px; padding:10px 14px; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.07em; color:#475569; cursor:pointer; list-style:none; user-select:none; background:#fafafa; transition:background .1s; }
.dgroup-hdr:hover { background:#f1f5f9; }
.dgroup-hdr::-webkit-details-marker { display:none; }
.dgroup[open] .dgroup-hdr { color:#1e293b; background:#f8fafc; }
.dgroup-body { padding:10px 14px; background:#fff; }

.toggle-lbl { display:flex; align-items:center; gap:6px; font-size:11px; font-weight:600; color:#475569; cursor:pointer; }
.toggle-lbl input[type=checkbox] { width:14px; height:14px; accent-color:#2563eb; cursor:pointer; }
.color-picker { width:100%; height:34px; border:1.5px solid #e2e8f0; border-radius:8px; cursor:pointer; padding:2px; }
.sec-group { padding:8px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; }
.fields-grid { display:grid; grid-template-columns:1fr 1fr; gap:4px; }

.tpl-bar { display:flex; align-items:center; gap:6px; flex-wrap:wrap; padding:7px 10px; background:#f0fdf4; border:1.5px solid #bbf7d0; border-radius:10px; margin-bottom:8px; }
.fd-toolbar { display:flex; align-items:center; gap:5px; flex-wrap:wrap; padding:8px 10px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:12px; margin-bottom:10px; }
.fd-tool { display:inline-flex; align-items:center; gap:4px; padding:5px 9px; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.05em; background:#fff; border:1.5px solid #e2e8f0; border-radius:8px; cursor:pointer; color:#475569; transition:all .12s; white-space:nowrap; }
.fd-tool:hover { background:#f1f5f9; border-color:#cbd5e1; color:#0f172a; }

.fdc { border:1.5px dashed #93c5fd; transition:border-color .1s; user-select:none; }
.fdc:hover { border-color:#60a5fa; }
.fdc-sel { border:2px solid #2563eb !important; box-shadow:0 0 0 3px rgba(37,99,235,.15); z-index:10; }
.fdc-resize { position:absolute; right:0; bottom:0; width:10px; height:10px; background:#2563eb; cursor:se-resize; border-radius:2px 0 0 0; z-index:20; }
.fdc-del, .fdc-dup, .fdc-ord { position:absolute; top:0; width:18px; height:18px; border:none; color:#fff; font-size:11px; line-height:1; cursor:pointer; z-index:20; display:flex; align-items:center; justify-content:center; }
.fdc-del  { right:0;    background:#ef4444; border-radius:0 0 0 4px; }
.fdc-dup  { right:18px; background:#2563eb; border-radius:0 0 0 4px; font-size:9px; }
.fdc-ord  { right:36px; background:#64748b; border-radius:0 0 0 4px; font-size:10px; }

.fd-fields-panel { padding:8px; font-size:11px; }
.fd-field-group { margin-bottom:8px; }
.fd-field-grouphdr { font-size:9px; font-weight:900; text-transform:uppercase; letter-spacing:.08em; color:#64748b; padding:2px 2px 4px; border-bottom:1px solid #f1f5f9; margin-bottom:3px; }
.fd-field-row { display:flex; align-items:center; gap:5px; padding:3px 4px; border-radius:6px; }
.fd-field-row.fd-field-on { background:#eff6ff; }
.fd-field-dot { width:14px; flex-shrink:0; text-align:center; font-size:10px; font-weight:900; color:#2563eb; }
.fd-field-name { flex:1; font-size:10.5px; font-weight:600; color:#475569; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.fd-field-row.fd-field-on .fd-field-name { color:#1e293b; font-weight:700; }
.fd-field-count { font-size:9px; font-weight:900; color:#2563eb; flex-shrink:0; }
.fd-field-dup { flex-shrink:0; width:18px; height:18px; border:none; border-radius:5px; background:#e2e8f0; color:#475569; font-size:10px; font-weight:900; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.fd-field-row.fd-field-on .fd-field-dup { background:#2563eb; color:#fff; }
.fd-field-dup:hover { opacity:.85; }

#adm-fd-props-panel { padding:10px; }
.pp-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.pp-type-lbl { font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.08em; color:#1e293b; }
.pp-del-btn { font-size:10px; font-weight:700; color:#ef4444; background:none; border:none; cursor:pointer; }
.pp-sec { font-size:9px; font-weight:900; text-transform:uppercase; letter-spacing:.1em; color:#64748b; margin:8px 0 4px; border-bottom:1px solid #f1f5f9; padding-bottom:2px; }
.pp-row { margin-bottom:5px; }
.pp-lbl { font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:#94a3b8; display:block; margin-bottom:2px; }
.pp-inp { width:100%; padding:4px 7px; font-size:11px; font-weight:600; background:#f8fafc; border:1.5px solid #e2e8f0; border-radius:7px; outline:none; color:#1e293b; font-family:inherit; box-sizing:border-box; }
.pp-inp:focus { border-color:#2563eb; }
.pp-color { width:100%; height:28px; border:1.5px solid #e2e8f0; border-radius:7px; cursor:pointer; padding:1px; box-sizing:border-box; }
.pp-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:4px; }
.pp-grid4 { display:grid; grid-template-columns:1fr 1fr 1fr 1fr; gap:3px; }
.pp-chkrow { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:4px; }
.pp-chk { display:flex; align-items:center; gap:4px; font-size:11px; font-weight:600; color:#475569; cursor:pointer; }
.pp-chk input { width:13px; height:13px; accent-color:#2563eb; cursor:pointer; }
.pp-col-card { border:1px solid #e2e8f0; border-radius:8px; padding:6px; margin-bottom:5px; background:#fafafa; }
.pp-col-hdr { display:flex; align-items:center; justify-content:space-between; margin-bottom:4px; font-size:9px; font-weight:900; text-transform:uppercase; color:#64748b; }
.pp-col-del { background:none; border:none; color:#ef4444; cursor:pointer; font-size:14px; line-height:1; }
.pp-add-col { width:100%; padding:5px; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.06em; color:#2563eb; background:#eff6ff; border:none; border-radius:8px; cursor:pointer; margin-bottom:6px; }
.pp-note { font-size:9px; color:#94a3b8; margin-bottom:4px; line-height:1.4; }
.pp-fgrp { margin-bottom:5px; }
.pp-fgrp-hdr { font-size:8.5px; font-weight:900; text-transform:uppercase; letter-spacing:.08em; color:#6366f1; padding:3px 0 2px; border-bottom:1px solid #e0e7ff; margin-bottom:3px; }
.pp-fgrp-body { display:flex; flex-wrap:wrap; gap:3px; }
.pp-selfld-item { display:inline-block; padding:2px 7px; font-size:9.5px; font-weight:600; background:#f1f5f9; border:1px solid #e2e8f0; border-radius:5px; cursor:pointer; color:#475569; transition:all .12s; user-select:none; }
.pp-selfld-item:hover { background:#e0e7ff; border-color:#a5b4fc; color:#3730a3; }
.pp-selfld-on { background:#dbeafe; border-color:#93c5fd; color:#1d4ed8; font-weight:900; }

/* Custom Count cards (GridStack, Dashboard Rearrange mode) -- GridStack's
   own default resize handles are a tiny (20px) low-contrast gray icon on
   corners and a fully INVISIBLE hit-strip on edges (by design, meant to
   just change the mouse cursor on hover) -- reported live as "nothing
   showing to resize". Replaced with large, solid, high-contrast handles
   that are impossible to miss and easy to grab on a touchscreen, and
   forced permanently visible (no hover/device-detection dependency). */
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-handle {
  opacity: 1 !important;
}
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-nw,
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-ne,
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-se,
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-sw {
  width: 26px !important; height: 26px !important;
  background-color: #2563eb !important;
  background-image: none !important;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(15,23,42,.4);
}
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-n,
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-s {
  height: 10px !important;
  background: rgba(37,99,235,.3) !important;
  border-radius: 5px;
}
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-e,
#adm-custom-counters-cards .grid-stack-item > .ui-resizable-w {
  width: 10px !important;
  background: rgba(37,99,235,.3) !important;
  border-radius: 5px;
}
