/* @import MUST stay first — pulls in the Inter brand font (design sheet:
   "Inter · Clean. Modern. Professional."). Applied app-wide below,
   scoped to the modern themes (any non-default data-dashboard-theme). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================================
   Modern theme — global overrides
   Loaded on EVERY page ONLY when AppSettings:DashboardTheme is a
   non-default value (e.g. "efms", "inmotus_Studio") — see the
   conditional <link> in _Layout.cshtml.
   When the flag is "default", this file is not loaded at all,
   so the default theme renders exactly as before — zero changes.
   ============================================================ */

/* -----------------------------------------------------------
   Navbar profile avatar — per-theme brand colour.
   Keyed off <html data-dashboard-theme="..."> so each theme gets
   its own avatar: default -> Bootstrap blue (this file isn't even
   loaded), efms -> green, inmotus_Studio -> navy/orange.
   (#profileDropdown gives id-level specificity to beat the
   .bg-primary utility, which itself uses !important.)
   ----------------------------------------------------------- */

/* Base (all modern themes): white initials, fs-6 size. Background is
   set per theme below. */
#profileDropdown .bg-primary {
  color: #fff !important;
  font-size: 1rem !important; /* fs-6 (overrides the markup's fs-5) */
}

/* eFMS theme -> green gradient + green open-ring */
html[data-dashboard-theme="efms" i] #profileDropdown .bg-primary {
  background: linear-gradient(135deg, #12a37d, #0e7d60) !important;
}
html[data-dashboard-theme="efms" i] #profileDropdown.show,
html[data-dashboard-theme="efms" i] #profileDropdown[aria-expanded="true"] {
  border-color: #0e7d60 !important;
  box-shadow: 0 0 0 2px rgba(18, 163, 125, 0.35) !important;
}

/* inmotus_Studio theme -> navy/orange gradient (sampled from logo) + orange open-ring */
html[data-dashboard-theme="inmotus_Studio" i] #profileDropdown .bg-primary {
  background: linear-gradient(135deg, #0c1e5e 0%, #0c1e5e 45%, #f69a1e 135%) !important;
}
html[data-dashboard-theme="inmotus_Studio" i] #profileDropdown.show,
html[data-dashboard-theme="inmotus_Studio" i] #profileDropdown[aria-expanded="true"] {
  border-color: #f69a1e !important;
  box-shadow: 0 0 0 2px rgba(246, 154, 30, 0.40) !important;
}

/* No lingering ring: on plain focus/active (dropdown closed) show
   nothing. The per-theme .show rules above are more specific, so they
   win while the dropdown is open. */
#profileDropdown:focus,
#profileDropdown:focus-visible,
#profileDropdown:active {
  outline: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* -----------------------------------------------------------
   Legacy "index" cards (.s-dashboard-card-sm)
   These list-style landing pages (Settings, Reports, Tax, Fee,
   Exams, Events, Workflows, Help ...) each define an inline grey
   (#bdc3c7) card. Re-theme them to match the eFMS dashboard look,
   theme-aware via Bootstrap --bs-* tokens.
   The `body[id$="Page"]` prefix raises specificity above the
   pages' own bare `.s-dashboard-card-sm` rules so this wins
   without touching each page's markup or using !important.
   ----------------------------------------------------------- */
body[id$="Page"] .s-dashboard-card-sm {
  height: auto;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  padding: 24px;
  color: var(--bs-body-color);
  transition: all 0.2s ease;
}

  body[id$="Page"] .s-dashboard-card-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 24, 40, .08), 0 12px 30px rgba(16, 24, 40, .08);
    color: var(--bs-body-color);
    text-decoration: none;
  }

  body[id$="Page"] .s-dashboard-card-sm .card-body {
    padding: 0;
    margin: 0;
  }

  body[id$="Page"] .s-dashboard-card-sm h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-emphasis-color, var(--bs-body-color));
    white-space: normal;
  }

  body[id$="Page"] .s-dashboard-card-sm ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  body[id$="Page"] .s-dashboard-card-sm li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--bs-body-color);
    text-decoration: none;
    transition: all 0.15s ease;
  }

    /* Leading arrow on every list item (mirrors .dashboard-card__arrow). */
    body[id$="Page"] .s-dashboard-card-sm li a::before {
      content: "\f061"; /* fa-arrow-right */
      font-family: "Font Awesome 6 Pro";
      font-weight: 900;
      font-size: 11px;
      line-height: 1;
      flex: 0 0 auto;
      color: var(--bs-secondary-color, #9CA3AF);
      transition: transform 0.15s ease, color 0.15s ease;
    }

    body[id$="Page"] .s-dashboard-card-sm li a:hover {
      background: var(--bs-tertiary-bg, rgba(37, 99, 235, .08));
      color: var(--bs-primary, #2563EB);
    }

      body[id$="Page"] .s-dashboard-card-sm li a:hover::before {
        color: var(--bs-primary, #2563EB);
        transform: translateX(2px);
      }

/* ============================================================
   INMOTUS STUDIO — brand design tokens & component theme
   Scoped to html[data-dashboard-theme="inmotus_Studio"] so the
   efms/default themes are never affected. Palette sampled from
   the Inmotus Studio logo sheet:
     Primary (orange) #FF9800 · Navy #0D1B4C · Secondary #1E3A8A
     Secondary-light #E8EBFF · Background #F7F8FC · Muted #6B7280
   The base erie theme hardcodes .btn-* colours (it does NOT read
   --bs-primary), so buttons are re-tokenised explicitly below.
   ============================================================ */
html[data-dashboard-theme="inmotus_Studio" i] {
  /* brand tokens (reusable) */
  --theme-primary: #FF9800;
  --theme-primary-rgb: 255, 152, 0;
  --theme-primary-hover: #E67E00;
  --theme-primary-active: #CC7000;
  --theme-primary-soft: #FFF3E0;
  --theme-dark: #0D1B4C;
  --theme-dark-rgb: 13, 27, 76;
  --theme-dark-active: #0A1540;
  --theme-secondary: #1E3A8A;
  --theme-secondary-light: #E8EBFF;
  --theme-bg: #F7F8FC;
  --theme-muted: #6B7280;
  --theme-text: #1F2937;          /* spec: Text Primary */
  --theme-border: #E5E7EB;        /* spec: Border */
  --theme-radius: 12px;           /* spec: Card radius */
  --theme-modal-radius: 16px;     /* spec: Modal radius */
  --theme-input-h: 40px;          /* spec: Input height */
  --theme-card-shadow: 0 1px 2px rgba(13, 27, 76, .04), 0 8px 24px rgba(13, 27, 76, .06);
  /* semantic tokens (spec) — also remap Bootstrap's success/warning/danger so
     alert/text/bg utilities follow the brand */
  --theme-success: #22C55E;
  --theme-warning: #F59E0B;
  --theme-danger:  #EF4444;
  --bs-success: #22C55E;  --bs-success-rgb: 34, 197, 94;
  --bs-warning: #F59E0B;  --bs-warning-rgb: 245, 158, 11;
  --bs-danger:  #EF4444;  --bs-danger-rgb: 239, 68, 68;

  /* remap Bootstrap "primary" -> brand orange
     (drives .text-primary, .bg-primary, .border-primary, links, focus rings) */
  --bs-primary: #FF9800;
  --bs-primary-rgb: 255, 152, 0;
  --bs-primary-text: #CC7000;
  --bs-primary-bg-subtle: #FFF3E0;
  --bs-primary-border-subtle: #FFD8A8;
  /* LINK TEXT uses a deeper amber than the #FF9800 brand orange: orange text on
     white is only ~2.16:1 contrast (fails WCAG AA). #B45309 reads clearly (5.02:1,
     passes AA) while staying in the warm brand family. The bright orange stays for
     buttons/accents/fills where contrast is fine. Hover goes a shade darker. */
  --bs-link-color: #B45309;
  --bs-link-color-rgb: 180, 83, 9;
  --bs-link-hover-color: #92400E;
  --bs-link-hover-color-rgb: 146, 64, 14;
}

/* ============================================================
   eFMS — brand design tokens
   Green/teal palette derived from the eFMS logo.
   Primary (teal) #12A37D · Dark #14332A (deep forest green)
   ============================================================ */
html[data-dashboard-theme="efms" i] {
  --theme-primary: #12A37D;
  --theme-primary-rgb: 18, 163, 125;
  --theme-primary-hover: #0E8A6A;
  --theme-primary-active: #0B7559;
  --theme-primary-soft: #E6F7F2;
  --theme-dark: #14332A;
  --theme-dark-rgb: 20, 51, 42;
  --theme-dark-active: #0B2B22;
  --theme-secondary: #1A6B55;
  --theme-secondary-light: #DCF0EA;
  --theme-bg: #F5FAF8;
  --theme-muted: #6B7280;
  --theme-text: #1F2937;
  --theme-border: #E5E7EB;
  --theme-radius: 12px;
  --theme-modal-radius: 16px;
  --theme-input-h: 40px;
  --theme-card-shadow: 0 1px 2px rgba(20, 51, 42, .04), 0 8px 24px rgba(20, 51, 42, .06);
  --theme-success: #22C55E;
  --theme-warning: #F59E0B;
  --theme-danger:  #EF4444;
  --bs-success: #22C55E;  --bs-success-rgb: 34, 197, 94;
  --bs-warning: #F59E0B;  --bs-warning-rgb: 245, 158, 11;
  --bs-danger:  #EF4444;  --bs-danger-rgb: 239, 68, 68;
  --bs-primary: #12A37D;
  --bs-primary-rgb: 18, 163, 125;
  --bs-primary-text: #0B7559;
  --bs-primary-bg-subtle: #E6F7F2;
  --bs-primary-border-subtle: #A3E0CE;
  --bs-link-color: #0B7559;
  --bs-link-color-rgb: 11, 117, 89;
  --bs-link-hover-color: #0E8A6A;
  --bs-link-hover-color-rgb: 14, 138, 106;
}

/* ---- Page background: soft light-gray ---- */
html[data-dashboard-theme] body {
  background-color: var(--theme-bg);
}

/* ---- PRIMARY button -> primary colour ---- */
html[data-dashboard-theme] .btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--theme-primary);
  --bs-btn-border-color: var(--theme-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--theme-primary-hover);
  --bs-btn-hover-border-color: var(--theme-primary-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--theme-primary-active);
  --bs-btn-active-border-color: var(--theme-primary-active);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--theme-primary);
  --bs-btn-disabled-border-color: var(--theme-primary);
  --bs-btn-focus-shadow-rgb: var(--theme-primary-rgb);
}

