/*
 * LMS UI SYSTEM — one look for admin, dashboards and the portals.
 * Loaded LAST on every page (admin/base.html and portal base.html), so it wins over
 * the legacy admin_custom.css / portal.css rules without touching them.
 *
 * Brand colour: every colour below derives from --p-* (admin, set per brand by
 * includes/brand_theme_vars.html) or --primary (portal), so a brand's theme applies
 * everywhere. Fallbacks keep unthemed pages (billing checkout, login) on-brand too.
 *
 * Contents: 1 tokens · 2 typography · 3 buttons · 4 forms · 5 cards & tiles ·
 *           6 tables · 7 badges · 8 page hero · 9 changelist chrome · 10 utilities ·
 *           11 brand coverage for legacy chrome · 12 dark mode
 */

/* ───────────────────────── 1 · TOKENS ───────────────────────── */
:root {
  --ui-50:  var(--p-50,  #f0fdfa);
  --ui-100: var(--p-100, #ccfbf1);
  --ui-200: var(--p-200, #99f6e4);
  --ui-500: var(--p-500, #14b8a6);
  --ui-600: var(--p-600, #0d9488);
  --ui-700: var(--p-700, var(--primary-dark, #0f766e));   /* buttons, links: 5:1 with white */
  --ui-800: var(--p-800, #115e59);
  --ui-900: var(--p-900, #134e4a);
  /* Hero gradient: deep -> mid brand tone so white text keeps >= 4.5:1 contrast */
  --ui-grad: linear-gradient(125deg, var(--ui-900) 0%, var(--ui-700) 52%, color-mix(in srgb, var(--ui-600) 62%, var(--ui-900)) 125%);

  --ui-ink:    #0f172a;   /* headings */
  --ui-text:   #1e293b;   /* body */
  --ui-muted:  #475569;   /* secondary text, 7.5:1 on white */
  --ui-line:   #e2e8f0;
  --ui-line-strong: #cbd5e1;
  --ui-surface: #ffffff;
  /* page background: neutral with a whisper of the brand tint */
  --ui-bg:     color-mix(in srgb, var(--ui-50) 45%, #f5f7f9);

  --ui-danger: #b91c1c;  --ui-danger-dark: #991b1b;
  --ui-success: #047857; --ui-success-dark: #065f46;
  --ui-warning: #b45309; --ui-warning-dark: #92400e;
  /* "info" follows the brand so cyan never clashes with a non-teal theme */
  --ui-info: var(--ui-700); --ui-info-dark: var(--ui-800);

  --ui-radius: 8px;
  --ui-radius-lg: 14px;
  --ui-shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.06);
  --ui-shadow-md: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.05);
  --ui-shadow-lg: 0 14px 34px rgba(15,23,42,.14), 0 4px 10px rgba(15,23,42,.06);
  --ui-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ui-focus: 0 0 0 3px color-mix(in srgb, var(--ui-600) 32%, transparent);
}

/* ───────────────────────── 2 · TYPOGRAPHY ───────────────────────── */
body, body button, body input, body select, body textarea {
  font-family: var(--ui-font);
}
body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ui-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
:where(body) :where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--ui-font);
  letter-spacing: -0.012em;
  line-height: 1.25;
}
:where(body) h1 { font-size: 1.75rem;  font-weight: 800; }
:where(body) h2 { font-size: 1.375rem; font-weight: 750; }
:where(body) h3 { font-size: 1.125rem; font-weight: 700; }
:where(body) h4 { font-size: 1rem;     font-weight: 700; }
:where(body) :where(h5, h6) { font-size: .9375rem; font-weight: 650; }
body small, body .text-muted, body .help, body .helptext { color: var(--ui-muted) !important; }
body a { color: var(--ui-700); }
body a:hover { color: var(--ui-800); }
body ::selection { background: var(--ui-100); color: var(--ui-900); }
body .tabular, body td.num, body .kpi-value, body .kpi-number { font-variant-numeric: tabular-nums; }

/* ───────────────────────── 3 · BUTTONS (crisp, solid, readable) ───────────────────────── */
:root:not(.u1):not(.u2):not(.u3) body .btn,
:root:not(.u1):not(.u2):not(.u3) body a.button,
:root:not(.u1):not(.u2):not(.u3) body .button,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"]:not(.family-action-btn):not(.student-action-btn):not(.teacher-action-btn),
:root:not(.u1):not(.u2):not(.u3) body input[type="button"]:not(.family-action-btn):not(.student-action-btn):not(.teacher-action-btn),
:root:not(.u1):not(.u2):not(.u3) body button[type="submit"]:not(.family-action-btn):not(.student-action-btn):not(.teacher-action-btn),
:root:not(.u1):not(.u2):not(.u3) body .btn-filter,
:root:not(.u1):not(.u2):not(.u3) body .btn-reset,
:root:not(.u1):not(.u2):not(.u3) body .btn-hero {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px !important;
  font-family: var(--ui-font) !important;
  font-size: 13.5px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  white-space: nowrap;
  border-radius: var(--ui-radius) !important;
  border: 1.5px solid transparent !important;
  text-decoration: none !important;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--ui-shadow-sm) !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease,
              box-shadow .15s ease, transform .15s ease !important;
}
:root:not(.u1):not(.u2):not(.u3) body .btn:hover,
:root:not(.u1):not(.u2):not(.u3) body a.button:hover,
:root:not(.u1):not(.u2):not(.u3) body .button:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-filter:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-reset:hover {
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow-md) !important;
}
:root:not(.u1):not(.u2):not(.u3) body .btn:active,
:root:not(.u1):not(.u2):not(.u3) body a.button:active { transform: translateY(0); box-shadow: var(--ui-shadow-sm) !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn:focus-visible,
:root:not(.u1):not(.u2):not(.u3) body a.button:focus-visible,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"]:focus-visible,
:root:not(.u1):not(.u2):not(.u3) body button:focus-visible { outline: none; box-shadow: var(--ui-focus) !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn[disabled],
:root:not(.u1):not(.u2):not(.u3) body .btn.disabled,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"][disabled] {
  opacity: .55; cursor: not-allowed; transform: none; box-shadow: none !important;
}

/* primary */
:root:not(.u1):not(.u2):not(.u3) body .btn-primary,
:root:not(.u1):not(.u2):not(.u3) body .btn-filter,
:root:not(.u1):not(.u2):not(.u3) body a.button.default,
:root:not(.u1):not(.u2):not(.u3) body .button.default,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"].default,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"][name="_save"] {
  background: var(--ui-700) !important;
  border-color: var(--ui-800) !important;
  color: #ffffff !important;
}
:root:not(.u1):not(.u2):not(.u3) body .btn-primary:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-filter:hover,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"].default:hover,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"][name="_save"]:hover {
  background: var(--ui-800) !important;
  border-color: var(--ui-900) !important;
  color: #ffffff !important;
}
/* secondary / neutral */
:root:not(.u1):not(.u2):not(.u3) body .btn-secondary,
:root:not(.u1):not(.u2):not(.u3) body .btn-default,
:root:not(.u1):not(.u2):not(.u3) body .btn-light,
:root:not(.u1):not(.u2):not(.u3) body .btn-reset,
:root:not(.u1):not(.u2):not(.u3) body .btn-outline-secondary,
:root:not(.u1):not(.u2):not(.u3) body a.button:not(.default),
:root:not(.u1):not(.u2):not(.u3) body .button:not(.default),
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"][name="_continue"],
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"][name="_addanother"] {
  background: #ffffff !important;
  border-color: var(--ui-line-strong) !important;
  color: var(--ui-ink) !important;
}
:root:not(.u1):not(.u2):not(.u3) body .btn-secondary:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-default:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-light:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-reset:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-outline-secondary:hover,
:root:not(.u1):not(.u2):not(.u3) body a.button:not(.default):hover,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"][name="_continue"]:hover,
:root:not(.u1):not(.u2):not(.u3) body input[type="submit"][name="_addanother"]:hover {
  background: var(--ui-50) !important;
  border-color: var(--ui-600) !important;
  color: var(--ui-800) !important;
}
/* outline primary */
:root:not(.u1):not(.u2):not(.u3) body .btn-outline-primary { background: #fff !important; border-color: var(--ui-700) !important; color: var(--ui-700) !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-outline-primary:hover { background: var(--ui-700) !important; color: #fff !important; }
/* semantic solids */
:root:not(.u1):not(.u2):not(.u3) body .btn-success { background: var(--ui-success) !important; border-color: var(--ui-success-dark) !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-success:hover { background: var(--ui-success-dark) !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-danger,
:root:not(.u1):not(.u2):not(.u3) body a.deletelink,
:root:not(.u1):not(.u2):not(.u3) body .deletelink-box a.button { background: var(--ui-danger) !important; border-color: var(--ui-danger-dark) !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-danger:hover,
:root:not(.u1):not(.u2):not(.u3) body a.deletelink:hover { background: var(--ui-danger-dark) !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-warning { background: #f59e0b !important; border-color: var(--ui-warning) !important; color: #1c1100 !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-warning:hover { background: #d97706 !important; color: #1c1100 !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-info { background: var(--ui-info) !important; border-color: var(--ui-info-dark) !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-info:hover { background: var(--ui-info-dark) !important; color: #fff !important; }
/* sizes */
:root:not(.u1):not(.u2):not(.u3) body .btn-sm,
:root:not(.u1):not(.u2):not(.u3) body .btn-group-sm > .btn { min-height: 32px; padding: 0 12px !important; font-size: 12.5px !important; gap: 6px; }
:root:not(.u1):not(.u2):not(.u3) body .btn-xs { min-height: 26px; padding: 0 9px !important; font-size: 12px !important; gap: 5px; border-radius: 6px !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-lg { min-height: 46px; padding: 0 24px !important; font-size: 15px !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-block { display: flex !important; width: 100%; }
:root:not(.u1):not(.u2):not(.u3) body .btn i,
:root:not(.u1):not(.u2):not(.u3) body .button i { font-size: .95em; }

/* buttons on the hero gradient; the page-specific colourful ones (bill, statement,
   impersonate, edit) are excluded and keep their own look */
:is(.lms-hero,
.hero,
.hero-banner,
.rt-head,
.admin-app-hero) .btn-hero:not(.btn-hero-light):not(.btn-hero-bill):not(.btn-hero-statement):not(.btn-hero-regular):not(.btn-hero-impersonate):not(.btn-hero-edit):not(.btn-edit) {
  background: rgba(255,255,255,.16) !important;
  border-color: rgba(255,255,255,.65) !important;
  color: #ffffff !important;
  box-shadow: none !important;
  text-shadow: 0 1px 1px rgba(0,0,0,.2);
}
:is(.lms-hero,
.hero,
.hero-banner,
.rt-head,
.admin-app-hero) .btn-hero:not(.btn-hero-light):not(.btn-hero-bill):not(.btn-hero-statement):not(.btn-hero-regular):not(.btn-hero-impersonate):not(.btn-hero-edit):not(.btn-edit):hover {
  background: rgba(255,255,255,.3) !important; border-color: #fff !important; color: #fff !important;
}
/* plain .btn links dropped into a hero become solid white buttons (always readable) */
:root:not(.u1):not(.u2):not(.u3) body .lms-hero :is(a,
button).btn:not(.btn-hero):not(.btn-hero-light) {
  background: #ffffff !important; border-color: #ffffff !important; color: var(--ui-800) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.18) !important; text-shadow: none;
}
:root:not(.u1):not(.u2):not(.u3) body .lms-hero :is(a,
button).btn:not(.btn-hero):not(.btn-hero-light):hover { background: var(--ui-50) !important; color: var(--ui-900) !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-hero-light,
:root:not(.u1):not(.u2):not(.u3) body .btn-hero.btn-hero-light {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: var(--ui-800) !important;
  text-shadow: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.18) !important;
}
:root:not(.u1):not(.u2):not(.u3) body .btn-hero-light:hover { background: var(--ui-50) !important; color: var(--ui-900) !important; }


/* one-off page buttons: same shape and contrast as .btn */
:root:not(.u1):not(.u2):not(.u3) body .nav-btn,
:root:not(.u1):not(.u2):not(.u3) body .btn-submit,
:root:not(.u1):not(.u2):not(.u3) body .btn-submit-ticket,
:root:not(.u1):not(.u2):not(.u3) body .btn-primary-run,
:root:not(.u1):not(.u2):not(.u3) body .btn-search,
:root:not(.u1):not(.u2):not(.u3) body .btn-view-child,
:root:not(.u1):not(.u2):not(.u3) body .btn-resync,
:root:not(.u1):not(.u2):not(.u3) body .pill-btn,
:root:not(.u1):not(.u2):not(.u3) body .btn-back,
:root:not(.u1):not(.u2):not(.u3) body .btn-cancel,
:root:not(.u1):not(.u2):not(.u3) body .btn-lite,
:root:not(.u1):not(.u2):not(.u3) body .link-btn,
:root:not(.u1):not(.u2):not(.u3) body .btn-pdf,
:root:not(.u1):not(.u2):not(.u3) body .btn-reschedule,
:root:not(.u1):not(.u2):not(.u3) body .btn-reset {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 15px !important;
  font-family: var(--ui-font); font-size: 13.5px !important; font-weight: 650 !important; line-height: 1;
  border-radius: var(--ui-radius) !important; border: 1.5px solid transparent !important;
  text-decoration: none !important; cursor: pointer;
  box-shadow: var(--ui-shadow-sm);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
:root:not(.u1):not(.u2):not(.u3) body .nav-btn,
:root:not(.u1):not(.u2):not(.u3) body .btn-submit,
:root:not(.u1):not(.u2):not(.u3) body .btn-submit-ticket,
:root:not(.u1):not(.u2):not(.u3) body .btn-primary-run,
:root:not(.u1):not(.u2):not(.u3) body .btn-search,
:root:not(.u1):not(.u2):not(.u3) body .btn-view-child,
:root:not(.u1):not(.u2):not(.u3) body .btn-resync {
  background: var(--ui-700) !important; border-color: var(--ui-800) !important; color: #ffffff !important;
}
:root:not(.u1):not(.u2):not(.u3) body .nav-btn:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-submit:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-submit-ticket:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-primary-run:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-search:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-view-child:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-resync:hover {
  background: var(--ui-800) !important; color: #ffffff !important; transform: translateY(-1px);
}
:root:not(.u1):not(.u2):not(.u3) body .pill-btn,
:root:not(.u1):not(.u2):not(.u3) body .btn-back,
:root:not(.u1):not(.u2):not(.u3) body .btn-cancel,
:root:not(.u1):not(.u2):not(.u3) body .btn-lite,
:root:not(.u1):not(.u2):not(.u3) body .link-btn,
:root:not(.u1):not(.u2):not(.u3) body .btn-pdf,
:root:not(.u1):not(.u2):not(.u3) body .btn-reschedule {
  background: #ffffff !important; border-color: var(--ui-line-strong) !important; color: var(--ui-ink) !important;
}
:root:not(.u1):not(.u2):not(.u3) body .pill-btn:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-back:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-cancel:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-lite:hover,
:root:not(.u1):not(.u2):not(.u3) body .link-btn:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-pdf:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn-reschedule:hover {
  background: var(--ui-50) !important; border-color: var(--ui-600) !important; color: var(--ui-800) !important;
}

/* row action buttons in changelists: solid, AA contrast, a touch larger */
:root:not(.u1):not(.u2):not(.u3) body .family-action-btn, :root:not(.u1):not(.u2):not(.u3) body .student-action-btn, :root:not(.u1):not(.u2):not(.u3) body .teacher-action-btn {
  font-size: 12px !important; padding: 4px 10px !important; min-height: 26px; border-radius: 6px !important;
}
:root:not(.u1):not(.u2):not(.u3) body .family-action-btn.btn-360, :root:not(.u1):not(.u2):not(.u3) body .student-action-btn.btn-360, :root:not(.u1):not(.u2):not(.u3) body .teacher-action-btn.btn-360 { background: #1d4ed8 !important; border-color: #1e3a8a !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .family-action-btn.btn-bill, :root:not(.u1):not(.u2):not(.u3) body .family-action-btn.btn-regular { background: #047857 !important; border-color: #065f46 !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .family-action-btn.btn-student { background: #b45309 !important; border-color: #92400e !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .student-action-btn.btn-edit { background: var(--ui-700) !important; border-color: var(--ui-800) !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .teacher-action-btn.btn-breaks { background: #6d28d9 !important; border-color: #5b21b6 !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .family-action-btn:hover, :root:not(.u1):not(.u2):not(.u3) body .student-action-btn:hover, :root:not(.u1):not(.u2):not(.u3) body .teacher-action-btn:hover { filter: brightness(.9); }

/* floor for tiny inline text (generated in admin.py) so it stays legible */
body [style*="font-size:9px"], body [style*="font-size: 9px"] { font-size: 10.5px !important; }
body [style*="font-size:10px"], body [style*="font-size: 10px"] { font-size: 11px !important; }
body [style*="font-size:8px"], body [style*="font-size: 8px"] { font-size: 10px !important; }

/* Django related-widget icons (edit / add / delete / view): one quiet colour */
body .related-widget-wrapper-link img, body .related-widget-wrapper img.selector-clearall { filter: grayscale(1) brightness(.5); opacity: .75; }
body .related-widget-wrapper-link:hover img { filter: none; opacity: 1; }

/* two-line cells used by the merged list columns (families, employees, ...) */
body .lms-cell-main { font-weight: 650; color: var(--ui-ink); line-height: 1.25; }
body .lms-cell-sub { font-size: 11.5px; font-weight: 500; color: var(--ui-muted) !important; line-height: 1.35; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body .model-family #result_list .field-family_col, body .model-employee #result_list .field-employee_col { min-width: 190px; white-space: normal; }
body .model-family #result_list td, body .model-employee #result_list td { white-space: normal; }
body .model-family #result_list .field-family_actions { width: auto !important; max-width: 220px; white-space: normal !important; }
body .family-actions-group { display: grid !important; grid-template-columns: repeat(2, auto) !important; gap: 4px !important; justify-content: end; }

/* invoice / billing list buttons and badges */
body .model-invoice #result_list .button, body .model-invoice #result_list a.button { min-height: 30px; padding: 0 12px !important; font-size: 12.5px !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-act-issue { background: var(--ui-success) !important; border-color: var(--ui-success-dark) !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3) body .btn-act-issue:hover { background: var(--ui-success-dark) !important; color: #fff !important; }
body .lms-status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #fff; white-space: nowrap; letter-spacing: .01em; }

/* small links and footer */
body .main-footer, body .main-footer strong, body .main-footer a { color: var(--ui-muted) !important; }
body .actions .action-counter + a, body .paginator a, body .search-form a, body a.showall { color: var(--ui-700); font-weight: 650; }
body .session-time-zone { color: var(--ui-muted) !important; font-size: 10px !important; }
body .session-time-role { color: #334155 !important; }
body #result_list tbody td > a:not([class*="btn"]):not([class*="action"]) { color: var(--ui-800); }

/* ───────────────────────── 4 · FORMS ───────────────────────── */
body input[type="text"], body input[type="number"], body input[type="email"], body input[type="password"],
body input[type="date"], body input[type="time"], body input[type="datetime-local"], body input[type="search"],
body input[type="month"], body input[type="week"], body input[type="url"], body input[type="tel"], body select, body textarea, body .form-control, body .form-control-custom {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 14px;
  color: var(--ui-ink);
  background-color: #ffffff;
  border: 1.5px solid var(--ui-line-strong);
  border-radius: var(--ui-radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}
body textarea:not(.select2-search__field) { min-height: 84px; }
body input:focus, body select:focus, body textarea:focus, body .form-control:focus, body .form-control-custom:focus {
  outline: none;
  border-color: var(--ui-600);
  box-shadow: var(--ui-focus);
}
body input::placeholder, body textarea::placeholder { color: #64748b; opacity: 1; }
body label, body .filter-form label { font-size: 12.5px; font-weight: 650; color: var(--ui-text); }

/* ───────────────────────── 5 · CARDS & KPI TILES ───────────────────────── */
body .card, body .lms-card, body .table-card, body .chart-card, body .filter-panel, body .module,
body .stat-card, body .summary-card, body .kpi-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}
body .card-header, body .table-header-bar, body .chart-card-header {
  background: #ffffff;
  border-bottom: 1px solid var(--ui-line);
}
body .card-title, body .table-title, body .chart-card-title {
  font-size: 1rem; font-weight: 700; color: var(--ui-ink); letter-spacing: -0.01em;
}
body .kpi-card, body .stat-card, body .summary-card { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
body .kpi-card:hover, body .stat-card:hover, body .summary-card:hover { transform: translateY(-2px); box-shadow: var(--ui-shadow-md); }
body .kpi-value, body .kpi-number { color: var(--ui-ink); font-weight: 800; letter-spacing: -0.02em; }
body .kpi-label { color: var(--ui-muted); font-weight: 700; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; }
body .kpi-subtext { color: var(--ui-muted); font-size: 12px; }

/* ───────────────────────── 6 · TABLES ─────────────────────────
   One header look everywhere: solid deep brand colour, white 11.5px caps (>= 7:1 contrast). */
:root:not(.u1):not(.u2):not(.u3) body #result_list thead th,
:root:not(.u1):not(.u2):not(.u3) body #result_list thead td,
:root:not(.u1):not(.u2):not(.u3) body table:not(#result_list):not(.no-ui) thead th {
  background: var(--ui-800) !important;
  color: #ffffff !important;
  font-size: 11.5px !important;
  font-weight: 750 !important;
  letter-spacing: .05em !important;
  text-transform: uppercase;
  padding: 12px 14px !important;
  border: 0 !important;
  border-bottom: 2px solid var(--ui-900) !important;
  white-space: nowrap;
  text-shadow: none;
}
:root:not(.u1):not(.u2):not(.u3) body #result_list thead th a,
:root:not(.u1):not(.u2):not(.u3) body #result_list thead th .text,
:root:not(.u1):not(.u2):not(.u3) body #result_list thead th .text a,
:root:not(.u1):not(.u2):not(.u3) body table:not(.no-ui) thead th a { color: #ffffff !important; text-decoration: none; }
body table.table-trial, body table.data-table, body table.table, body #result_list {
  font-size: 13.5px;
  border-collapse: separate;
  border-spacing: 0;
}
body table.table-trial tbody td, body table.data-table tbody td, body table.table tbody td, body #result_list tbody td {
  color: var(--ui-text);
  padding: 11px 14px;
  border-bottom: 1px solid var(--ui-line);
  vertical-align: middle;
}
body table.table-trial tbody tr:hover > td, body table.data-table tbody tr:hover > td,
body table.table tbody tr:hover > td, body #result_list tbody tr:hover > td { background: var(--ui-50); }

/* plain card forms (HR leave request, portal forms) */
body .card form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=hidden]),
body .card form select, body .card form textarea { width: 100%; max-width: 480px; }
/* inputs with an attached icon/button (admin login, search boxes) stay on one line */
body .input-group { flex-wrap: nowrap; align-items: stretch; }
body .card form .input-group > .form-control, body .input-group > .form-control {
  flex: 1 1 auto; width: 1%; min-width: 0; max-width: none;
}
body .input-group > .form-control:not(:last-child) { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
body .input-group > .form-control:not(:first-child) { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
body .input-group-append, body .input-group-prepend { display: flex; }
body .input-group .input-group-text {
  min-width: 44px; justify-content: center; color: var(--ui-700); background: var(--ui-50);
  border: 1.5px solid var(--ui-line-strong);
}
body .input-group-append .input-group-text { border-left: 0; border-radius: 0 var(--ui-radius) var(--ui-radius) 0; }
body .input-group-prepend .input-group-text { border-right: 0; border-radius: var(--ui-radius) 0 0 var(--ui-radius); }
body .input-group:focus-within .input-group-text { border-color: var(--ui-600); color: var(--ui-800); }
body .card > h1:first-child { margin: 0 0 1.1rem; }

/* ───────────────────────── 7 · BADGES / PILLS ───────────────────────── */
body .badge, body .pill-badge {
  font-weight: 700; letter-spacing: .01em; border-radius: 6px; padding: 3px 8px;
}
body .badge-success { background: #d1fae5; color: #065f46; }
body .badge-danger  { background: #fee2e2; color: #991b1b; }
body .badge-warning { background: #fef3c7; color: #92400e; }
body .badge-info    { background: var(--ui-100); color: var(--ui-900); }
body .badge-secondary { background: #e2e8f0; color: #334155; }

/* ───────────────────────── 8 · PAGE HERO (compact page bar) ─────────────────────────
 * One slim brand-coloured bar: icon, title, an (i) button for the description (lms/js/page_bar.js
 * turns .lms-hero-subtitle into a popover), then filters and actions on the right. On desktop the
 * .lms-hero sticks to the top while the page scrolls, unless a separate sticky filter bar follows. */
body .lms-hero, body .hero-banner, body .s360 .hero, body .t360 .hero, body .rt-head, body .admin-app-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 14px;
  padding: 12px 18px;
  color: #ffffff;
  background: var(--ui-grad);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-md);
  isolation: isolate;
}
/* the page bar draws its glow in the background so nothing has to clip, and popovers can overflow */
body .lms-hero, body .hero-banner {
  overflow: visible; z-index: 3;
  min-height: 58px;
  background:
    radial-gradient(circle at calc(100% - 90px) -40px, rgba(255,255,255,.2), rgba(255,255,255,0) 200px),
    radial-gradient(circle at 38% 190%, rgba(255,255,255,.12), rgba(255,255,255,0) 240px),
    var(--ui-grad);
}
body .lms-hero::before, body .lms-hero::after, body .hero-banner::before, body .hero-banner::after { content: none !important; }
/* Admin pages: the content starts right under the menu, so the bar needs its own gap. */
body .content-wrapper :is(.lms-hero, .hero-banner, .rt-head, .admin-app-hero) { margin-top: 12px; }
body .s360 .hero::before, body .t360 .hero::before, body .rt-head::before, body .admin-app-hero::before {
  content: '';
  position: absolute; z-index: -1;
  right: -60px; top: -90px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.22), rgba(255,255,255,0) 68%);
}
body .s360 .hero::after, body .t360 .hero::after, body .rt-head::after, body .admin-app-hero::after {
  content: '';
  position: absolute; z-index: -1;
  left: 30%; bottom: -120px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.12), rgba(255,255,255,0) 70%);
}
body .lms-hero h1, body .lms-hero h2 { color: #ffffff !important; text-shadow: 0 1px 2px rgba(0,0,0,.22); }
body .lms-hero p { color: rgba(255,255,255,.94); }
body .lms-hero-title, body .hero-title {
  margin: 0; display: flex; align-items: center; gap: 10px; min-width: 0;
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.015em; line-height: 1.2;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.22);
}
/* the page's own icon sits in a small glass tile */
body .lms-hero-title > i, body .hero-title > i {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; font-size: 15px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.32);
  color: #ffffff !important; opacity: 1; text-shadow: none;
}
body .lms-hero-subtitle, body .hero-subtitle {
  margin: 4px 0 0; max-width: 62ch; font-size: 13px; line-height: 1.45;
  color: rgba(255,255,255,.94) !important;
  text-shadow: 0 1px 1px rgba(0,0,0,.18);
}
body .lms-hero-actions, body .hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; max-width: 100%; }
body .lms-hero-actions > * { max-width: 100%; }
body .lms-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
  backdrop-filter: blur(4px);
}
/* (i) description button and popover, built by page_bar.js */
body .lms-hero-head { display: flex; align-items: center; gap: 8px; min-width: 0; position: relative; }
body .lms-hero-info {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.45); color: #fff;
  font: 700 12px/1 var(--ui-font);
}
body .lms-hero-info:hover, body .lms-hero-info[aria-expanded="true"] { background: rgba(255,255,255,.3); }
body .lms-hero-info:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
body .lms-hero .lms-hero-pop, body .hero-banner .lms-hero-pop {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 5;
  width: max-content; max-width: min(420px, calc(100vw - 48px));
  margin: 0; padding: 10px 14px; border-radius: 10px;
  background: var(--ui-surface); border: 1px solid var(--ui-line); box-shadow: var(--ui-shadow-lg);
  color: var(--ui-text) !important; text-shadow: none; font-size: 13px; line-height: 1.5;
}
/* filters placed inside the bar: no card of their own, labels read as icons */
body .lms-hero .lms-hero-filters, body .lms-hero form.exec-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  position: static; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; backdrop-filter: none;
}
body .lms-hero .rpt-field { flex-direction: row; align-items: center; gap: 0; margin: 0; color: #fff; }
body .lms-hero .rpt-field > span { font-size: 0; display: inline-flex; }
body .lms-hero .rpt-field > span i { font-size: 13px; color: #fff !important; margin-right: 6px; opacity: .9; }
body .lms-hero .rpt-field :is(select, input) {
  height: 34px !important; min-height: 34px !important; min-width: 0; max-width: 220px;
  padding-top: 4px !important; padding-bottom: 4px !important;
  border-radius: 9px; border: 1px solid rgba(255,255,255,.55) !important;
  background-color: var(--ui-surface) !important; color: var(--ui-ink) !important; font-size: 13px;
}
/* admin_custom.css styles every button[type=button] with !important; :not(#lms-no-id) adds ID weight to win */
body :is(.lms-hero-info, .lms-month-btn, .exec-tile, .tq-clear):not(#lms-no-id) {
  display: inline-flex !important; align-items: center; vertical-align: middle !important;
  font-family: var(--ui-font) !important; line-height: 1.2 !important; text-decoration: none !important;
}
body .lms-hero-info:not(#lms-no-id) { padding: 0 !important; border-radius: 50% !important; border: 1px solid rgba(255,255,255,.45) !important; font-size: 12px !important; justify-content: center; }
body .lms-month-btn:not(#lms-no-id) { padding: 0 !important; border-radius: 8px !important; border: 1px solid rgba(255,255,255,.45) !important; font-size: 13px !important; justify-content: center; }
/* month arrows (page_bar.js) */
body .lms-month-step { display: inline-flex; align-items: center; gap: 2px; }
body .lms-month-step > button {
  width: 30px; height: 34px; padding: 0; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.14); color: #fff; font-size: 13px;
}
body .lms-month-step > button:hover:not(:disabled) { background: rgba(255,255,255,.28); }
body .lms-month-step > button:disabled { opacity: .4; cursor: default; }
body .lms-month-step > button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
/* sticky bar on desktop; page_bar.js adds .is-sticky only when no separate sticky filter bar is on the page */
@media (min-width: 992px) {
  body .lms-hero.is-sticky { position: sticky; top: 6px; z-index: 25; transition: padding .15s ease, min-height .15s ease; }
  body .lms-hero.is-stuck { padding-top: 7px; padding-bottom: 7px; min-height: 48px; box-shadow: var(--ui-shadow-lg); }
  body .lms-hero.is-stuck .lms-hero-title { font-size: 1.08rem; }
  body .lms-hero.is-stuck .lms-hero-title > i { width: 28px; height: 28px; font-size: 13px; }
}
/* Admin lists and edit forms (desktop): when a list fits the width, page_bar.js adds .lms-head-stick
 * so its column names stay at the top of the window; the Save panel of an edit form stays on screen
 * beside long forms. Phones keep the card rows. */
@media (min-width: 992px) {
  body #changelist .lms-head-stick:not(#lms-no-id), body #changelist .card:has(> .lms-head-stick):not(#lms-no-id) { overflow: visible !important; }
  body #changelist .lms-head-stick #result_list thead th { position: sticky; top: 0; z-index: 3; }
  body #jazzy-actions { position: sticky; top: 12px; z-index: 5; }
}
body .lms-density-btn:not(#lms-no-id) { margin-right: 8px; padding: 6px 12px !important; }
/* phones show list rows as cards, so the switch has nothing to do there */
@media (max-width: 991px) { body .lms-density-btn:not(#lms-no-id) { display: none !important; } }
/* compact table rows, switched by any [data-density-toggle] button and remembered per browser */
html.lms-dense body :is(.rpt-table, .table, #result_list) :is(td, th) { padding-top: 4px !important; padding-bottom: 4px !important; }
@media (max-width: 720px) {
  body .lms-hero, body .hero-banner { padding: 12px 14px; }
  body .lms-hero-title, body .hero-title { font-size: 1.12rem; }
  body .lms-hero-title > i, body .hero-title > i { width: 30px; height: 30px; font-size: 13px; }
  body .lms-hero .lms-hero-filters, body .lms-hero form.exec-bar { width: 100%; }
  body .lms-hero .rpt-field { flex: 1 1 140px; }
  body .lms-hero .rpt-field :is(select, input) { max-width: none; width: 100%; }
}
@media print {
  body .lms-hero { position: static !important; }
  body .lms-hero-info, body .lms-month-step > button { display: none !important; }
}

/* detail-page heroes (student / family / teacher 360, realtime monitor) */
body .s360 .hero-name, body .t360 .hero-name {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; color: #fff !important; text-shadow: 0 1px 2px rgba(0,0,0,.22);
}
body .s360 .hero-meta, body .t360 .hero-meta { color: rgba(255,255,255,.95) !important; font-size: 13.5px; }
body .s360 .hero-meta a, body .t360 .hero-meta a { color: #fff; }
body .s360 .hero-avatar, body .t360 .hero-avatar { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.65); }
body .rt-head h1 { color: #fff !important; font-size: 1.55rem; font-weight: 800; }
body .rt-meta { color: rgba(255,255,255,.95) !important; }
body .rt-refresh {
  min-height: 38px; padding: 0 16px; border-radius: 8px; font-weight: 650; font-size: 13.5px; cursor: pointer;
  background: #fff !important; color: var(--ui-800) !important; border: 1.5px solid #fff !important;
}
body .rt-refresh:hover { background: var(--ui-50) !important; }

body .admin-app-hero h2 { color: #fff !important; font-size: 1.65rem; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.22); }
body .admin-app-hero p { color: rgba(255,255,255,.94) !important; }

/* dashboard quick links behave like secondary buttons */
body .quick-link {
  min-height: 38px; padding: 0 16px !important; border-radius: 8px !important;
  border: 1.5px solid var(--ui-line-strong); background: #fff; color: var(--ui-ink) !important;
  font-size: 13.5px !important; font-weight: 650; box-shadow: var(--ui-shadow-sm) !important;
}
body .quick-link i { color: var(--ui-700) !important; }
body .quick-link:hover { border-color: var(--ui-600); background: var(--ui-50); color: var(--ui-800) !important; transform: translateY(-1px); }

/* ───────────────────────── 9 · CHANGELIST / ADMIN CHROME ───────────────────────── */
body .content-wrapper .content.border-bottom h1,
body .content-wrapper .content.border-bottom .h4,
body .content.border-bottom h1 {
  font-size: 1.45rem !important; font-weight: 800 !important; color: var(--ui-ink) !important;
  letter-spacing: -0.02em !important; line-height: 1.2 !important;
}
body .content.lms-page-header {
  background: #ffffff; border-bottom: 1px solid var(--ui-line) !important;
  box-shadow: 0 1px 0 rgba(15,23,42,.03);
}
body .content-wrapper .content.border-bottom .lms-page-header-row { min-height: 62px !important; }
body .content-header .breadcrumb, body .breadcrumb { font-size: 13px; }
body .breadcrumb-item.active { color: var(--ui-muted) !important; font-weight: 600; }
body .content-header .breadcrumb a { color: var(--ui-700); font-weight: 600; }
body .card-primary.card-outline { border-top: 3px solid var(--ui-700); }
body .nav-tabs .nav-link, body .nav-pills .nav-link { color: var(--ui-text) !important; font-weight: 650; }
body .nav-tabs .nav-link i, body .nav-pills .nav-link i { color: var(--ui-700); }
body .nav-tabs .nav-link:hover, body .nav-pills .nav-link:hover { color: var(--ui-800) !important; }
body .nav-tabs .nav-link.active, body .nav-pills .nav-link.active {
  background: var(--ui-700) !important; color: #ffffff !important; border-color: var(--ui-700) !important; font-weight: 700;
}
body .nav-tabs .nav-link.active i, body .nav-pills .nav-link.active i { color: #ffffff !important; }
/* the white page-title strip is useless on pages that bring their own hero */
body .content.lms-page-header:has(h1:empty):not(:has(.breadcrumb)) { display: none; }
body .lms-page-header h1:empty { display: none; }
body .lms-page-header h1:empty + .breadcrumb { margin-left: 0; }
body .page-link { color: var(--ui-700); font-weight: 600; }
body .page-item.active .page-link { background: var(--ui-700); border-color: var(--ui-700); color: #fff; }
body .messagelist li, body .alert { border-radius: var(--ui-radius); font-weight: 550; }

/* custom app pages that are not wrapped in a padded container */
body .content-wrapper .content #content > .row > .lms-page,
body .content-wrapper .content #content > .row > .ticket-list-wrapper,
body .content-wrapper .content #content > .row > .ticket-board-wrapper,
body .content-wrapper .content #content > .row > .ticket-create-page,
body .content-wrapper .content #content > .row > .ticket-detail-wrapper {
  padding: 18px 24px 40px !important;
}

/* ───────────────────────── 10 · UTILITIES / MOTION ───────────────────────── */
body .lms-section-title {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px;
  font-size: 1.05rem; font-weight: 750; color: var(--ui-ink);
}
body .lms-section-title::before {
  content: ''; width: 4px; height: 1.1em; border-radius: 2px; background: var(--ui-700);
}
body ::-webkit-scrollbar { width: 10px; height: 10px; }
body ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; border: 2px solid #f1f5f9; }
body ::-webkit-scrollbar-thumb:hover { background: var(--ui-600); }
@media (prefers-reduced-motion: reduce) {
  body *, body *::before, body *::after { transition: none !important; animation: none !important; }
}

/* ───────────────────────── 11 · BRAND COVERAGE FOR LEGACY CHROME ─────────────────────────
 * admin_custom.css and portal.css were written for teal; these map their leftovers onto
 * the brand palette so every preset (and Custom) reaches the whole page. */
:root {
  --bg-app: var(--ui-bg);          /* admin_custom.css page background */
  --bg-light: var(--ui-bg);        /* portal.css page background */
  --info: var(--ui-700); --info-light: var(--ui-600);
  --info-bg: var(--ui-50); --info-border: var(--ui-200);
  --grad-info: linear-gradient(135deg, var(--ui-800) 0%, var(--ui-600) 100%);
}
/* top menu bar (dark brand strip): active item, icons, carets */
body .lms-dynamic-nav .lms-top-cat-icon { color: var(--p-400, #2dd4bf); }
body .lms-dynamic-nav .lms-top-nav-link.active {
  background: color-mix(in srgb, var(--p-400, #2dd4bf) 22%, transparent) !important;
  color: #ffffff !important;
  border-color: color-mix(in srgb, var(--p-400, #2dd4bf) 45%, transparent) !important;
}
body .lms-dynamic-nav .lms-top-nav-link.active .lms-top-cat-icon,
body .lms-dynamic-nav .lms-top-nav-link.active .lms-menu-caret-down { color: var(--p-200, #99f6e4) !important; }
/* the menu draws its own chevron; hide Bootstrap's second caret */
body .lms-dynamic-nav .lms-top-nav-link.dropdown-toggle::after { display: none !important; }
/* dashboard / app index model rows: Add = brand solid, Change/View = brand soft */
:root:not(.u1):not(.u2):not(.u3) body .btn.addlink {
  background: var(--ui-700) !important; border-color: var(--ui-800) !important; color: #fff !important;
}
:root:not(.u1):not(.u2):not(.u3) body .btn.changelink,
:root:not(.u1):not(.u2):not(.u3) body .btn.viewlink {
  background: var(--ui-50) !important; border-color: var(--ui-200) !important; color: var(--ui-800) !important;
}
:root:not(.u1):not(.u2):not(.u3) body .btn.changelink:hover,
:root:not(.u1):not(.u2):not(.u3) body .btn.viewlink:hover { background: var(--ui-100) !important; color: var(--ui-900) !important; }
/* changelist "Add <model>" (Jazzmin renders it as btn-success) is the page's primary action */
:root:not(.u1):not(.u2):not(.u3) body .content-header .btn-success.float-right,
:root:not(.u1):not(.u2):not(.u3) body .lms-page-header-actions .btn-success,
:root:not(.u1):not(.u2):not(.u3) body .object-tools .btn-success {
  background: var(--ui-700) !important; border-color: var(--ui-800) !important; color: #fff !important;
}
body .bg-info, body .badge-primary { background-color: var(--ui-700) !important; color: #fff !important; }
body .text-info { color: var(--ui-700) !important; }
body .btn-outline-info { color: var(--ui-700) !important; border-color: var(--ui-700) !important; }
body .btn-outline-info:hover { background: var(--ui-700) !important; color: #fff !important; }

/* colour-mode switch (Light / Dark / System) used in the account menus */
.lms-mode-switch {
  display: flex; gap: 4px; padding: 3px; margin: 6px 12px 8px;
  background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: 9px;
}
.lms-mode-switch button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 5px 6px; border: 0; border-radius: 6px; background: transparent;
  color: var(--ui-muted); font: 600 12px/1.2 var(--ui-font); cursor: pointer;
}
.lms-mode-switch button:hover { color: var(--ui-ink); }
.lms-mode-switch button[aria-pressed="true"] {
  background: var(--ui-surface); color: var(--ui-700); box-shadow: var(--ui-shadow-sm);
}
.lms-mode-switch-label {
  padding: 8px 14px 0; font-size: 10px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ui-muted);
}

/* one-click light/dark button in the admin bar and portal header (includes/color_mode_quick.html) */
.lms-mode-quick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 34px; padding: 0; border: 0; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,.15); color: #fff; font-size: 15px; transition: background-color .2s ease;
}
.lms-mode-quick:hover { background: rgba(255,255,255,.28); }
.lms-mode-quick:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lms-mode-quick.light {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.06); border: 1px solid rgba(0,0,0,.1); color: #1e293b;
}
.lms-mode-quick.light:hover { background: rgba(0,0,0,.12); }
.lms-mode-quick .lms-mode-quick-sun { display: none; }
html[data-theme="dark"] .lms-mode-quick .lms-mode-quick-sun { display: inline; color: #fcd34d; }
html[data-theme="dark"] .lms-mode-quick .lms-mode-quick-moon { display: none; }
html[data-theme="dark"] .lms-mode-quick.light { background: rgba(255,255,255,.12) !important; border-color: rgba(255,255,255,.2) !important; }

/* ───────────────────────── 12 · DARK MODE ─────────────────────────
 * <html data-theme="dark"> is set before paint by includes/color_mode_head.html from the
 * user's saved choice (Light / Dark / System). Tokens flip here; components that hard-code
 * white follow below; lms/js/color_mode.js darkens whatever a page's own <style> still
 * paints light. Brand colours stay: the header and buttons keep the theme. */
html[data-theme="dark"] {
  color-scheme: dark;
  --dk-bg: #0b1220;
  --dk-surface: #111a2b;
  --dk-raised: #172238;
  --dk-field: #0e1727;
  --dk-line: #243149;
  --dk-line-strong: #33445f;
  --dk-ink: #f1f5f9;
  --dk-text: #d5deea;
  --dk-muted: #9aabc2;

  --ui-ink: var(--dk-ink); --ui-text: var(--dk-text); --ui-muted: var(--dk-muted);
  --ui-line: var(--dk-line); --ui-line-strong: var(--dk-line-strong);
  --ui-surface: var(--dk-surface); --ui-bg: var(--dk-bg);
  --ui-50:  color-mix(in srgb, var(--p-500, #14b8a6) 13%, var(--dk-surface));
  --ui-100: color-mix(in srgb, var(--p-500, #14b8a6) 24%, var(--dk-surface));
  --ui-200: color-mix(in srgb, var(--p-500, #14b8a6) 40%, var(--dk-surface));
  --ui-shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --ui-shadow-md: 0 4px 14px rgba(0,0,0,.45);
  --ui-shadow-lg: 0 14px 34px rgba(0,0,0,.55);

  /* brand tint used as a background everywhere (cards, hovers, chips) */
  --p-50: var(--ui-50);
  --primary-light: var(--ui-50);
  --grad-card: linear-gradient(135deg, var(--ui-50) 0%, var(--dk-surface) 100%);

  /* admin_custom.css neutrals (light -> dark scale is inverted) */
  --slate-50: #0f1829; --slate-100: #141f33; --slate-200: var(--dk-line); --slate-300: var(--dk-line-strong);
  --slate-400: #71839d; --slate-500: var(--dk-muted); --slate-600: #b4c1d3; --slate-700: #c9d3e0;
  --slate-800: #e2e8f0; --slate-900: var(--dk-ink);
  --bg-app: var(--dk-bg); --bg-card: var(--dk-surface);
  --success-bg: rgba(16,185,129,.12); --success-border: rgba(16,185,129,.35);
  --danger-bg: rgba(239,68,68,.12);   --danger-border: rgba(239,68,68,.35);
  --warning-bg: rgba(245,158,11,.12); --warning-border: rgba(245,158,11,.35);
  --info-bg: var(--ui-50); --info-border: var(--ui-200);
  --shadow-sm: var(--ui-shadow-sm);
  --shadow-xs: none;

  /* portal.css neutrals */
  --text-dark: var(--dk-ink); --text-mid: var(--dk-text); --text-light: var(--dk-muted);
  --bg-light: var(--dk-bg); --bg-white: var(--dk-surface); --border: var(--dk-line);
}
html[data-theme="dark"] body,
html[data-theme="dark"] body .wrapper,
html[data-theme="dark"] body .content-wrapper,
html[data-theme="dark"] body .main-footer { background-color: var(--dk-bg) !important; color: var(--dk-text); }
html[data-theme="dark"] body a:not(.btn):not(.button):not(.nav-link):not(.dropdown-item):not(.page-link) { color: var(--p-400, #2dd4bf); }
html[data-theme="dark"] body a:not(.btn):not(.button):not(.nav-link):not(.dropdown-item):not(.page-link):hover { color: var(--p-200, #99f6e4); }
html[data-theme="dark"] body .text-dark, html[data-theme="dark"] body .text-body,
html[data-theme="dark"] body .text-black { color: var(--dk-ink) !important; }
html[data-theme="dark"] body .text-secondary { color: var(--dk-muted) !important; }
html[data-theme="dark"] body hr { border-color: var(--dk-line); }

/* :not(#…) adds ID weight so this beats the button rules' own !important transitions */
html:not(#lms-no-id).lms-dk-instant body *,
html:not(#lms-no-id).lms-dk-instant body *::before,
html:not(#lms-no-id).lms-dk-instant body *::after { transition: none !important; }

/* surfaces */
html[data-theme="dark"] body :is(.card, .module, .modal-content, .popover, .toast, .list-group-item,
  .info-box, .callout, .jumbotron, .bg-white, .tab-content, fieldset.module, .inline-group,
  .changelist-form-container, #changelist-filter, #changelist .paginator, .select2-dropdown,
  .lms-card, .lms-panel, .data-table-card, .kpi-card, .stat-card, .chart-card, .card-body) {
  background-color: var(--dk-surface) !important;
  color: var(--dk-text);
  border-color: var(--dk-line) !important;
}
html[data-theme="dark"] body :is(.card-header, .card-footer, .modal-header, .modal-footer,
  .bg-light, .list-group-item-action:hover, .module h2, .module caption, .inline-group h2) {
  background-color: var(--dk-raised) !important;
  color: var(--dk-ink);
  border-color: var(--dk-line) !important;
}
html[data-theme="dark"] body :is(.dropdown-menu, #jazzy-usermenu, .lms-top-dropdown, .lms-mega-dropdown) {
  background-color: var(--dk-raised) !important;
  border-color: var(--dk-line-strong) !important;
  color: var(--dk-text);
}
html[data-theme="dark"] body .dropdown-item { color: var(--dk-text) !important; }
html[data-theme="dark"] body .dropdown-item:hover,
html[data-theme="dark"] body .dropdown-item:focus { background-color: var(--ui-100) !important; color: var(--dk-ink) !important; }
html[data-theme="dark"] body .dropdown-divider { border-color: var(--dk-line); }
html[data-theme="dark"] body .content-header,
html[data-theme="dark"] body .content.border-bottom,
html[data-theme="dark"] body .lms-page-header { background-color: var(--dk-surface) !important; border-color: var(--dk-line) !important; }

/* tables (the brand-coloured header row stays) */
html[data-theme="dark"] body .table, html[data-theme="dark"] body table { color: var(--dk-text); }
html[data-theme="dark"] body :is(.table, table) :is(td, th) { border-color: var(--dk-line) !important; }
html[data-theme="dark"] body :is(.table, table) tbody tr,
html[data-theme="dark"] body :is(.table, table) tbody td { background-color: transparent; }
html[data-theme="dark"] body .table-striped tbody tr:nth-of-type(odd),
html[data-theme="dark"] body #result_list tbody tr:nth-child(odd) { background-color: rgba(255,255,255,.025) !important; }
html[data-theme="dark"] body :is(.table-hover tbody tr:hover, #result_list tbody tr:hover) { background-color: var(--ui-50) !important; }
html[data-theme="dark"] body #result_list tbody tr.selected { background-color: var(--ui-100) !important; }

/* forms */
html[data-theme="dark"] body :is(.form-control, .custom-select, select, textarea,
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="color"]),
  .select2-container .select2-selection, .input-group-text, .vTextField, .vLargeTextField):not(.btn):not(.lms-primary-navbar *) {
  background-color: var(--dk-field) !important;
  color: var(--dk-ink) !important;
  border-color: var(--dk-line-strong) !important;
}
html[data-theme="dark"] body :is(.form-control, input, textarea)::placeholder { color: #6f819b !important; }
html[data-theme="dark"] body :is(.form-control, select, input, textarea):disabled,
html[data-theme="dark"] body .form-control[readonly] { background-color: var(--dk-raised) !important; color: var(--dk-muted) !important; }
html[data-theme="dark"] body .select2-container .select2-selection__rendered { color: var(--dk-ink) !important; }
html[data-theme="dark"] body .select2-results__option { color: var(--dk-text); }
html[data-theme="dark"] body .select2-results__option--highlighted { background-color: var(--ui-700) !important; color: #fff !important; }
html[data-theme="dark"] body .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--ui-100) !important; border-color: var(--ui-200) !important; color: var(--dk-ink) !important;
}

/* buttons that were white-on-light */
:root:not(.u1):not(.u2):not(.u3)[data-theme="dark"] body :is(.btn-light, .btn-default, .btn-outline-secondary, .btn-reset) {
  background: var(--dk-raised) !important; border-color: var(--dk-line-strong) !important; color: var(--dk-ink) !important;
}
:root:not(.u1):not(.u2):not(.u3)[data-theme="dark"] body :is(.btn-outline-primary, .btn-outline-info) { background: transparent !important; color: var(--p-400) !important; border-color: var(--p-400) !important; }
:root:not(.u1):not(.u2):not(.u3)[data-theme="dark"] body :is(.btn-outline-primary, .btn-outline-info):hover { background: var(--ui-700) !important; color: #fff !important; }
:root:not(.u1):not(.u2):not(.u3)[data-theme="dark"] body :is(.btn.changelink, .btn.viewlink) { color: var(--p-200, #99f6e4) !important; }
html[data-theme="dark"] body .lms-mode-switch button[aria-pressed="true"] { color: var(--p-200, #99f6e4); background: var(--dk-surface); }

/* badges and alerts: tinted, not pastel */
html[data-theme="dark"] body .badge-success { background: rgba(16,185,129,.18); color: #6ee7b7; }
html[data-theme="dark"] body .badge-danger  { background: rgba(239,68,68,.18);  color: #fca5a5; }
html[data-theme="dark"] body .badge-warning { background: rgba(245,158,11,.18); color: #fcd34d; }
html[data-theme="dark"] body .badge-info    { background: var(--ui-100); color: var(--p-200, #99f6e4); }
/* unread counters on the header icons stay solid red so they read at a glance */
html[data-theme="dark"] body :is(.navbar-badge, #lms-bell-badge, #portal-bell-badge, .lms-msg-badge, .lms-menu-badge) {
  background: #dc2626 !important; color: #fff !important;
}
html[data-theme="dark"] body .badge-secondary, html[data-theme="dark"] body .badge-light { background: var(--dk-raised); color: var(--dk-text); }
html[data-theme="dark"] body .alert-success, html[data-theme="dark"] body .messagelist .success { background: rgba(16,185,129,.12) !important; color: #a7f3d0 !important; border-color: rgba(16,185,129,.35) !important; }
html[data-theme="dark"] body .alert-danger, html[data-theme="dark"] body .messagelist .error { background: rgba(239,68,68,.12) !important; color: #fecaca !important; border-color: rgba(239,68,68,.35) !important; }
html[data-theme="dark"] body .alert-warning, html[data-theme="dark"] body .messagelist .warning { background: rgba(245,158,11,.12) !important; color: #fde68a !important; border-color: rgba(245,158,11,.35) !important; }
html[data-theme="dark"] body .alert-info, html[data-theme="dark"] body .messagelist .info { background: var(--ui-50) !important; color: var(--dk-ink) !important; border-color: var(--ui-200) !important; }

/* navigation bits */
html[data-theme="dark"] body .breadcrumb { background: transparent !important; }
html[data-theme="dark"] body .breadcrumb-item.active { color: var(--dk-muted) !important; }
html[data-theme="dark"] body .content-header .breadcrumb a { color: var(--p-400, #2dd4bf); }
html[data-theme="dark"] body .page-link { background-color: var(--dk-surface); border-color: var(--dk-line); color: var(--p-400, #2dd4bf); }
html[data-theme="dark"] body .nav-tabs { border-color: var(--dk-line); }
html[data-theme="dark"] body .nav-tabs .nav-link i, html[data-theme="dark"] body .nav-pills .nav-link i { color: var(--p-400, #2dd4bf); }
html[data-theme="dark"] body .nav-tabs .nav-link.active i, html[data-theme="dark"] body .nav-pills .nav-link.active i { color: #fff; }
html[data-theme="dark"] body .close { color: var(--dk-ink); text-shadow: none; }
html[data-theme="dark"] body ::selection { background: var(--ui-700); color: #fff; }
html[data-theme="dark"] body ::-webkit-scrollbar-thumb { background: #33445f; border-color: var(--dk-bg); }
html[data-theme="dark"] body ::-webkit-scrollbar-track { background: var(--dk-bg); }
html[data-theme="dark"] body .lms-section-title { color: var(--dk-ink); }
/* images with white backgrounds (logos) keep a light plate so they stay legible */
html[data-theme="dark"] body img.brand-image, html[data-theme="dark"] body .brand-logo-img { background-color: transparent; }

/* ───────────────────────── 13 · ADMIN FORM TABS ─────────────────────────
 * Change forms with Jazzmin horizontal tabs, enhanced by lms/js/admin_tabs.js: group pills
 * (ModelAdmin.tab_groups), real tab shapes with the active one underlined in the brand colour,
 * one row that scrolls sideways, error counts, unsaved-change dots, on/off dots, "in use" pills
 * and a "Find a setting" search. Without the script the tabs still get the shapes. */
body .lms-tabbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 12px; }
body .lms-tab-groups {
  display: inline-flex; gap: 3px; padding: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: thin;
  background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: 999px;
}
body .lms-tab-groups .lms-tab-group:not(#lms-no-id) {
  display: inline-flex !important; align-items: center; gap: 7px; flex: none; white-space: nowrap;
  padding: 7px 16px !important; min-height: 0 !important; height: auto !important; margin: 0 !important;
  border: 0 !important; border-radius: 999px !important; box-shadow: none !important; transform: none !important;
  background: transparent !important; color: var(--ui-muted) !important;
  font: 600 14px/1.2 var(--ui-font) !important; letter-spacing: 0 !important; text-transform: none !important;
}
body .lms-tab-groups .lms-tab-group:not(#lms-no-id):hover { background: var(--ui-surface) !important; color: var(--ui-text) !important; }
body .lms-tab-groups .lms-tab-group:not(#lms-no-id):focus-visible { outline: none; box-shadow: var(--ui-focus) !important; }
body .lms-tab-groups .lms-tab-group.is-active:not(#lms-no-id) { background: var(--ui-700) !important; color: #fff !important; }
body .lms-tab-group i { font-size: 13px; opacity: .85; }
body .lms-tab-group.has-dirty .lms-tab-group-name::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; vertical-align: 2px;
  border-radius: 50%; background: var(--ui-warning);
}
body .lms-tab-group.is-active.has-dirty .lms-tab-group-name::after { background: #fff; }

body .lms-tab-search { position: relative; flex: 0 1 260px; margin-left: auto; }
body .lms-tab-search > i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--ui-muted); pointer-events: none; }
body .lms-tab-search input[type=search]:not(#lms-no-id) {
  width: 100%; height: 36px; padding: 0 10px 0 31px !important; font-size: 13.5px;
  border: 1px solid var(--ui-line-strong); border-radius: var(--ui-radius); background: var(--ui-surface); color: var(--ui-text);
}
body .lms-tab-search input[type=search]:focus { outline: none; border-color: var(--ui-600); box-shadow: var(--ui-focus); }
body .lms-tab-results {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; min-width: 260px; max-height: 340px; overflow-y: auto;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow-lg); padding: 4px;
}
body .lms-tab-results .lms-tab-result:not(#lms-no-id) {
  display: block !important; width: 100%; text-align: left; margin: 0 !important; padding: 7px 10px !important; height: auto !important;
  border: 0 !important; border-radius: 6px !important; box-shadow: none !important; transform: none !important;
  background: transparent !important; color: var(--ui-text) !important; font: 500 13.5px/1.3 var(--ui-font) !important; text-transform: none !important;
}
body .lms-tab-results .lms-tab-result:not(#lms-no-id):hover,
body .lms-tab-results .lms-tab-result.is-active:not(#lms-no-id) { background: var(--ui-50) !important; }
body .lms-tab-result small { display: block; margin-top: 1px; font-size: 12px; color: var(--ui-muted); font-weight: 500; }
body .lms-tab-noresult { padding: 8px 10px; font-size: 13px; color: var(--ui-muted); }

/* the tab row: one line, scrolls sideways, real tab shapes */
body #jazzy-tabs.lms-tabs, body .change-form #jazzy-tabs {
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; gap: 2px;
  border-bottom: 1px solid var(--ui-line); margin-bottom: 16px !important;
}
body #jazzy-tabs > .nav-item { flex: none; margin-bottom: 0; }
body :is(#jazzy-tabs, .lms-tab-groups).lms-more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
body #jazzy-tabs > .nav-item.lms-tab-off { display: none; }
body #jazzy-tabs .nav-link {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 14px; margin-bottom: 0; font-size: 14px; font-weight: 600 !important;
  color: var(--ui-muted) !important; background: transparent !important;
  border: 1px solid transparent !important; border-bottom: 0 !important; border-radius: var(--ui-radius) var(--ui-radius) 0 0;
  box-shadow: inset 0 -2px 0 transparent;
}
body #jazzy-tabs .nav-link:hover { color: var(--ui-text) !important; background: var(--ui-bg) !important; }
body #jazzy-tabs .nav-link:focus-visible { outline: none; box-shadow: var(--ui-focus); }
body #jazzy-tabs .nav-link.active {
  color: var(--ui-800) !important; background: var(--ui-surface) !important;
  border-color: var(--ui-line) !important; box-shadow: inset 0 -3px 0 var(--ui-700); font-weight: 700 !important;
}
body #jazzy-tabs .lms-tab-unused .nav-link:not(.active) { opacity: .55; }
body .lms-tab-marks { display: inline-flex; align-items: center; gap: 5px; }
body .lms-tab-marks:empty { display: none; }
body .lms-tab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
body .lms-tab-dot-on { background: var(--ui-success); }
body .lms-tab-dot-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ui-line-strong); }
body .lms-tab-dot-dirty { background: var(--ui-warning); }
body .lms-tab-err {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--ui-danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
}
body .lms-tab-err[hidden] { display: none; }
body .lms-tab-pill {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--ui-success) 14%, transparent); color: var(--ui-success);
}
/* a field found by "Find a setting" */
body .form-group.lms-field-hit { animation: lms-field-hit 2.4s ease-out; border-radius: var(--ui-radius); }
@keyframes lms-field-hit {
  0%, 55% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-600) 45%, transparent); background: var(--ui-50); }
  100% { box-shadow: 0 0 0 3px transparent; background: transparent; }
}
/* Save panel: "Unsaved changes in N tabs" */
body .lms-dirty-note {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 10px; font-size: 13px; font-weight: 600;
  border-radius: var(--ui-radius); color: var(--ui-warning-dark); background: color-mix(in srgb, var(--ui-warning) 12%, transparent);
}
body .lms-dirty-note[hidden] { display: none; }
/* phones and tablets: search full width; the Save panel becomes a bar fixed to the bottom of the screen */
@media (max-width: 991px) {
  body .lms-tab-search { flex: 1 1 100%; margin-left: 0; }
  body .lms-tab-groups { border-radius: 14px; }
  body .lms-tab-groups .lms-tab-group:not(#lms-no-id) { padding: 7px 12px !important; }
  body .lms-tab-groups, body #jazzy-tabs { scrollbar-width: none; }
  body .lms-tab-groups::-webkit-scrollbar, body #jazzy-tabs::-webkit-scrollbar { display: none; }
  /* the column holding the Save panel sticks (the panel alone is as short as its buttons) */
  body.change-form #content-main .row > .col-lg-3:has(> #jazzy-actions) {
    position: sticky; bottom: 0; z-index: 20; margin-top: 4px; padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: var(--ui-surface); border-top: 1px solid var(--ui-line); box-shadow: 0 -6px 18px rgba(15,23,42,.10);
  }
  body.change-form #jazzy-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  body.change-form #jazzy-actions > .lms-dirty-note { flex: 1 1 100%; margin: 0; padding: 4px 8px; }
  body.change-form #jazzy-actions > div:not(.lms-dirty-note):not(.object-tools) { display: contents; }
  body.change-form #jazzy-actions :is(.form-group, .object-tools):not(#lms-no-id) { flex: none; width: auto !important; margin: 0 !important; }
  body.change-form #jazzy-actions :is(.form-group > .form-control, .object-tools > .btn):not(#lms-no-id) {
    width: auto !important; min-height: 0 !important; padding: 7px 12px !important; font-size: 13px !important; white-space: nowrap;
  }
}
/* dark mode: tokens flip by themselves; the active label needs a light brand tone */
html[data-theme="dark"] body #jazzy-tabs .nav-link.active { color: var(--p-300, #5eead4) !important; }
html[data-theme="dark"] body .lms-dirty-note { color: #fbbf24; }
html[data-theme="dark"] body .lms-tab-pill { color: #6ee7b7; }
html[data-theme="dark"] body.change-form #content-main .row > .col-lg-3:has(> #jazzy-actions) { box-shadow: 0 -6px 18px rgba(0,0,0,.45); }
