/* =============================================================================
   custom-theme.css  —  single source of truth for app colors (Material Design 3)
   -----------------------------------------------------------------------------
   To recolor the whole app, edit ONLY the hex values below.
   Light tokens  -> .custom-theme
   Dark tokens   -> .custom-theme.dark  (manual)  OR  [data-bs-theme="dark"]
                    (driven by the existing light/dark/auto toggle in _Header.cshtml,
                     which sets data-bs-theme on <html>).
   Consume colors via var(--token) or the .ct-* / utility classes below — never
   hard-code a hex in a view or component.
   ============================================================================= */

/* ---- Light ---- (ZeMTech deep-green brand: anchor #00241F, accent teal #20B2A2) */
.custom-theme {
  --primary:#00241F;   --on-primary:#FFFFFF;   --primary-container:#CDEFE9;   --on-primary-container:#00241F;
  --secondary:#0B3B35; --on-secondary:#FFFFFF; --secondary-container:#D6E8E4; --on-secondary-container:#0B3B35;
  --tertiary:#20B2A2;  --on-tertiary:#FFFFFF;  --tertiary-container:#A7E7DF;  --on-tertiary-container:#00241F;
  --error:#DC2626;     --on-error:#FFFFFF;     --error-container:#FEECEC;     --on-error-container:#5A1E1E;
  --background:#F7FAFA; --on-background:#0F1413;
  --surface:#FFFFFF;   --on-surface:#0F1413;   --surface-variant:#EEF5F4;    --on-surface-variant:#4E5B59;
  --outline:#C2D1CE;
  --primary-rgb:0,36,31;   /* rgb of --primary, for Bootstrap's rgba() vars (--bs-primary-rgb) */

  /* sidebar — deep-green panel (overrides AdminLTE's data-bs-theme=dark sidebar) */
  --sidebar-bg:#00241F; --sidebar-color:#C9D6D3; --sidebar-hover-bg:#0F3A34;
  --sidebar-active-bg:#11443E; --sidebar-active-color:#FFFFFF; --sidebar-accent:#20B2A2;

  /* dashboard chart palette (read by dashboard.charts.js) */
  --chart-1:#20B2A2; --chart-2:#0F3A34; --chart-3:#0891B2; --chart-4:#16A34A;
  --chart-5:#F59E0B; --chart-6:#0B3B35;
  --chart-success:#16A34A; --chart-danger:#DC2626; --chart-warning:#F59E0B;
  --chart-grid:rgba(15,20,19,.08); --chart-axis:rgba(15,20,19,.18);

  /* ambient canvas — 40px grid + two corner washes (teal top-right, amber bottom-left) */
  --grid-line:rgba(6,64,43,.06); --wash-teal:rgba(32,178,162,.14); --wash-amber:rgba(245,158,11,.10);
  /* neon glow — a medium green that stays visible as a shadow on white surfaces.
     Every button variant glows with a hue-matched token (always brighter than its fill). */
  --glow-primary:#18B45E; --panel-glow:rgba(6,64,43,.14);
  --glow-danger:#EF4444; --glow-success:#22C55E; --glow-warning:#FFB020;
  --glow-info:#3DD5F3; --glow-neutral:#94A3B8;
}

/* ---- Dark ---- (manual .dark class OR the app's data-bs-theme toggle) */
.custom-theme.dark,
[data-bs-theme="dark"] .custom-theme {
  --primary:#2FD0BE;   --on-primary:#00241F;   --primary-container:#103935;   --on-primary-container:#A7E7DF;
  --secondary:#1E5E57; --on-secondary:#E6FFFB; --secondary-container:#14302C; --on-secondary-container:#C1D2CF;
  --tertiary:#20B2A2;  --on-tertiary:#00241F;  --tertiary-container:#103935;  --on-tertiary-container:#A7E7DF;
  --error:#E69490;     --on-error:#5A1E1E;     --error-container:#5A1E1E;     --on-error-container:#FEECEC;
  --background:#0A0E0D; --on-background:#F2F5F4;   /* deep near-black green canvas (neon dark look) */
  --surface:#111C1A;   --on-surface:#F2F5F4;   --surface-variant:#14221F;    --on-surface-variant:#8EA29E;
  --outline:#2E3F3C;
  --primary-rgb:47,208,190;   /* rgb of dark-mode --primary */

  /* sidebar — deeper green */
  --sidebar-bg:#001814; --sidebar-color:#A9BDB8; --sidebar-hover-bg:#0F2F2B;
  --sidebar-active-bg:#103935; --sidebar-active-color:#E6FFFB; --sidebar-accent:#20B2A2;

  /* dashboard chart palette — lighter so it reads on the dark canvas */
  --chart-1:#2FD0BE; --chart-2:#5BC8A0; --chart-3:#4FB8D8; --chart-4:#5CD37E;
  --chart-5:#F0B968; --chart-6:#86C7BE;
  --chart-success:#5CD37E; --chart-danger:#E69490; --chart-warning:#F0B968;
  --chart-grid:rgba(242,245,244,.10); --chart-axis:rgba(242,245,244,.22);

  /* ambient canvas — brighter grid/washes so they read on the dark surface */
  --grid-line:rgba(47,208,190,.08); --wash-teal:rgba(32,178,162,.12); --wash-amber:rgba(245,158,11,.07);
  /* neon glow — a bright green that actually pops as a halo on the dark canvas */
  --glow-primary:#2FE08C; --panel-glow:rgba(32,178,162,.22);
  --glow-danger:#FF6B6B; --glow-success:#4ADE80; --glow-warning:#FFD75E;
  --glow-info:#67E3F9; --glow-neutral:#8EA29E;
}