/* ---- SECONDARY button -> brand-dark (hover brightens to secondary) ---- */
html[data-dashboard-theme] .btn-secondary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--theme-dark);
  --bs-btn-border-color: var(--theme-dark);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--theme-secondary);
  --bs-btn-hover-border-color: var(--theme-secondary);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--theme-dark-active);
  --bs-btn-active-border-color: var(--theme-dark-active);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--theme-dark);
  --bs-btn-disabled-border-color: var(--theme-dark);
  --bs-btn-focus-shadow-rgb: var(--theme-dark-rgb);
}

/* ---- OUTLINE button -> primary border/text, soft fill on hover ---- */
html[data-dashboard-theme] .btn-outline-primary {
  --bs-btn-color: var(--theme-primary);
  --bs-btn-border-color: var(--theme-primary);
  --bs-btn-hover-color: var(--theme-primary-active);
  --bs-btn-hover-bg: var(--theme-primary-soft);
  --bs-btn-hover-border-color: var(--theme-primary);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--theme-primary);
  --bs-btn-active-border-color: var(--theme-primary);
  --bs-btn-focus-shadow-rgb: var(--theme-primary-rgb);
}

/* ---- GHOST button (utility, opt-in via .btn-ghost) -> subtle gray, dark text ---- */
html[data-dashboard-theme] .btn-ghost {
  --bs-btn-color: var(--theme-dark);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--theme-dark);
  --bs-btn-hover-bg: var(--theme-secondary-light);
  --bs-btn-hover-border-color: var(--theme-secondary-light);
  --bs-btn-active-color: var(--theme-dark);
  --bs-btn-active-bg: var(--theme-secondary-light);
  --bs-btn-active-border-color: var(--theme-secondary-light);
  --bs-btn-focus-shadow-rgb: var(--theme-dark-rgb);
}

/* ---- Cards: white, rounded 10px, subtle shadow ---- */
html[data-dashboard-theme] .card {
  border-radius: var(--theme-radius);
  border-color: var(--theme-border);
  box-shadow: var(--theme-card-shadow);
}

/* ---- Forms: rounded inputs, primary focus ring ---- */
html[data-dashboard-theme] .form-control,
html[data-dashboard-theme] .form-select {
  border-radius: 8px;
}
html[data-dashboard-theme] .form-control:focus,
html[data-dashboard-theme] .form-select:focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 .2rem rgba(var(--theme-primary-rgb), .20);
}
html[data-dashboard-theme] .form-check-input:checked {
  background-color: var(--theme-primary);
  border-color: var(--theme-primary);
}
html[data-dashboard-theme] .form-check-input:focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 .2rem rgba(var(--theme-primary-rgb), .20);
}

/* ---- Tables: muted header, subtle row hover ---- */
html[data-dashboard-theme] .table > thead th {
  color: var(--theme-muted);
  font-weight: 600;
  text-transform: none;
}
html[data-dashboard-theme] .table-hover > tbody > tr:hover > * {
  background-color: rgba(var(--theme-primary-rgb), .05);
}

/* ---- Badges: soft palette (primary / secondary tint / warning tint, plus success/danger) ---- */
html[data-dashboard-theme] .badge.bg-primary {
  background-color: var(--theme-primary) !important;
}
html[data-dashboard-theme] .badge.bg-secondary {
  background-color: var(--theme-secondary-light) !important;
  color: var(--theme-secondary) !important;
}
html[data-dashboard-theme] .badge.bg-warning {
  background-color: var(--theme-primary-soft) !important;
  color: var(--theme-primary-active) !important;
}

/* ---- Muted / secondary text ---- */
html[data-dashboard-theme] .text-muted,
html[data-dashboard-theme] .text-secondary {
  color: var(--theme-muted) !important;
}

/* ---- Nav / active states pick up the brand primary ---- */
html[data-dashboard-theme] .nav-pills .nav-link.active,
html[data-dashboard-theme] .nav-pills .show > .nav-link {
  background-color: var(--theme-primary);
  color: #fff;
}

/* ---- Top menu bar: hover / open / active menu items -> primary ---- */
html[data-dashboard-theme] .navbar-nav .nav-link:hover,
html[data-dashboard-theme] .navbar-nav .nav-link:focus,
html[data-dashboard-theme] .navbar-nav .nav-link.show,
html[data-dashboard-theme] .navbar-nav .nav-item.show > .nav-link,
html[data-dashboard-theme] .navbar-nav .nav-link.active {
  color: var(--theme-primary) !important;
}

/* ---- Modern dashboard (dashboard.css): its interactive accent is a hardcoded
   blue (--primary-blue #2563EB) used for card-arrow hover, active borders, etc.
   Remap that one token to the brand primary for the modern dashboard. The multi-
   colour --accent-* icon tiles are intentional and left untouched. ---- */
html[data-dashboard-theme] #s-DashboardPage {
  --primary-blue: var(--theme-primary);
}
/* two hardcoded blue literals in dashboard.css that the var remap can't reach */
html[data-dashboard-theme] #s-DashboardPage .dashboard__select:focus {
  box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), .18) !important;
}
html[data-dashboard-theme] #s-DashboardPage .btn-dash--primary:hover {
  background: var(--theme-primary-hover) !important;
}

/* ============================================================
   MODERN THEME — SERENITY ADMIN components
   The Serenity grid/dialog UI does NOT read --bs-primary; it uses
   its own bootstrap, jQuery-UI and select2 styling with hardcoded
   blue accents (#0d6efd / #5f83b9 / select2 blue). This file loads
   AFTER those bundles, so these overrides win. Convention:
   PRIMARY (--theme-primary) = selected accents · DARK (--theme-dark) = menu/calendar highlights.
   ============================================================ */

/* ---- Bootstrap dropdown menus (grid column picker, export, row menus, top-nav
   submenus) ---- */
html[data-dashboard-theme] .dropdown-menu {
  --bs-dropdown-link-active-bg: var(--theme-primary);
  --bs-dropdown-link-active-color: #fff;
  --bs-dropdown-link-hover-bg: var(--theme-primary-soft);
  --bs-dropdown-link-hover-color: var(--theme-primary-active);
}
/* menu item text was 16.875px (0.9375rem against the 18px root) — bigger than the
   14px top-nav labels + body. Pin to 14px so menus read consistently. */
html[data-dashboard-theme] .dropdown-menu .dropdown-item,
html[data-dashboard-theme] .dropdown-menu > li > a {
  font-size: 14px;
}

/* ---- Serenity grid toolbar: flat modern buttons + brand hover.
   (Button icons are baked-in colour PNG sprites, so we keep them and
   restyle the button chrome rather than fill it solid.) ---- */
html[data-dashboard-theme] div.s-Toolbar .tool-button {
  background: #fff;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  color: var(--theme-dark);
}
html[data-dashboard-theme] div.s-Toolbar .tool-button .button-outer {
  border-color: transparent;
}
html[data-dashboard-theme] div.s-Toolbar .tool-button:hover,
html[data-dashboard-theme] div.s-Toolbar .tool-button:hover .button-outer {
  background-color: var(--theme-primary-soft);
  border-color: var(--theme-primary);
  color: var(--theme-primary-active);
}
html[data-dashboard-theme] div.s-Toolbar .tool-button.pressed {
  background: var(--theme-primary-soft);
  border-color: var(--theme-primary);
}
/* Create/New button -> primary left accent (keeps the green "+" sprite legible) */
html[data-dashboard-theme] div.s-Toolbar .tool-button.add-button {
  border-left: 3px solid var(--theme-primary);
}
/* Include-deleted toggle pressed state (was yellow #fe7) */
html[data-dashboard-theme] .s-ToggleButton.pressed a {
  background-color: var(--theme-primary-soft) !important;
}

/* ---- jQuery-UI: autocomplete menus, datepicker, buttons (dark highlight) ---- */
html[data-dashboard-theme] .ui-menu .ui-menu-item a.ui-state-focus,
html[data-dashboard-theme] .ui-menu .ui-menu-item a.ui-state-hover,
html[data-dashboard-theme] .ui-menu .ui-menu-item a.ui-state-active,
html[data-dashboard-theme] .ui-datepicker table .ui-state-hover,
html[data-dashboard-theme] .ui-datepicker-calendar .ui-state-active {
  background: var(--theme-dark) !important;
  border-color: var(--theme-dark) !important;
  color: #fff !important;
  text-shadow: none !important;
}
html[data-dashboard-theme] .ui-datepicker table .ui-state-highlight {
  border-color: var(--theme-primary) !important;
  color: var(--theme-primary-active) !important;
}
html[data-dashboard-theme] button.ui-state-active,
html[data-dashboard-theme] .ui-button.ui-state-active,
html[data-dashboard-theme] .ui-button.ui-state-focus,
html[data-dashboard-theme] .ui-buttonset .ui-button.ui-state-active {
  background: var(--theme-secondary-light) !important;
  border-color: var(--theme-secondary) !important;
  color: var(--theme-dark) !important;
}

/* ---- select2 dropdowns (highlighted option -> dark, focus border -> primary) ---- */
html[data-dashboard-theme] .select2-results .select2-highlighted,
html[data-dashboard-theme] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--theme-dark) !important;
  color: #fff !important;
}
html[data-dashboard-theme] .select2-container-active .select2-choice,
html[data-dashboard-theme] .select2-drop-active,
html[data-dashboard-theme] .select2-container--focus .select2-selection {
  border-color: var(--theme-primary) !important;
}

/* ---- Bootstrap nav-tabs (dialog/property-grid tabs): primary underline, dark text.
   Force transparent bg + dark text so the active tab stays readable even in dark
   mode (bootstrap otherwise gives the active tab a dark fill -> dark text vanishes). ---- */
html[data-dashboard-theme] .nav-tabs .nav-link.active {
  color: var(--theme-dark) !important;
  background-color: transparent !important;
  border-bottom: 2px solid var(--theme-primary);
}
html[data-dashboard-theme] .nav-tabs .nav-link:hover {
  color: var(--theme-primary);
}

/* ---- SlickGrid: selected/active row & sorted header ---- */
html[data-dashboard-theme] .slick-row.active .slick-cell,
html[data-dashboard-theme] .slick-cell.selected,
html[data-dashboard-theme] .slick-row.odd .slick-cell.selected,
html[data-dashboard-theme] .slick-row.selected .slick-cell {
  background-color: rgba(var(--theme-primary-rgb), .10) !important;
}
html[data-dashboard-theme] .slick-header-column-sorted {
  color: var(--theme-dark);
}

/* header column hover / active — was light blue #c8e8f8 -> soft primary */
html[data-dashboard-theme] .slick-header-column:hover,
html[data-dashboard-theme] .slick-header-column-active,
html[data-dashboard-theme] .slick-header-column-active.ui-state-default {
  background: var(--theme-primary-soft) !important;
}
/* sorted column underline + sort arrow — was cyan #5bc0de -> primary */
html[data-dashboard-theme] .slick-header-column-sorted,
html[data-dashboard-theme] .slick-header-column-sorted.ui-state-default {
  border-bottom-color: var(--theme-primary) !important;
}
html[data-dashboard-theme] .slick-sort-indicator-asc {
  border-bottom-color: var(--theme-primary) !important;
}
html[data-dashboard-theme] .slick-sort-indicator-desc {
  border-top-color: var(--theme-primary) !important;
}

/* ---- Pagination: active page -> primary, links -> dark ---- */
html[data-dashboard-theme] .pagination .page-item.active .page-link {
  background-color: var(--theme-primary);
  border-color: var(--theme-primary);
  color: #fff;
}
html[data-dashboard-theme] .pagination .page-link {
  color: var(--theme-dark);
}

/* ---- Category titles (property grid section headers) -> dark ---- */
html[data-dashboard-theme] .s-PropertyGrid .category-title,
html[data-dashboard-theme] .flex-layout .category-title {
  color: var(--theme-dark);
}

/* ============================================================
   MODERN THEME — A-to-Z admin retheme (dialogs, panels, tabs,
   category links, quick-search/filter). Replaces the leftover
   Serenity blue accents (#1f7dce/#0090d9/#3c8dbc/#7380C4/slateblue
   /#0661FF) with the brand palette (--theme-dark + --theme-primary).
   ============================================================ */