/* =============================================================================
   Bootstrap variable bridge — map Bootstrap/AdminLTE's OWN theme + component CSS
   variables onto the MD3 tokens, so every component STATE (hover/active/focus/
   checked/show) derives from the brand palette instead of the baked-in #0d6efd blue.
   This is the root-cause layer: set the colour once here rather than chasing each
   pseudo-class. Bootstrap re-declares some component vars ON the component element
   (e.g. .dropdown-menu), so those must be retargeted on that element (scoped rules).
   ============================================================================= */
.custom-theme {
  --bs-primary: var(--primary);
  --bs-primary-rgb: var(--primary-rgb);
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: var(--primary-rgb);
  --bs-link-hover-color: var(--tertiary);
  --bs-link-hover-color-rgb: var(--primary-rgb);
  /* Neutral surfaces — remap Bootstrap/AdminLTE's default backgrounds onto the ZeMTech
     tokens so nothing (bg utilities, table stripe/hover, disabled inputs, subtle panels)
     falls back to the bluish-slate --bs-*-bg in dark mode. Cards / inputs / modals are
     already pinned to var(--surface) directly, so they're unaffected. */
  --bs-body-bg: var(--background);
  --bs-body-color: var(--on-background);
  --bs-secondary-bg: var(--surface-variant);
  --bs-tertiary-bg: var(--surface-variant);
}
/* AdminLTE sets --bs-dropdown-link-active-bg:#0d6efd on .dropdown-menu itself, which
   would win over a body-level override — so retarget it on the menu element. */
.custom-theme .dropdown-menu {
  --bs-dropdown-link-active-bg: var(--primary);
  --bs-dropdown-link-active-color: var(--on-primary);
}

/* =============================================================================
   Scrollbars — brand-teal handle. Covers native scrollbars (modals, tables,
   textareas, any element OverlayScrollbars doesn't manage) AND the
   OverlayScrollbars sidebar/body handle. Token-driven; follows light/dark.
   ============================================================================= */
.custom-theme ::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-theme ::-webkit-scrollbar-track { background: transparent; }
.custom-theme ::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--tertiary) 55%, transparent);
  border: 2px solid transparent;
  border-radius: 8px;
  background-clip: padding-box;
}
.custom-theme ::-webkit-scrollbar-thumb:hover { background: var(--tertiary); background-clip: padding-box; }
.custom-theme { scrollbar-color: color-mix(in srgb, var(--tertiary) 55%, transparent) transparent; }
/* OverlayScrollbars (sidebar + body) — tint the handle teal instead of the default grey/white */
.custom-theme .os-theme-light, .custom-theme .os-theme-dark,
.os-theme-light, .os-theme-dark {
  --os-size: 8px;
  --os-handle-bg: color-mix(in srgb, var(--tertiary) 60%, transparent);
  --os-handle-bg-hover: var(--tertiary);
  --os-handle-bg-active: var(--primary);
}

/* =============================================================================
   Opt-in layer — uses the variables above. Does NOT globally restyle AdminLTE /
   Bootstrap component classes (.btn-primary, .card), so existing pages are
   unaffected. New / restyled components opt in via these classes or var(--token).
   ============================================================================= */

/* page surface — solid canvas + a 40px grid and two soft corner washes (teal top-right,
   amber bottom-left). The opaque header/sidebar/cards sit on top; the pattern only shows
   through in the content gutters and around cards. */
body.custom-theme {
  /* !important so the theme canvas beats the body's `bg-body-tertiary` utility, which
     otherwise forces Bootstrap's --bs-tertiary-bg (a bluish slate in dark mode) and hid
     --background. In light the two nearly matched, so this only showed up in dark mode. */
  background-color: var(--background) !important;
  color: var(--on-background);
  background-image:
    radial-gradient(1100px 600px at 85% -10%, var(--wash-teal),  transparent 65%),
    radial-gradient(900px 640px at -10% 105%, var(--wash-amber), transparent 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, 40px 40px, 40px 40px;
  background-attachment: fixed;
}

/* tint native form controls (checkbox/radio/range + native <select> UI) green, not browser blue */
.custom-theme { accent-color: var(--primary); }

/* components */
.ct-card        { background: var(--surface); color: var(--on-surface);
                  border: 1px solid var(--outline); border-radius: 14px; }

/* Doubled class (specificity 0,2,0) so the token border always beats Bootstrap/AdminLTE's
   base `.btn` (which sets --bs-btn-border-color: transparent and would otherwise hide the
   outline until hover/focus). Keeps light/dark theming via the tokens. */
.ct-btn-primary.ct-btn-primary { background: var(--primary); color: var(--on-primary);
                  border: 1px solid var(--primary);
                  box-shadow: 0 0 22px -6px var(--glow-primary);
                  transition: box-shadow .15s ease, transform .15s ease, filter .15s ease; }
.ct-btn-primary:hover { filter: brightness(0.95);
                  box-shadow: 0 0 30px -3px var(--glow-primary); transform: translateY(-1px); }

.ct-btn-outline.ct-btn-outline { background: transparent; color: var(--primary);
                  border: 1px solid var(--primary);
                  box-shadow: 0 0 18px -8px var(--glow-primary);
                  transition: box-shadow .15s ease, transform .15s ease, filter .15s ease; }
.ct-btn-outline:hover { background: var(--primary); color: var(--on-primary);
                  box-shadow: 0 0 26px -4px var(--glow-primary); transform: translateY(-1px); }

/* Quiet informational button — a teal container tint, no border weight, no glow. Sits BELOW
   `.btn-primary` and `.btn-outline-primary` in the hierarchy, which is where an action that
   commits nothing (Help / guided tour) belongs, while staying clearly distinct from the outline
   buttons next to it. Same doubled-class + `--bs-btn-*` bridge as the other .ct-btn-* helpers. */
.ct-btn-tertiary-soft.ct-btn-tertiary-soft {
                  --bs-btn-bg: var(--tertiary-container);
                  --bs-btn-color: var(--on-tertiary-container);
                  --bs-btn-border-color: var(--tertiary-container);
                  --bs-btn-hover-bg: color-mix(in srgb, var(--tertiary) 32%, var(--tertiary-container));
                  --bs-btn-hover-color: var(--on-tertiary-container);
                  --bs-btn-hover-border-color: color-mix(in srgb, var(--tertiary) 32%, var(--tertiary-container));
                  --bs-btn-active-bg: color-mix(in srgb, var(--tertiary) 45%, var(--tertiary-container));
                  --bs-btn-active-color: var(--on-tertiary-container);
                  --bs-btn-active-border-color: color-mix(in srgb, var(--tertiary) 45%, var(--tertiary-container));
                  --bs-btn-focus-shadow-rgb: 32,178,162;
                  background: var(--tertiary-container); color: var(--on-tertiary-container);
                  /* a border of the same colour, so its box matches the outline buttons beside it */
                  border: 1px solid var(--tertiary-container);
                  transition: background-color .15s ease, transform .15s ease; }
.ct-btn-tertiary-soft:hover, .ct-btn-tertiary-soft:focus, .ct-btn-tertiary-soft:active {
                  background: color-mix(in srgb, var(--tertiary) 32%, var(--tertiary-container));
                  color: var(--on-tertiary-container);
                  transform: translateY(-1px); }

/* color utilities */
.bg-primary-container   { background: var(--primary-container);   color: var(--on-primary-container); }
.bg-secondary-container { background: var(--secondary-container); color: var(--on-secondary-container); }
.bg-tertiary-container  { background: var(--tertiary-container);  color: var(--on-tertiary-container); }
.bg-error-container     { background: var(--error-container);     color: var(--on-error-container); }
.bg-surface-variant     { background: var(--surface-variant);     color: var(--on-surface-variant); }
.text-primary-ct        { color: var(--primary); }
.border-outline         { border-color: var(--outline) !important; }

/* =============================================================================
   Existing-component theming — re-skins AdminLTE / Bootstrap components with the
   MD3 tokens so EXISTING pages adopt the new look without markup changes.
   Everything is scoped under `.custom-theme` (applied to <body>), so removing
   that class reverts the whole app. Dark mode is automatic (tokens change).
   ============================================================================= */

/* ---- surfaces: cards, modals, dropdowns ---- */
.custom-theme .card,
.custom-theme .modal-content,
.custom-theme .dropdown-menu {
  background-color: var(--surface);
  color: var(--on-surface);
  border-color: var(--outline);
}
.custom-theme .card-header,
.custom-theme .card-footer { border-color: var(--outline); }

/* soft elevation glow + rounder corners on cards (matches the kit's ~14–16px panels).
   Sets the Bootstrap card radius vars too so headers/footers round with the card. */
.custom-theme .card {
  box-shadow: 0 12px 40px -24px var(--panel-glow);
  --bs-card-border-radius: 14px;
  --bs-card-inner-border-radius: 13px;
  border-radius: 14px;
}

/* filled primary card header (.card-primary, not outlined) */
.custom-theme .card-primary:not(.card-outline) > .card-header {
  background-color: var(--primary);
  color: var(--on-primary);
}
/* outlined primary card */
.custom-theme .card-outline.card-primary { border-top-color: var(--primary); }
.custom-theme .card-primary.card-outline > .card-header { color: var(--primary); }

/* In dark mode --primary is a bright teal (for button legibility); that's too loud as a large
   filled header, so use the calmer secondary green for filled card-primary headers. */
[data-bs-theme="dark"] .custom-theme .card-primary:not(.card-outline) > .card-header {
  background-color: var(--secondary);
  color: var(--on-secondary);
}

/* ---- buttons — every variant carries the neon halo ----
   Filled: rest halo 22px, hover 30px + 1px lift. Outline: quieter rest halo 18px,
   hover 26px + lift. Glow hue always matches the button's semantic color and is
   brighter than the fill (--glow-* tokens). Chrome buttons (.btn-tool, .btn-close,
   .btn-link, .ct-actions-toggle) stay quiet on purpose. */
.custom-theme .btn { transition: box-shadow .15s ease, transform .15s ease, filter .15s ease; }

.custom-theme .btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  /* keep the pressed / .active / open-dropdown (.show) state on-brand instead of
     Bootstrap's default blue — these vars drive Bootstrap's .btn.active/.show rule */
  --bs-btn-active-bg: var(--primary);
  --bs-btn-active-border-color: var(--primary);
  --bs-btn-active-color: var(--on-primary);
  box-shadow: 0 0 22px -6px var(--glow-primary);
}
.custom-theme .btn-primary:hover,
.custom-theme .btn-primary:focus,
.custom-theme .btn-primary:active {
  filter: brightness(0.95);
  color: var(--on-primary);
  box-shadow: 0 0 30px -3px var(--glow-primary);
  transform: translateY(-1px);
}