/* ---- jQuery-UI DIALOG (Serenity edit dialogs) ---- */
html[data-dashboard-theme] .ui-dialog {
  border-radius: var(--theme-radius);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(var(--theme-dark-rgb), .35);
}
html[data-dashboard-theme] .ui-dialog .ui-dialog-titlebar {
  background-color: var(--theme-dark);
  color: #fff;
}
html[data-dashboard-theme] .ui-dialog .ui-button:hover {
  background-color: var(--theme-secondary);
}
/* keep the close (X) hover red — standard destructive affordance */
html[data-dashboard-theme] .ui-dialog .ui-dialog-titlebar-close:hover {
  background-color: #d6293e;
}
html[data-dashboard-theme] .ui-dialog .ui-dialog-buttonpane {
  border-top: 1px solid var(--bs-border-color, #e7e7e7);
  padding: 10px 14px !important;
}
/* message-dialog (Alert/Confirm) buttons are bare <button> with no class.
   Theme them: neutral dark-outline by default, primary (first) -> primary. */
html[data-dashboard-theme] .ui-dialog .ui-dialog-buttonpane button {
  height: 38px !important;
  min-width: 84px;
  padding: 0 18px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  cursor: pointer;
  background: #fff !important;
  color: var(--theme-dark) !important;
  border: 1px solid rgba(var(--theme-dark-rgb), .25) !important;
  box-shadow: none !important;
  margin-left: 8px;
}
html[data-dashboard-theme] .ui-dialog .ui-dialog-buttonpane button:hover {
  background: var(--theme-secondary-light) !important;
  border-color: var(--theme-secondary) !important;
}
html[data-dashboard-theme] .ui-dialog .ui-dialog-buttonset button:first-child {
  background: var(--theme-primary) !important;
  color: #fff !important;
  border-color: var(--theme-primary) !important;
}
html[data-dashboard-theme] .ui-dialog .ui-dialog-buttonset button:first-child:hover {
  background: var(--theme-primary-hover) !important;
  border-color: var(--theme-primary-hover) !important;
}

/* ---- s-Panel (grid/page panels) -> primary top accent, dark titlebar ---- */
html[data-dashboard-theme] .s-Panel {
  border-top: 3px solid var(--theme-primary);
  border-radius: var(--theme-radius);
}
html[data-dashboard-theme] .panel-titlebar {
  color: var(--theme-dark);
}
/* Page/grid banner (the dark title bar) -> brand-dark (--theme-dark) fill with a
   crisp primary-colour accent line under it that ties in the brand primary.
   Keeps the erie pattern overlay. */
html[data-dashboard-theme] .grid-title {
  background-color: var(--theme-dark) !important;
  border-bottom: 3px solid var(--theme-primary) !important;
}

/* ---- Property-grid category links bar (expand/collapse) -> dark ---- */
html[data-dashboard-theme] .s-PropertyGrid .category-links,
html[data-dashboard-theme] .flex-layout .category-links {
  background: var(--theme-dark) !important;
  border: 0;
}
html[data-dashboard-theme] .s-PropertyGrid .category-links a.category-link {
  color: #fff;
}
html[data-dashboard-theme] .s-PropertyGrid .category-links span.separator {
  color: rgba(255, 255, 255, .55);
}
html[data-dashboard-theme] .s-PropertyGrid .category-title {
  border-bottom-color: var(--theme-border);
}
html[data-dashboard-theme] .s-PropertyGrid .category-title a {
  color: var(--theme-primary-active);
}

/* ---- jQuery-UI TABS (property/dialog tabs): active tab -> primary underline ---- */
html[data-dashboard-theme] .ui-tabs .ui-tabs-nav li.ui-tabs-active a,
html[data-dashboard-theme] .ui-tabs .ui-tabs-nav li.ui-state-active a,
html[data-dashboard-theme] .property-tabs > li.active > a,
html[data-dashboard-theme] .property-tabs > li.active > a:hover,
html[data-dashboard-theme] .property-tabs > li.active > a:focus {
  color: var(--theme-dark) !important;
  background-color: transparent !important;
  border-bottom: 2px solid var(--theme-primary);
}
html[data-dashboard-theme] .ui-tabs .ui-tabs-nav li a:hover,
html[data-dashboard-theme] .property-tabs > li > a:hover {
  color: var(--theme-primary);
}

/* ---- Quick search bar: icon -> dark, input focus -> primary ---- */
html[data-dashboard-theme] .s-QuickSearchBar .quick-search-icon {
  background: var(--theme-dark);
  /* base CSS positions the magnifier with padding:8px + a fractional line-height,
     which leaves the FontAwesome glyph ~3px low and ~4px left of centre in the
     brand-dark square. Flex-centre it so it sits dead-centre at any control height. */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 1 !important;
}
html[data-dashboard-theme] .s-QuickSearchBar .quick-search-icon > i {
  line-height: 1 !important;
}
html[data-dashboard-theme] .s-QuickSearchBar .s-QuickSearchInput:focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 .15rem rgba(var(--theme-primary-rgb), .18);
}

/* ---- Quick filters bar: active filter label -> primary ---- */
html[data-dashboard-theme] .quick-filter-active .quick-filter-label {
  color: var(--theme-primary-active);
}

/* ---- jQuery-UI highlight state (info rows) -> soft brand ---- */
html[data-dashboard-theme] .ui-state-highlight,
html[data-dashboard-theme] .ui-widget-content .ui-state-highlight {
  border-color: var(--theme-primary);
  background: var(--theme-primary-soft);
  color: var(--theme-primary-active);
}

/* ---- LEFT SIDEBAR NAVIGATION: active/hover -> primary, header -> dark ---- */
html[data-dashboard-theme] .s-sidebar-link:hover,
html[data-dashboard-theme] .s-sidebar-pane .active > .s-sidebar-link,
html[data-dashboard-theme] .s-sidebar-link:hover .s-sidebar-icon,
html[data-dashboard-theme] .active > .s-sidebar-link > .s-sidebar-icon {
  color: var(--theme-primary);
}
/* subtle active row highlight + primary leading bar */
html[data-dashboard-theme] .s-sidebar-pane .active > .s-sidebar-link {
  background-color: rgba(var(--theme-primary-rgb), .08);
  box-shadow: inset 3px 0 0 var(--theme-primary);
}
html[data-dashboard-theme] .s-sidebar-header-title {
  color: var(--theme-dark);
}

/* ============================================================
   MODERN THEME — control SIZING normalisation
   The admin mixes font sizes (erie 15px vs bootstrap 16px) and
   select2 dropdowns render at a cramped 26px while text inputs are
   ~38px. This block unifies form-control font-size and makes form/
   dialog dropdowns match the text-input height for a clean, readable
   layout. (Grid quick-filter select2 stays compact by design.)
   ============================================================ */

/* --- unified font-size on all form controls (15px) --- */
html[data-dashboard-theme] .s-Form .form-control,
html[data-dashboard-theme] .s-Form .form-select,
html[data-dashboard-theme] .s-Form .editor,
html[data-dashboard-theme] .s-Form input.editor,
html[data-dashboard-theme] .s-Form select,
html[data-dashboard-theme] .s-Form textarea,
html[data-dashboard-theme] .ui-dialog .form-control,
html[data-dashboard-theme] .ui-dialog .form-select {
  font-size: 14px;
}

/* --- consistent input height in forms/dialogs (~38px) --- */
html[data-dashboard-theme] .s-Form input.editor,
html[data-dashboard-theme] .s-Form select.editor,
html[data-dashboard-theme] .s-Form .form-control,
html[data-dashboard-theme] .ui-dialog .form-control {
  min-height: 38px;
}