/* filled semantic + neutral variants — same recipe, hue-matched glow */
.custom-theme .btn-danger    { box-shadow: 0 0 22px -6px var(--glow-danger); }
.custom-theme .btn-success   { box-shadow: 0 0 22px -6px var(--glow-success); }
.custom-theme .btn-warning   { box-shadow: 0 0 22px -6px var(--glow-warning); }
.custom-theme .btn-info      { box-shadow: 0 0 22px -6px var(--glow-info); }
.custom-theme .btn-secondary,
.custom-theme .btn-light,
.custom-theme .btn-dark      { box-shadow: 0 0 22px -6px var(--glow-neutral); }
.custom-theme .btn-danger:hover,    .custom-theme .btn-danger:focus,    .custom-theme .btn-danger:active    { box-shadow: 0 0 30px -3px var(--glow-danger);  transform: translateY(-1px); }
.custom-theme .btn-success:hover,   .custom-theme .btn-success:focus,   .custom-theme .btn-success:active   { box-shadow: 0 0 30px -3px var(--glow-success); transform: translateY(-1px); }
.custom-theme .btn-warning:hover,   .custom-theme .btn-warning:focus,   .custom-theme .btn-warning:active   { box-shadow: 0 0 30px -3px var(--glow-warning); transform: translateY(-1px); }
.custom-theme .btn-info:hover,      .custom-theme .btn-info:focus,      .custom-theme .btn-info:active      { box-shadow: 0 0 30px -3px var(--glow-info);    transform: translateY(-1px); }
.custom-theme .btn-secondary:hover, .custom-theme .btn-secondary:focus, .custom-theme .btn-secondary:active,
.custom-theme .btn-light:hover,     .custom-theme .btn-light:focus,     .custom-theme .btn-light:active,
.custom-theme .btn-dark:hover,      .custom-theme .btn-dark:focus,      .custom-theme .btn-dark:active      { box-shadow: 0 0 30px -3px var(--glow-neutral); transform: translateY(-1px); }

/* outline variants — quieter rest halo, fill + stronger halo on hover */
.custom-theme .btn-outline-primary {
  /* Drive EVERY state (rest / hover / focus / active / .show / disabled) from the
     tokens via Bootstrap's own button vars, so no state — including the hover
     border-colour and the open-dropdown state — can fall back to the #0d6efd blue. */
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-color: var(--on-primary);
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-focus-shadow-rgb: var(--primary-rgb);
  --bs-btn-active-color: var(--on-primary);
  --bs-btn-active-bg: var(--primary);
  --bs-btn-active-border-color: var(--primary);
  --bs-btn-disabled-color: var(--primary);
  --bs-btn-disabled-border-color: var(--primary);
  box-shadow: 0 0 18px -8px var(--glow-primary);
}
.custom-theme .btn-outline-primary:hover, .custom-theme .btn-outline-primary:focus, .custom-theme .btn-outline-primary:active { box-shadow: 0 0 26px -4px var(--glow-primary); transform: translateY(-1px); }

.custom-theme .btn-outline-danger {
  /* same full-state var mapping as outline-primary, on the --error token */
  --bs-btn-color: var(--error);
  --bs-btn-border-color: var(--error);
  --bs-btn-hover-color: var(--on-error);
  --bs-btn-hover-bg: var(--error);
  --bs-btn-hover-border-color: var(--error);
  --bs-btn-active-color: var(--on-error);
  --bs-btn-active-bg: var(--error);
  --bs-btn-active-border-color: var(--error);
  --bs-btn-disabled-color: var(--error);
  --bs-btn-disabled-border-color: var(--error);
  box-shadow: 0 0 18px -8px var(--glow-danger);
}
.custom-theme .btn-outline-danger:hover, .custom-theme .btn-outline-danger:focus, .custom-theme .btn-outline-danger:active { box-shadow: 0 0 26px -4px var(--glow-danger); transform: translateY(-1px); }

.custom-theme .btn-outline-secondary { box-shadow: 0 0 18px -8px var(--glow-neutral); }
.custom-theme .btn-outline-success   { box-shadow: 0 0 18px -8px var(--glow-success); }
.custom-theme .btn-outline-warning   { box-shadow: 0 0 18px -8px var(--glow-warning); }
.custom-theme .btn-outline-info      { box-shadow: 0 0 18px -8px var(--glow-info); }
.custom-theme .btn-outline-secondary:hover, .custom-theme .btn-outline-secondary:focus, .custom-theme .btn-outline-secondary:active { box-shadow: 0 0 26px -4px var(--glow-neutral); transform: translateY(-1px); }
.custom-theme .btn-outline-success:hover,   .custom-theme .btn-outline-success:focus,   .custom-theme .btn-outline-success:active   { box-shadow: 0 0 26px -4px var(--glow-success); transform: translateY(-1px); }
.custom-theme .btn-outline-warning:hover,   .custom-theme .btn-outline-warning:focus,   .custom-theme .btn-outline-warning:active   { box-shadow: 0 0 26px -4px var(--glow-warning); transform: translateY(-1px); }
.custom-theme .btn-outline-info:hover,      .custom-theme .btn-outline-info:focus,      .custom-theme .btn-outline-info:active      { box-shadow: 0 0 26px -4px var(--glow-info);    transform: translateY(-1px); }

/* =============================================================================
   De-blue leftover Bootstrap states — components/utilities whose *state* or fill
   fell back to Bootstrap's default palette (mostly the #0d6efd blue) because only
   the resting look was themed. All token-driven, so light/dark follow automatically.
   (Semantic outline buttons -danger/-success/-warning/-info keep their own hue by
   design — their active fill already matches their outline, so no blue leaks there.)
   ============================================================================= */

/* link-style button text (was Bootstrap link-blue) */
.custom-theme .btn-link { color: var(--primary); }
.custom-theme .btn-link:hover { color: var(--tertiary); }

/* .bg-primary utility (badges/chips, e.g. an "Administrator" badge) — was Bootstrap
   blue; retheme the fill and pair it with readable on-primary text in both modes. */
.custom-theme .bg-primary { background-color: var(--primary) !important; color: var(--on-primary) !important; }

/* plain Bootstrap dropdown items (header user / language / theme menus, report menus)
   highlighted Bootstrap-blue on hover/active. Excludes .ct-action-item, which keeps
   its own themed hover defined above. */
.custom-theme .dropdown-item:not(.ct-action-item):hover,
.custom-theme .dropdown-item:not(.ct-action-item):focus {
  background-color: var(--surface-variant);
  color: var(--on-surface);
}
.custom-theme .dropdown-item:not(.ct-action-item):active,
.custom-theme .dropdown-item:not(.ct-action-item).active {
  background-color: var(--primary);
  color: var(--on-primary);
}

/* checkbox / radio / switch focus ring (was blue) — match the teal control focus */
.custom-theme .form-check-input:focus {
  border-color: var(--tertiary);
  box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--tertiary) 25%, transparent);
}

/* pagination focus ring (was blue) */
.custom-theme .page-link:focus {
  box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--tertiary) 25%, transparent);
}