/* --- select2 single dropdown -> match the 38px text inputs --- */
html[data-dashboard-theme] .s-Form .select2-container .select2-choice,
html[data-dashboard-theme] .ui-dialog .select2-container .select2-choice {
  height: 38px;
  padding-left: 10px;
  border-radius: 8px;
}
html[data-dashboard-theme] .s-Form .select2-container .select2-choice > .select2-chosen,
html[data-dashboard-theme] .ui-dialog .select2-container .select2-choice > .select2-chosen {
  line-height: 38px;
  font-size: 14px;
}
html[data-dashboard-theme] .s-Form .select2-container .select2-choice .select2-arrow,
html[data-dashboard-theme] .ui-dialog .select2-container .select2-choice .select2-arrow {
  height: 100%;
}
/* multi-select boxes align too */
html[data-dashboard-theme] .s-Form .select2-container-multi .select2-choices,
html[data-dashboard-theme] .ui-dialog .select2-container-multi .select2-choices {
  min-height: 38px;
  border-radius: 8px;
}

/* --- select2 results popup (body-level): readable rows --- */
html[data-dashboard-theme] .select2-results .select2-result-label {
  font-size: 14px;
  padding: 7px 10px;
}
html[data-dashboard-theme] .select2-drop .select2-search input {
  min-height: 32px;
  font-size: 14px;
}

/* --- legacy Serenity mini dropdowns (were 11px Tahoma) -> readable --- */
html[data-dashboard-theme] a.s-LinkDropDown,
html[data-dashboard-theme] .s-ClickDown {
  font-family: inherit;
  font-size: 13px;
}

/* ============================================================
   MODERN THEME — INTER font, app-wide
   erie/serenity default to Heebo/Roboto/Verdana/Tahoma. Override the
   body font token + the components that hardcode their own family
   (jQuery-UI widgets, form controls, buttons).
   ============================================================ */