/* Bootstrap accordion — active header bg/text, chevron icon, and focus ring were all
   blue. Driven through Bootstrap's own --bs-accordion-* vars. The chevron is an inline
   SVG (can't hold a CSS var), so it uses the literal teal that mirrors --tertiary (#20B2A2). */
.custom-theme .accordion {
  --bs-accordion-bg: var(--surface);
  --bs-accordion-color: var(--on-surface);
  --bs-accordion-border-color: var(--outline);
  --bs-accordion-btn-color: var(--on-surface);
  --bs-accordion-active-bg: color-mix(in srgb, var(--primary) 10%, transparent);
  --bs-accordion-active-color: var(--primary);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--tertiary) 25%, transparent);
  --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2320B2A2'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2320B2A2'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

/* chrome buttons stay glow-free; disabled buttons drop the halo and the lift */
.custom-theme .btn-tool, .custom-theme .btn-close, .custom-theme .btn-link,
.custom-theme .ct-actions-toggle { box-shadow: none; }
.custom-theme .btn:disabled, .custom-theme .btn.disabled { box-shadow: none; transform: none; }

/* ---- links & primary text ---- */
.custom-theme a { color: var(--primary); }
.custom-theme .text-primary { color: var(--primary) !important; }
.custom-theme .text-bg-primary { background-color: var(--primary) !important; color: var(--on-primary) !important; }

/* ---- nav tabs (the app-wide tab look) ----
   Every .nav-tabs gets this automatically: borderless semibold links with an
   icon gap, muted by default; hover = var(--primary) text + underline hint.
   Active tab: LIGHT = a solid deep-green (--primary) filled tab with white
   text; DARK keeps the flat teal underline + faint tint (override below). */
.custom-theme .nav-tabs {
  border-bottom: 1px solid var(--outline);
  gap: .25rem;
  flex-wrap: wrap;
}
.custom-theme .nav-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--on-surface-variant);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1rem;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.custom-theme .nav-tabs .nav-link:hover {
  color: var(--primary);
  border-color: transparent;
  border-bottom-color: color-mix(in srgb, var(--primary) 40%, transparent);
}
/* Active = solid deep-green filled tab, white text (light mode). */
.custom-theme .nav-tabs .nav-link.active {
  color: var(--on-primary);
  background-color: var(--primary);
  border-color: transparent;
  border-bottom-color: var(--primary);
  box-shadow: 0 4px 12px -6px var(--glow-primary);
}
/* Dark mode keeps the flat teal underline + faint tint (no solid fill). */
.custom-theme.dark .nav-tabs .nav-link.active,
[data-bs-theme="dark"] .custom-theme .nav-tabs .nav-link.active {
  color: var(--primary);
  background-color: color-mix(in srgb, var(--primary) 8%, transparent);
  border-bottom-color: var(--primary);
  box-shadow: 0 2px 10px -6px var(--glow-primary);
}
.custom-theme .nav-tabs .nav-link.disabled { color: color-mix(in srgb, var(--on-surface-variant) 55%, transparent); }

/* ---- nav pills (kill the default Bootstrap blue) ---- */
.custom-theme .nav-pills .nav-link { color: var(--primary); }
.custom-theme .nav-pills .nav-link.active { background-color: var(--primary); color: var(--on-primary); }

/* ---- pagination (DataTables + Bootstrap) ---- */
.custom-theme .page-link {
  color: var(--primary);
  background-color: var(--surface);
  border-color: var(--outline);
}
.custom-theme .page-link:hover { background-color: var(--surface-variant); color: var(--primary); }
.custom-theme .page-item.active .page-link {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.custom-theme .page-item.disabled .page-link {
  color: var(--on-surface-variant);
  background-color: var(--surface);
  border-color: var(--outline);
}

/* ---- breadcrumbs (page-header trail) ---- */
.custom-theme .breadcrumb {
  --bs-breadcrumb-divider-color: var(--on-surface-variant);
  background-color: transparent;
}
.custom-theme .breadcrumb-item > a { color: var(--primary); text-decoration: none; }
.custom-theme .breadcrumb-item > a:hover { color: var(--tertiary); text-decoration: underline; }
.custom-theme .breadcrumb-item.active { color: var(--on-surface-variant); }
.custom-theme .breadcrumb-item + .breadcrumb-item::before { color: var(--on-surface-variant); }

/* ---- form controls ---- */
.custom-theme .form-control,
.custom-theme .form-select {
  background-color: var(--surface);
  color: var(--on-surface);
  border-color: var(--outline);
  /* tint the native dropdown's hovered/selected option green, not browser-blue */
  accent-color: var(--primary);
}
/* native <select> popup chrome follows the active theme (light list in light, dark in dark) */
.custom-theme .form-select { color-scheme: light; }
[data-bs-theme="dark"] .custom-theme .form-select,
.custom-theme.dark .form-select { color-scheme: dark; }

.custom-theme .form-control:focus,
.custom-theme .form-select:focus {
  border-color: var(--tertiary);
  /* neon focus halo (teal) — matches the kit's soft-glow focus, not a flat ring */
  box-shadow: 0 0 18px -6px var(--tertiary);
}
.custom-theme .form-control::placeholder { color: var(--on-surface-variant); }
.custom-theme .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* native <select> dropdown options — themed surface + green selected row
   (replaces the default browser-blue highlight on the chosen option) */
.custom-theme .form-select option {
  background-color: var(--surface);
  color: var(--on-surface);
}
.custom-theme .form-select option:checked,
.custom-theme .form-select option[selected],
.custom-theme .form-select option:hover,
.custom-theme .form-select option:focus {
  /* the inset box-shadow forces the fill in Chromium, which otherwise ignores
     background on a hovered/checked <option>; background covers Firefox */
  background: var(--primary);
  box-shadow: 0 0 0 100px var(--primary) inset;
  color: var(--on-primary);
}

/* ---- tables (incl. DataTables) ---- */
.custom-theme .table {
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--on-surface);
  --bs-table-striped-bg: var(--surface-variant);
  --bs-table-striped-color: var(--on-surface);
  --bs-table-border-color: var(--outline);
}
.custom-theme .table > thead {
  background-color: var(--primary-container);
  color: var(--on-primary-container);
}

/* ==== DataTables — kit-style clean list =====================================
   Muted uppercase header + single underline, horizontal rules only (no vertical
   grid / zebra), row-hover accent bar, and a glowing pill pager. Scoped to
   `table.dataTable` so static .table blocks (reports/cards) keep the branded
   green header above. Remove this block to revert lists to that header. */

/* flatten Bootstrap's zebra + accent tint so rows read like the kit */
.custom-theme table.dataTable { --bs-table-striped-bg: transparent; --bs-table-accent-bg: transparent; }

/* header: transparent, muted uppercase labels, one subtle teal underline */
.custom-theme table.dataTable > thead { background-color: transparent; }
.custom-theme table.dataTable > thead > tr > th {
  background-color: transparent;
  color: var(--on-surface-variant);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
/* keep the sort glyph inline next to its title. DataTables lays the header out as a flex
   row with .dt-column-title { flex-grow:1 }, which stretches the title and pushes the
   glyph to the column's far right — making it look like a stray/doubled icon. inline-flex
   makes the header hug its content and honor each column's own text-align. */
.custom-theme table.dataTable > thead .dt-column-header {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
/* zero every cell border, then add back only horizontal separators */
.custom-theme table.dataTable > :not(caption) > * > * { border-width: 0; }
.custom-theme table.dataTable > thead > tr > th {
  border-bottom: 2px solid color-mix(in srgb, var(--tertiary) 40%, var(--outline));
}
.custom-theme table.dataTable > tbody > tr > td { border-bottom: 1px solid var(--outline); }

/* the currently-sorted column header reads in the brand accent */
.custom-theme table.dataTable > thead > tr > th.dt-ordering-asc,
.custom-theme table.dataTable > thead > tr > th.dt-ordering-desc { color: var(--primary); }

/* row hover: subtle tint across the row + a teal accent bar on the leading edge */
.custom-theme table.dataTable > tbody > tr { transition: background-color .12s ease; }
.custom-theme table.dataTable > tbody > tr:hover > * { background-color: var(--surface-variant); color: var(--on-surface); }
.custom-theme table.dataTable > tbody > tr:hover > *:first-child { box-shadow: inset 2px 0 0 var(--tertiary); }

/* separated rounded page buttons with a soft glow on the active page */
.custom-theme .dt-paging .pagination,
.custom-theme .dataTables_paginate .pagination { gap: 6px; }
.custom-theme .dt-paging .page-item .page-link,
.custom-theme .dataTables_paginate .page-item .page-link { border-radius: 8px; }
.custom-theme .dt-paging .page-item.active .page-link,
.custom-theme .dataTables_paginate .page-item.active .page-link {
  box-shadow: 0 0 14px -4px var(--glow-primary);
}

/* ---- Row-actions kebab menu (kit-style; School list Actions columns) ---- */
.custom-theme .ct-actions-toggle {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--on-surface-variant);
  transition: color .15s, border-color .15s, box-shadow .15s;
}
.custom-theme .ct-actions-toggle:hover,
.custom-theme .ct-actions-menu.show .ct-actions-toggle {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--tertiary) 55%, var(--outline));
  box-shadow: 0 0 14px -5px var(--glow-primary);
}
.custom-theme .ct-actions-pop {
  min-width: 190px; padding: 6px;
  border-radius: 12px;
  box-shadow: 0 12px 40px -12px var(--panel-glow);
}
.custom-theme .ct-action-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border-radius: 8px;
  color: var(--on-surface); font-size: .9rem;
}
.custom-theme .ct-action-item > i { width: 18px; text-align: center; opacity: .85; }
.custom-theme .ct-action-item:hover,
.custom-theme .ct-action-item:focus {
  background: var(--surface-variant);
  color: var(--primary);
}
.custom-theme .ct-action-item.text-danger:hover,
.custom-theme .ct-action-item.text-danger:focus {
  background: color-mix(in srgb, var(--error) 14%, transparent);
  color: var(--error);
}
/* let the kebab menu escape the datatable's scroll box (responsive:true collapses
   overflow columns, so making this visible won't introduce a scrollbar). Auto-scoped
   to tables that actually render a kebab — i.e. the School lists we convert. */