html[data-dashboard-theme] {
  --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --theme-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
html[data-dashboard-theme] body,
html[data-dashboard-theme] input,
html[data-dashboard-theme] select,
html[data-dashboard-theme] textarea,
html[data-dashboard-theme] button,
html[data-dashboard-theme] .s-Form,
html[data-dashboard-theme] .ui-widget,
html[data-dashboard-theme] .ui-dialog,
html[data-dashboard-theme] .ui-widget input,
html[data-dashboard-theme] .ui-widget select,
html[data-dashboard-theme] .ui-widget textarea,
html[data-dashboard-theme] .select2-container,
html[data-dashboard-theme] .select2-drop {
  font-family: var(--theme-font);
}
/* headings a touch tighter for the Inter look */
html[data-dashboard-theme] h1,
html[data-dashboard-theme] h2,
html[data-dashboard-theme] h3,
html[data-dashboard-theme] .h1,
html[data-dashboard-theme] .h2,
html[data-dashboard-theme] .h3 {
  font-family: var(--theme-font);
  letter-spacing: -0.01em;
}

/* ============================================================
   MODERN THEME — LookupEditor select2 alignment @ 38px
   (.s-LookupEditor .select2-allowclear .select2-container-active)
   Re-centre the clear "x", the caret arrow, and the search icon that
   were positioned for the old 26px control.
   ============================================================ */

/* clear "×": select2's sprite icon is tuned for a 26px control and renders
   off-centre at 38px. Drop the sprite and draw our own × glyph, flex-centred,
   so it lines up with the chosen text at ANY control height. */
html[data-dashboard-theme] .select2-container .select2-choice abbr,
html[data-dashboard-theme] .select2-container .select2-choice abbr.select2-search-choice-close {
  top: 50% !important;
  transform: translateY(-50%) !important;
  margin-top: 0 !important;
  width: 16px !important;
  height: 16px !important;
  background-image: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
html[data-dashboard-theme] .select2-container .select2-choice abbr::before {
  content: "\00d7"; /* × */
  font-size: 16px;
  line-height: 1;
  color: var(--theme-muted, #6B7280);
}
html[data-dashboard-theme] .select2-container .select2-choice abbr:hover::before {
  color: #d6293e;
}
/* caret arrow: same story — drop the sprite, draw a flex-centred CSS triangle */
html[data-dashboard-theme] .select2-container .select2-choice .select2-arrow {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  border-left: 0 !important;
}
html[data-dashboard-theme] .select2-container .select2-choice .select2-arrow b {
  display: none !important;
}
html[data-dashboard-theme] .select2-container .select2-choice .select2-arrow::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--theme-dark, #0D1B4C);
}
/* leave room on the chosen text so it never sits under the x + arrow */
html[data-dashboard-theme] .s-Form .select2-container.select2-allowclear .select2-choice > .select2-chosen,
html[data-dashboard-theme] .ui-dialog .select2-container.select2-allowclear .select2-choice > .select2-chosen {
  margin-right: 42px;
}
/* active/open control -> primary focus border */
html[data-dashboard-theme] .select2-container-active .select2-choice,
html[data-dashboard-theme] .select2-dropdown-open .select2-choice {
  border-color: var(--theme-primary) !important;
  box-shadow: 0 0 0 .15rem rgba(var(--theme-primary-rgb), .18) !important;
}
/* search box inside the dropdown: centre the magnifier icon, readable height */
html[data-dashboard-theme] .select2-drop .select2-search {
  padding: 6px 8px;
}
html[data-dashboard-theme] .select2-drop .select2-search input {
  min-height: 34px;
  border-radius: 8px;
  /* select2 v3 draws the search magnifier from a sprite sheet pinned at
     "background-position: 100% -22px" — a FIXED offset calibrated for its ~26px
     default input. Our taller 34px+ input leaves that sprite glyph sitting high,
     not vertically centred. Nudging the sprite offset would expose adjacent
     glyphs (arrow/clear), so instead we drop the sprite and draw our own crisp
     magnifier (matching how the theme replaces the caret + clear ×), positioned
     "right center" so it stays centred at any input height. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 15px 15px !important;
  padding-right: 30px !important;
}
/* selected option row in the popup -> keep centre-aligned & readable */
html[data-dashboard-theme] .select2-results .select2-result-label {
  display: flex;
  align-items: center;
  min-height: 32px;
}

/* ============================================================
   MODERN THEME — select2 FLAT CHROME (kills the old gray gradient
   + beveled arrow box on every dropdown, incl. grid quick-filters)
   and pins form/dialog controls to a clean 38px.
   ============================================================ */

/* flat white control everywhere */
html[data-dashboard-theme] .select2-container .select2-choice,
html[data-dashboard-theme] .select2-container-multi .select2-choices {
  background: #fff !important;
  border: 1px solid var(--theme-border) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  color: var(--theme-dark);
}
/* flat arrow area (drop the beveled box + its border/gradient) */
html[data-dashboard-theme] .select2-container .select2-choice .select2-arrow {
  background: transparent !important;
  border-left: 0 !important;
}
/* hover feedback */
html[data-dashboard-theme] .select2-container .select2-choice:hover {
  border-color: rgba(var(--theme-dark-rgb), .35) !important;
}

/* form/dialog controls: pin to 38px with border-box so they can't grow tall */
html[data-dashboard-theme] .s-Form .select2-container .select2-choice,
html[data-dashboard-theme] .ui-dialog .select2-container .select2-choice {
  height: 38px !important;
  box-sizing: border-box !important;
  padding: 0 0 0 10px !important;
  line-height: 36px !important;
}
html[data-dashboard-theme] .s-Form .select2-container .select2-choice > .select2-chosen,
html[data-dashboard-theme] .ui-dialog .select2-container .select2-choice > .select2-chosen {
  line-height: 36px !important;
}
/* keep grid quick-filter dropdowns compact but flat (32px) */
html[data-dashboard-theme] .quick-filters-bar .select2-container .select2-choice {
  height: 32px !important;
  box-sizing: border-box !important;
  line-height: 30px !important;
}
html[data-dashboard-theme] .quick-filters-bar .select2-container .select2-choice > .select2-chosen {
  line-height: 30px !important;
}
/* Grid quick-filter dropdowns — popup overhang fix (SCOPED to the 3 grids that
   need it). site.css gives a few grids a fixed 240px filter slot
   (".s-...Grid .quick-filter-item { width:240px }") AND hard-codes the visible
   select2 box to 220px (".s-...Grid ...select2-container .select2-choice"),
   while Serenity's base ".s-Toolbar .select2-container" pins the CONTAINER to
   min-width:250px. Three different widths. The 30px gap is invisible until the
   dropdown opens: select2 v3 sizes its options popup to the CONTAINER's outer
   width (250px), so the popup overhangs the 220px box on the right. Fix: on
   these grids, let the container + box fill the fixed 240px slot so the opened
   options line up with the box.

   IMPORTANT: this is scoped to the specific grids that set a fixed-width filter
   slot. Do NOT broaden to ".quick-filters-bar" globally — most grids (e.g.
   Franchisees) have content-sized filter items with NO fixed width, and rely on
   the container's min-width:250px for their size; width:100%/min-width:0 there
   makes the inline-block item collapse to its label text. If a new grid adopts
   the site.css "240px item + 220px choice" pattern, add its class below. */
html[data-dashboard-theme] .s-ResourcesGrid .quick-filters-bar .select2-container,
html[data-dashboard-theme] .s-UsersGrid .quick-filters-bar .select2-container,
html[data-dashboard-theme] .s-InstructorsGrid .quick-filters-bar .select2-container {
  min-width: 0 !important;
  width: 100% !important;
}
html[data-dashboard-theme] .s-ResourcesGrid .quick-filters-bar .select2-container .select2-choice,
html[data-dashboard-theme] .s-UsersGrid .quick-filters-bar .select2-container .select2-choice,
html[data-dashboard-theme] .s-InstructorsGrid .quick-filters-bar .select2-container .select2-choice {
  width: 100% !important;
}
/* quick-filter date/text inputs -> match the 32px dropdowns (were 37px) */
html[data-dashboard-theme] .quick-filters-bar input.hasDatepicker,
html[data-dashboard-theme] .quick-filters-bar input.s-DateEditor,
html[data-dashboard-theme] .quick-filters-bar input.editor,
html[data-dashboard-theme] .quick-filters-bar .ui-datepicker-trigger {
  height: 32px !important;
  box-sizing: border-box !important;
}

/* when the dropdown is OPEN, the control's arrow (▾▴) + clear-x overlap the
   search box and read as duplicate controls — hide them while open. */
html[data-dashboard-theme] .select2-dropdown-open .select2-choice .select2-arrow,
html[data-dashboard-theme] .select2-dropdown-open .select2-choice abbr {
  display: none !important;
}

/* remove the open dropdown popup's rounded corners (was 0 0 4px 4px) -> square */
html[data-dashboard-theme] .select2-drop {
  border-radius: 0 !important;
  /* select2 v3 sets the popup width (inline) = control's OUTER width, but the
     popup is content-box, so its own 1px borders push it ~2px past the control's
     right edge -> the "options don't fit the dropdown" overhang. border-box keeps
     the borders inside the measured width so the popup lines up with the box. */
  box-sizing: border-box !important;
}
/* the inner search box + its input must also stay inside the popup width */
html[data-dashboard-theme] .select2-drop .select2-search,
html[data-dashboard-theme] .select2-drop .select2-search input {
  box-sizing: border-box !important;
  max-width: 100% !important;
}

/* bulletproof vertical centring of the selected value: flex the control so the
   chosen text stays centred at any height and after a fresh selection re-render
   (line-height alone can drift when select2 rebuilds the chosen span). */
html[data-dashboard-theme] .select2-container .select2-choice {
  display: flex !important;
  align-items: center !important;
}
html[data-dashboard-theme] .select2-container .select2-choice > .select2-chosen {
  min-width: 0; /* allow text-overflow ellipsis inside the flex item */
}

/* clear "×" must only appear when a value is selected. select2 adds
   .select2-allowclear only when there's something to clear; on the empty
   "--select--" placeholder it's absent, so hide the × then. */
html[data-dashboard-theme] .select2-container:not(.select2-allowclear) .select2-choice abbr {
  display: none !important;
}

/* ---- Checkboxes & radios: checked fill -> brand primary (was browser-default
   blue, which clashed with the brand theme — visible on grid row-select,
   the header select-all, and boolean columns like "Approve"). accent-color
   tints the native control's checked state + the check/dot glyph.
   IMPORTANT: Serenity's BooleanEditor is <input type=checkbox class="editor …">,
   so the broad text-input rules (40px min-height, unified border, focus ring)
   would otherwise stretch it to a 24x40 text-input box and draw a border + big
   focus ring — deforming and misaligning the checkbox. Reset the box back to a
   real 16px control and neutralise those inherited input styles. ---- */
/* (a) COLOUR — all checkboxes/radios app-wide (grid row-select, boolean columns,
   form editors) get the brand primary checked fill. Colour only; size untouched. */
html[data-dashboard-theme] input[type=checkbox],
html[data-dashboard-theme] input[type=radio] {
  accent-color: var(--theme-primary);
}
/* (b) SIZE + RESET — ONLY the Serenity BooleanEditor checkbox in forms/dialogs
   (<input type=checkbox class="editor s-BooleanEditor">). The broad text-input
   rules (.s-Form/.ui-dialog input.editor, spec 0,3,2) stretch it to a 24x40 box
   and add a border + focus ring; these (0,4,2) selectors win and restore a clean
   18px control. GRID checkboxes are plain <input> without .editor, so they are
   NOT matched here and keep their native size. */
html[data-dashboard-theme] .s-Form input.editor[type=checkbox],
html[data-dashboard-theme] .ui-dialog input.editor[type=checkbox],
html[data-dashboard-theme] .s-Form input.editor[type=radio],
html[data-dashboard-theme] .ui-dialog input.editor[type=radio],
html[data-dashboard-theme] input.s-BooleanEditor.editor {
  width: 18px !important;
  height: 18px !important;
  min-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  vertical-align: middle !important;
  appearance: auto !important;
  flex: 0 0 auto;
}
/* (c) ALIGNMENT — centre the BooleanEditor's caption + checkbox on one line. The
   Serenity .field is a flexbox with align-items:flex-start and the checkbox had a
   ~6px top-margin hack; centre the row instead. Scoped via :has() to boolean
   fields only — text/select field rows untouched. */
html[data-dashboard-theme] .field:has(> input.editor[type=checkbox]),
html[data-dashboard-theme] .field:has(> input.s-BooleanEditor) {
  align-items: center !important;
}
/* (d) FOCUS — subtle brand outline on the boolean editor instead of the text-input
   border+ring the .editor:focus rule would draw (the "extra border" on hover/focus). */
html[data-dashboard-theme] .s-Form input.editor[type=checkbox]:focus,
html[data-dashboard-theme] .ui-dialog input.editor[type=checkbox]:focus,
html[data-dashboard-theme] input.s-BooleanEditor.editor:focus,
html[data-dashboard-theme] .s-Form input.editor[type=checkbox]:focus-visible,
html[data-dashboard-theme] .ui-dialog input.editor[type=checkbox]:focus-visible {
  border: 0 !important;
  box-shadow: none !important;
  outline: 2px solid rgba(var(--theme-primary-rgb), .45) !important;
  outline-offset: 1px !important;
}

/* ============================================================
   MODERN THEME — UNIFIED INPUT SHAPE (A-to-Z)
   Every text/number/date/select/textarea/lookup control shares ONE
   border + radius so forms read as a single system.
   (Was inconsistent: string/date 4px+gray, calendar btn 0px, select2
   8px+dark — three different shapes.)
   ============================================================ */
html[data-dashboard-theme] input.editor,
html[data-dashboard-theme] textarea.editor,
html[data-dashboard-theme] select.editor,
html[data-dashboard-theme] .s-Form .form-control,
html[data-dashboard-theme] .ui-dialog .form-control,
html[data-dashboard-theme] .s-Form select,
html[data-dashboard-theme] .ui-dialog select,
/* Serenity editors that DON'T carry the .editor class (e.g. quick-filter
   date/number editors) — match them by their editor class directly */
html[data-dashboard-theme] input.s-DateEditor,
html[data-dashboard-theme] input.s-DateTimeEditor,
html[data-dashboard-theme] input.hasDatepicker,
html[data-dashboard-theme] input.s-DecimalEditor,
html[data-dashboard-theme] input.s-IntegerEditor,
html[data-dashboard-theme] .select2-container .select2-choice,
html[data-dashboard-theme] .select2-container-multi .select2-choices,
html[data-dashboard-theme] .ui-datepicker-trigger {
  border: 1px solid var(--theme-border) !important;
  border-radius: 8px !important;
}

/* one focus treatment for all controls */
html[data-dashboard-theme] input.editor:focus,
html[data-dashboard-theme] textarea.editor:focus,
html[data-dashboard-theme] select.editor:focus,
html[data-dashboard-theme] input.s-DateEditor:focus,
html[data-dashboard-theme] input.s-DateTimeEditor:focus,
html[data-dashboard-theme] input.hasDatepicker:focus,
html[data-dashboard-theme] input.s-DecimalEditor:focus,
html[data-dashboard-theme] input.s-IntegerEditor:focus,
html[data-dashboard-theme] .s-Form .form-control:focus,
html[data-dashboard-theme] .ui-dialog .form-control:focus {
  border-color: var(--theme-primary) !important;
  box-shadow: 0 0 0 .2rem rgba(var(--theme-primary-rgb), .18) !important;
  outline: none !important;
}

/* date/time calendar trigger -> clean icon button matching the inputs */
html[data-dashboard-theme] .ui-datepicker-trigger {
  height: 38px !important;
  width: 38px;
  background: #fff !important;
  color: var(--theme-dark) !important;
  margin-left: 4px !important;
  box-sizing: border-box !important;
}
html[data-dashboard-theme] .ui-datepicker-trigger:hover {
  background: var(--theme-primary-soft) !important;
  border-color: var(--theme-primary) !important;
  color: var(--theme-primary-active) !important;
}
html[data-dashboard-theme] .quick-filters-bar .ui-datepicker-trigger {
  height: 32px !important;
  width: 32px;
}

/* ============================================================
   MODERN THEME — PRIMARY ACTION buttons, app-wide
   Bootstrap .btn-primary already uses the brand primary (earlier). Here the
   Serenity dialog "Save (& close)" toolbar button — the primary
   action — is filled with the primary colour so primary intent is consistent
   everywhere. Other toolbar buttons stay flat/neutral.
   ============================================================ */
html[data-dashboard-theme] div.s-Toolbar .tool-button.save-and-close-button {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: #fff;
}
html[data-dashboard-theme] div.s-Toolbar .tool-button.save-and-close-button .button-outer {
  border-color: transparent;
}
html[data-dashboard-theme] div.s-Toolbar .tool-button.save-and-close-button:hover,
html[data-dashboard-theme] div.s-Toolbar .tool-button.save-and-close-button:hover .button-outer {
  background: var(--theme-primary-hover);
  border-color: var(--theme-primary-hover);
  color: #fff;
}

/* Bulk-delete toolbar button (btn-danger) — was oversized (pad 9x18, 16.9px
   font) next to the 38px flat tool-buttons. Size it to match. Stays red
   (destructive). No `display` here so the JS show/hide toggle keeps working. */
html[data-dashboard-theme] .bulk-delete-btn {
  height: 38px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  line-height: 36px !important;
  border-radius: 8px !important;
  margin: 0 0 5px 4px !important;
  vertical-align: middle !important;
}
html[data-dashboard-theme] .bulk-delete-btn i {
  line-height: inherit;
}

/* ============================================================
   MODERN THEME — DESIGN-SYSTEM CONFORMANCE PASS
   Fills the remaining spec gaps: semantic buttons/tokens, toastr,
   validation, alerts, and the exact spec numbers (40px inputs,
   16px modals, heading scale, 14px body, #E5E7EB borders, 48px rows).
   ============================================================ */

/* ---- SEMANTIC BUTTONS (Success / Warning / Danger) — the erie theme
   hardcodes .btn-* colours (doesn't read --bs-success etc.), so re-tokenise
   each --bs-btn-* explicitly, like the primary/secondary buttons above. ---- */
html[data-dashboard-theme] .btn-success {
  --bs-btn-color: #fff;            --bs-btn-bg: var(--theme-success);
  --bs-btn-border-color: var(--theme-success);
  --bs-btn-hover-color: #fff;      --bs-btn-hover-bg: #16A34A;  --bs-btn-hover-border-color: #16A34A;
  --bs-btn-active-color: #fff;     --bs-btn-active-bg: #15803D; --bs-btn-active-border-color: #15803D;
  --bs-btn-disabled-color: #fff;   --bs-btn-disabled-bg: var(--theme-success); --bs-btn-disabled-border-color: var(--theme-success);
  --bs-btn-focus-shadow-rgb: var(--bs-success-rgb);
}
html[data-dashboard-theme] .btn-warning {
  --bs-btn-color: #1F2937;         --bs-btn-bg: var(--theme-warning);
  --bs-btn-border-color: var(--theme-warning);
  --bs-btn-hover-color: #1F2937;   --bs-btn-hover-bg: #D97706;  --bs-btn-hover-border-color: #D97706;
  --bs-btn-active-color: #1F2937;  --bs-btn-active-bg: #B45309; --bs-btn-active-border-color: #B45309;
  --bs-btn-disabled-color: #1F2937;--bs-btn-disabled-bg: var(--theme-warning); --bs-btn-disabled-border-color: var(--theme-warning);
  --bs-btn-focus-shadow-rgb: var(--bs-warning-rgb);
}
html[data-dashboard-theme] .btn-danger {
  --bs-btn-color: #fff;            --bs-btn-bg: var(--theme-danger);
  --bs-btn-border-color: var(--theme-danger);
  --bs-btn-hover-color: #fff;      --bs-btn-hover-bg: #DC2626;  --bs-btn-hover-border-color: #DC2626;
  --bs-btn-active-color: #fff;     --bs-btn-active-bg: #B91C1C; --bs-btn-active-border-color: #B91C1C;
  --bs-btn-disabled-color: #fff;   --bs-btn-disabled-bg: var(--theme-danger); --bs-btn-disabled-border-color: var(--theme-danger);
  --bs-btn-focus-shadow-rgb: var(--bs-danger-rgb);
}

/* ---- TOASTR notifications (Serenity success/error/warning/info) -> semantic
   colours, rounded, soft shadow. (Was toastr's default green/red/amber.) ---- */
html[data-dashboard-theme] #toast-container > div {
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(var(--theme-dark-rgb), .18) !important;
  opacity: 1 !important;
}
html[data-dashboard-theme] #toast-container > .toast-success { background-color: var(--theme-success) !important; }
html[data-dashboard-theme] #toast-container > .toast-error   { background-color: var(--theme-danger)  !important; }
html[data-dashboard-theme] #toast-container > .toast-warning { background-color: var(--theme-warning) !important; }
html[data-dashboard-theme] #toast-container > .toast-info    { background-color: var(--theme-dark)    !important; }

/* ---- FORM VALIDATION / ERROR states -> danger red border + soft ring, red msgs.
   Covers Serenity (.error), MVC unobtrusive (.input-validation-error) and ARIA. ---- */
html[data-dashboard-theme] input.error,
html[data-dashboard-theme] textarea.error,
html[data-dashboard-theme] select.error,
html[data-dashboard-theme] .form-control.error,
html[data-dashboard-theme] .input-validation-error,
html[data-dashboard-theme] input.input-validation-error,
html[data-dashboard-theme] [aria-invalid="true"],
html[data-dashboard-theme] .has-error .form-control {
  border-color: var(--theme-danger) !important;
  box-shadow: 0 0 0 .2rem rgba(var(--bs-danger-rgb), .18) !important;
}
html[data-dashboard-theme] .select2-container.error .select2-choice,
html[data-dashboard-theme] .error .select2-choice {
  border-color: var(--theme-danger) !important;
}
html[data-dashboard-theme] .field-validation-error,
html[data-dashboard-theme] .validation-summary-errors,
html[data-dashboard-theme] label.error,
html[data-dashboard-theme] .k-invalid-msg,
html[data-dashboard-theme] .s-Form .error-message {
  color: var(--theme-danger) !important;
}

/* ---- ALERTS: soft brand-tinted variants (explicit so they don't depend on
   Bootstrap's subtle-token chain). ---- */
html[data-dashboard-theme] .alert-success { background:#E9F9EF; border-color:#A6E9C1; color:#15803D; }
html[data-dashboard-theme] .alert-danger  { background:#FDECEC; border-color:#F7B7B7; color:#B42318; }
html[data-dashboard-theme] .alert-warning { background:#FEF3E2; border-color:#FBD9A5; color:#B45309; }
html[data-dashboard-theme] .alert-info,
html[data-dashboard-theme] .alert-primary { background:var(--theme-primary-soft); border-color:#FFD8A8; color:var(--theme-primary-active); }

/* ---- GRID loading overlay + empty state (best-effort selectors) ---- */
html[data-dashboard-theme] .blockUI.blockMsg,
html[data-dashboard-theme] .s-Loading {
  border-radius: 10px !important;
}
html[data-dashboard-theme] .slick-empty-warning,
html[data-dashboard-theme] .s-NoData {
  color: var(--theme-muted);
}

/* ---- FILE UPLOAD control -> brand button chrome (best-effort) ---- */
html[data-dashboard-theme] .s-FileUploadEditor .upload-button,
html[data-dashboard-theme] .s-FileUploadEditor .tool-button {
  border-color: var(--theme-primary) !important;
  color: var(--theme-primary-active) !important;
}

/* ---- SPEC: INPUT HEIGHT 40px (form/dialog controls; buttons stay 38px) ---- */
html[data-dashboard-theme] .s-Form input.editor,
html[data-dashboard-theme] .s-Form select.editor,
html[data-dashboard-theme] .s-Form .form-control,
html[data-dashboard-theme] .s-Form textarea.editor,
html[data-dashboard-theme] .ui-dialog .form-control {
  min-height: var(--theme-input-h) !important;
}
html[data-dashboard-theme] .s-Form .select2-container .select2-choice,
html[data-dashboard-theme] .ui-dialog .select2-container .select2-choice {
  height: var(--theme-input-h) !important;
  line-height: 38px !important;
}
html[data-dashboard-theme] .s-Form .select2-container .select2-choice > .select2-chosen,
html[data-dashboard-theme] .ui-dialog .select2-container .select2-choice > .select2-chosen {
  line-height: 38px !important;
}
html[data-dashboard-theme] .s-Form .select2-container-multi .select2-choices,
html[data-dashboard-theme] .ui-dialog .select2-container-multi .select2-choices {
  min-height: var(--theme-input-h) !important;
}
html[data-dashboard-theme] .ui-datepicker-trigger {
  height: var(--theme-input-h) !important;
  width: var(--theme-input-h) !important;
}

/* ---- SPEC: MODAL radius 16px (Serenity edit dialogs) ---- */
html[data-dashboard-theme] .ui-dialog {
  border-radius: var(--theme-modal-radius) !important;
}

/* ---- SPEC: TYPOGRAPHY — Inter scale + 14px body + text-primary colour ---- */
html[data-dashboard-theme] body {
  font-size: 14px;
  color: var(--theme-text);
}
html[data-dashboard-theme] h1, html[data-dashboard-theme] .h1 { font-size: 32px; }
html[data-dashboard-theme] h2, html[data-dashboard-theme] .h2 { font-size: 28px; }
html[data-dashboard-theme] h3, html[data-dashboard-theme] .h3 { font-size: 24px; }
html[data-dashboard-theme] small, html[data-dashboard-theme] .small { font-size: 12px; }

/* ---- SPEC: TABLE typography — header 14px/600, row 13px/400 ---- */
html[data-dashboard-theme] .table > thead th,
html[data-dashboard-theme] .slick-header-column {
  font-size: 14px;
  font-weight: 600;
}
html[data-dashboard-theme] .table > tbody td,
html[data-dashboard-theme] .slick-cell {
  font-size: 13px;
  font-weight: 400;
}
/* ---- SPEC: TABLE ROW 48px — rowHeight is set in JS (GridBase.getSlickOptions);
   cells are nowrap single-line, so line-height vertically centres content in the
   taller row while preserving each column's text-align. ---- */
html[data-dashboard-theme] .slick-cell {
  line-height: 44px;
}

/* ---- SPEC: header height 70px ---- */
html[data-dashboard-theme] .navbar {
  min-height: 70px;
}

/* ---- PLACEHOLDER / empty-filter hint text -> spec Text-Secondary #6B7280
   (was a lighter #999 ~2.85:1; #6B7280 is 4.8:1, passes AA and matches the
   design-system muted colour). Entered values stay the dark brand text they already
   use. .select2-default .select2-chosen is select2 v3's placeholder state. ---- */
html[data-dashboard-theme] ::placeholder {
  color: var(--theme-muted) !important;
  opacity: 1 !important;
}
html[data-dashboard-theme] .select2-default > .select2-chosen,
html[data-dashboard-theme] .select2-container .select2-default {
  color: var(--theme-muted) !important;
}

/* ---- Auth pages (Forgot/Reset): the account panel JS injects a default Serenity
   logo (<h2><img serenity-logo>Fms</h2>) at the top of the panel. We now render the
   brand logo above the panel in the page markup, so hide the default one
   to avoid a duplicate. Scoped to just these two pages. ---- */
html[data-dashboard-theme] body#s-ForgotPasswordPage #ForgotPasswordPanel > h2:has(> img[src*="serenity-logo"]),
html[data-dashboard-theme] body#s-ResetPasswordPage #ResetPasswordPanel > h2:has(> img[src*="serenity-logo"]) {
  display: none !important;
}
/* brand logo header spacing (the .s-login-header style is page-scoped on Login;
   define it here so Forgot/Reset render it identically) */
html[data-dashboard-theme] .s-login-header img {
  vertical-align: middle;
  margin: 0 auto;
}