.custom-theme .card-datatable:has(.ct-actions-menu) { overflow: visible; }

/* ---- header navbar ---- */
.custom-theme .app-header.navbar {
  background-color: var(--surface) !important;
  color: var(--on-surface);
  border-bottom: 1px solid var(--outline);
}
.custom-theme .app-header .nav-link { color: var(--on-surface); }

/* ---- sidebar — deep-green panel in both light & dark ---- */
.custom-theme .app-sidebar {
  background-color: var(--sidebar-bg) !important;
  color: var(--sidebar-color);
}
.custom-theme .app-sidebar .nav-link { color: var(--sidebar-color); }
.custom-theme .app-sidebar .nav-link:hover {
  background-color: var(--sidebar-hover-bg);
  color: #fff;
}
.custom-theme .app-sidebar .nav-link.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  box-shadow: inset 3px 0 0 var(--sidebar-accent), 0 0 16px -6px var(--sidebar-accent);
}
.custom-theme .app-sidebar .nav-link.active .nav-icon { color: var(--sidebar-accent); }
.custom-theme .sidebar-brand,
.custom-theme .app-sidebar .brand-link {
  background-color: var(--sidebar-bg);
  color: #fff;
}

/* ---- Select2 (bootstrap-5 theme) — fixes light/dark dropdown styling ---- */
/* closed control */
.custom-theme .select2-container--bootstrap-5 .select2-selection {
  background-color: var(--surface);
  color: var(--on-surface);
  border-color: var(--outline);
}
/* focused / open control — kill Bootstrap's blue focus ring, use the teal neon halo
   (matches the native .form-control:focus glow). Higher specificity than the theme's
   .select2-container--focus/--open selectors, so it wins. */
.custom-theme .select2-container--bootstrap-5.select2-container--focus .select2-selection,
.custom-theme .select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--tertiary);
  box-shadow: 0 0 18px -6px var(--tertiary);
}
.custom-theme .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  color: var(--on-surface);
}
.custom-theme .select2-container--bootstrap-5 .select2-selection__placeholder {
  color: var(--on-surface-variant);
}
.custom-theme .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow b {
  border-color: var(--on-surface-variant) transparent transparent transparent;
}
/* open dropdown panel + its search box */
.custom-theme .select2-dropdown {
  background-color: var(--surface);
  color: var(--on-surface);
  border-color: var(--outline);
}
.custom-theme .select2-search--dropdown .select2-search__field {
  background-color: var(--surface);
  color: var(--on-surface);
  border-color: var(--outline);
}
.custom-theme .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--tertiary);
  box-shadow: 0 0 14px -6px var(--tertiary);
  outline: none;
}
/* option rows */
.custom-theme .select2-results__option { color: var(--on-surface); }
/* !important: the select2-bootstrap-5 theme targets these rows with deep, high-specificity
   selectors (…__options …__option--highlighted[aria-selected]) that otherwise win and paint
   the row Bootstrap-blue. !important guarantees the theme green here. */
.custom-theme .select2-container--bootstrap-5 .select2-results__option--highlighted,
.custom-theme .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--primary) !important;
  color: var(--on-primary) !important;
}
/* the already-chosen row — green tint (matches the native <select>'s selected option) */
.custom-theme .select2-container--bootstrap-5 .select2-results__option--selected,
.custom-theme .select2-results__option[aria-selected="true"] {
  background-color: var(--primary-container) !important;
  color: var(--on-primary-container) !important;
}
/* hovering/keyboarding the selected row — solid primary wins */
.custom-theme .select2-results__option--selected.select2-results__option--highlighted {
  background-color: var(--primary) !important;
  color: var(--on-primary) !important;
}
/* multi-select tags */
.custom-theme .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
  background-color: var(--primary-container);
  color: var(--on-primary-container);
  border-color: var(--outline);
}
