/* ---------------------------------------------------------------------------
 * BMS colour scheme (Brad, 2026-08-05) - the palette from the approved
 * "bms-reskin-clients" mockup applied as a token layer over tabler-theme.css.
 * COLOURS ONLY: no layout, spacing or radius changes. Loaded after
 * bms-overrides.css so it wins the cascade; System Settings' Primary/
 * Secondary colour pickers still override via --bms-primary-color /
 * --bms-secondary-color exactly as before.
 * ------------------------------------------------------------------------ */

/* ============ light ============ */
:root, [data-bs-theme=light] {
    /* brand / primary */
    --tblr-primary: #2e5cff;
    --tblr-primary-rgb: 46, 92, 255;
    --tblr-primary-lt: #e9eeff;
    --tblr-primary-darken: #204ae0;
    --tblr-blue: #2e5cff;
    --tblr-blue-lt: #e9eeff;
    /* Links (Brad, 2026-08-05): steel blue from the NEWUIv2 design spec instead of
       the bright primary - calmer against the navy ink. Buttons keep the primary. */
    --tblr-link-color: #267da8;
    --tblr-link-hover-color: #1d658a;

    /* canvas + surfaces */
    --tblr-body-bg: #f2f4f8;      /* scheduler/modern canvas */
    --tblr-bg-surface: #ffffff;
    --tblr-bg-surface-secondary: #f2f4f7;
    --tblr-bg-surface-tertiary: #e9edf2;
    --tblr-active-bg: #eef1f6;

    /* borders + text */
    --tblr-border-color: #e3e7ef;  /* scheduler/modern border */
    --tblr-border-color-translucent: rgba(26, 35, 50, .08);
    --tblr-body-color: #1c2536;    /* scheduler ink (--bms-text) */
    --tblr-secondary-color: #68707e; /* scheduler/modern muted */
    --tblr-muted: #9aa4b2;

    /* semantics */
    --tblr-success: #189a51;  --tblr-green: #189a51;
    --tblr-success-lt: #e2f5ea; --tblr-green-lt: #e2f5ea;
    --tblr-danger: #d6414b;   --tblr-red: #d6414b;
    --tblr-danger-lt: #fbe7e8; --tblr-red-lt: #fbe7e8;
    --tblr-warning: #d99a2b;  --tblr-yellow: #d99a2b;
    --tblr-warning-lt: #faf1dd; --tblr-yellow-lt: #faf1dd;
}

/* ============ dark ============ */
[data-bs-theme=dark] {
    --tblr-primary: #6b93ff;
    --tblr-primary-rgb: 107, 147, 255;
    --tblr-primary-lt: #1b2a4d;
    --tblr-primary-darken: #85a6ff;
    --tblr-blue: #6b93ff;
    --tblr-blue-lt: #1b2a4d;
    --tblr-link-color: #5fb2d9;   /* steel blue, lightened for dark surfaces */
    --tblr-link-hover-color: #7cc3e4;

    --tblr-body-bg: #0e131b;
    --tblr-bg-surface: #151c27;
    --tblr-bg-surface-secondary: #1b2331;
    --tblr-bg-surface-tertiary: #212b3b;
    --tblr-active-bg: #1b2331;

    --tblr-border-color: #253044;
    --tblr-border-color-translucent: rgba(231, 236, 243, .08);
    --tblr-body-color: #e7ecf3;
    --tblr-secondary-color: #9daaba;
    --tblr-muted: #647183;

    /* Follow-up (2026-08-05) - Brad: "in dark mode the background of the Filters [drawer]
       is white." --tblr-light (the token .bg-light reads, e.g. the Clients/Staff/Jobs/etc
       filter drawers' card-body) was never remapped for dark mode, so it stayed pinned at
       its light-theme value (#f9fafb) everywhere .bg-light is used, sitewide. Re-pointed at
       a dark surface a shade lighter than the card body, matching how --tblr-light already
       reads relative to white in light mode. */
    --tblr-light: #1b2331;
    --tblr-light-rgb: 27, 35, 49;

    --tblr-success: #37c778;  --tblr-green: #37c778;
    --tblr-success-lt: #14331f; --tblr-green-lt: #14331f;
    --tblr-danger: #f0707a;   --tblr-red: #f0707a;
    --tblr-danger-lt: #3a1c1f; --tblr-red-lt: #3a1c1f;
    --tblr-warning: #e3ae53;  --tblr-yellow: #e3ae53;
    --tblr-warning-lt: #322810; --tblr-yellow-lt: #322810;
}

/* ============ sidebar (Brad, 2026-08-05: NEWUIv2/v3 colours copied over) ============
   From NEWUIv2's bms-modern.scss/site-colors.scss, stable tenant, per its D1
   colour decision (2026-07-25): navigation shell near-black #17151A (a
   DEDICATED nav colour - deliberately no longer derived from the System
   Settings primary), active item the solid slate #323F54 ("a selected
   control, not a CTA" - so not the primary blue), and the subtle 1px light
   edge. Link text/hover colours already match NEWUIv2 in bms-sidebar.css
   (rgba(255,255,255,.78) / hover on rgba(255,255,255,.07)). The sidebar is
   always dark, so light and dark theme share the same values. */
.bms-sidebar {
    background: #17151a;
    box-shadow: 1px 0 0 rgba(255, 255, 255, .06);
}
[data-bs-theme=dark] .bms-sidebar {
    background: #17151a;
}
.bms-nav-link.active {
    color: #fff;
    background: #323f54;
}

/* ============ section headers (Brad, 2026-08-05) ============
   "Remove the colour lines on the top of all the sections in the entire
   solution" - the 3px accent top border on every bms-card-header-soft
   card goes site-wide (it was already off on the Client/Staff records).
   The bms-accent-* classes still tint the header icon chips; only the
   line is gone. border-top: none (not transparent) so the 3px of
   reserved space disappears too. */
.bms-card-header-soft {
    border-top: none;
}

/* ============ scheduler typography site-wide (Brad, 2026-08-05) ============
   "Look at the styling on /schedulers - fonts, font size, colours etc - and
   apply that system wide." The scheduler runs the NEWUIv2 modern token set:
   its whole page is 13px working text (#scheduler-page { font-size: 13px }),
   with an 18px/600 title and 10px card radius. The font family was already
   identical site-wide, and the palette deltas are folded into the light
   block above - what follows are the size/shape tokens, which apply in both
   light and dark. Sizing lives on the Tabler body token so tables, forms,
   buttons and dropdowns all inherit the denser scale together. */
:root {
    --tblr-body-font-size: 13px;   /* was 0.875rem/14px */
    /* shared metric tokens the scheduler declares page-locally in
       bms-scheduler.css - same values, now available everywhere */
    --bms-text: #1c2536;
    --bms-font-size-base: 14px;
    --bms-font-size-sm: 13px;
    --bms-radius-card: 10px;
    --bms-control-height: 40px;
    --bms-control-height-touch: 44px;
}

.page-title {
    font-size: 18px;   /* scheduler header title scale */
    font-weight: 600;
}

.card {
    /* 10px scheduler card shape. Set via the token the card's own radius
       AND its header/footer inner radii derive from, so corners stay flush. */
    --tblr-border-radius-lg: var(--bms-radius-card);
}

/* ============ square heading icons removed (Brad, 2026-08-05) ============
   "Remove all square icons from headings throughout the system" - the
   bms-card-header-icon chips in page titles and card/grid headers go
   site-wide. The page-scoped rules already on the Client/Staff records
   become redundant but harmless. The bms-accent-* wrapper spans stay in
   the markup (some tint text/borders elsewhere); only the chip is hidden. */
.bms-card-header-icon {
    display: none;
}

/* ============ links: steel blue everywhere (Brad, 2026-08-05, fixed 2026-08-05) ============
   "Make all links in the system steel blue" - the token change above covers
   everything that reads --tblr-link-color, and this rule catches anchors
   styled some other way. Excluded on purpose: the side menu (Brad: don't
   change it), buttons, tabs/nav pills, dropdown items, pagination and
   badges - those are controls, not text links.
   Bug found 2026-08-05: pagination WAS meant to be excluded (see above) but
   never actually was - the DataTables bootstrap_alt pagination <a> tags
   carry no class at all (not .page-link, nothing), so :not(.page-link) never
   matched them, and this rule's 7-class specificity beat the dedicated
   ".dataTables_paginate a" rule below regardless of source order - pagination
   text stayed link-blue even after that rule was changed to follow the
   "records per page" ink colour. Fixed with a proper :not(.dataTables_paginate
   a) complex-selector exclusion (well-supported, not just a legacy simple
   selector) so this rule no longer matches inside the pagination control at
   all, letting the dedicated rule win. */
a:not(.btn):not(.bms-nav-link):not(.nav-link):not(.dropdown-item):not(.page-link):not(.badge):not(.list-group-item):not(.dataTables_paginate a) {
    color: var(--tblr-link-color);
}
a:not(.btn):not(.bms-nav-link):not(.nav-link):not(.dropdown-item):not(.page-link):not(.badge):not(.list-group-item):not(.dataTables_paginate a):hover {
    color: var(--tblr-link-hover-color);
}

/* ============ grid pagination (Brad, 2026-08-05, revised x2) ============
   Started matched to the link colour, then reset to body ink at rest with a
   steel-blue fill on hover/current/active. Brad then asked for pagination
   text to simply follow the "records per page" label's colour, in every
   state - so the fill is now the neutral --tblr-active-bg token (the same
   "selected control" tint used for active dropdown items, nav pills and
   list-group rows) rather than a colour, and no rule anywhere overrides
   text colour off --tblr-body-color. Selectors mirror tabler-theme.css's
   adapter rules so this wins on source order without needing higher
   specificity. */
.card .dataTables_wrapper .dataTables_paginate a,
.card .dataTables_paginate a {
    color: var(--tblr-body-color);
}
.card .dataTables_wrapper .dataTables_paginate a.current,
.card .dataTables_wrapper .dataTables_paginate a:hover,
.card .dataTables_wrapper .dataTables_paginate li.active a,
.card .dataTables_paginate a.current,
.card .dataTables_paginate a:hover,
.card .dataTables_paginate li.active a {
    background: var(--tblr-active-bg);
    border-color: var(--tblr-active-bg);
    /* tabler-theme.css's own adapter rule for this exact selector sets
       color: #fff (it originally paired white text with a --tblr-primary
       fill) - explicitly restating body-color here, not just dropping the
       background colour, is what actually overrides it. */
    color: var(--tblr-body-color);
}
.card .dataTables_wrapper .dataTables_paginate li.disabled a,
.card .dataTables_wrapper .dataTables_paginate a.disabled,
.card .dataTables_wrapper .dataTables_paginate a.disabled:hover,
.card .dataTables_paginate li.disabled a,
.card .dataTables_paginate a.disabled,
.card .dataTables_paginate a.disabled:hover {
    color: var(--tblr-body-color);
}

/* ============ grid header row + footer controls: body ink (Brad, 2026-08-05) ============
   Piloted on the Clients screen ("make all the text ... the colour #1c2536 -
   and in dark mode ... the same as the Show Inactive text"), now rolled out
   everywhere. Column headers default to the muted --tblr-secondary grey
   (tabler-theme.css), and the "Show N" length control / "Showing x of y" info
   text default to the same grey via the .card .dataTables_* adapter rules -
   both read as noticeably lighter than the rest of the page's body text.
   Re-pointed at --tblr-body-color, the app's default ink token, so grid
   chrome matches ordinary text (and "Show Inactive") in both themes. */
table.dataTable thead th,
.table thead th {
    color: var(--tblr-body-color);
}
.card .dataTables_wrapper .dataTables_length,
.card .dataTables_length,
.card .dataTables_wrapper .dataTables_length select,
.card .dataTables_length select,
.card .dataTables_wrapper .dataTables_info,
.card .dataTables_info {
    color: var(--tblr-body-color);
}

/* ============ form placeholder text: body ink (Brad, 2026-08-05) ============
   Piloted on the Clients search box ("the search field should also have the
   text colour"), now rolled out to every form-control. The typed value
   already used --tblr-body-color by default; only the placeholder was styled
   separately, at the lighter --tblr-tertiary grey, so empty fields read a
   different colour to filled ones. Matches placeholder text to body ink in
   both themes. */
.form-control::placeholder {
    color: var(--tblr-body-color);
    opacity: 1;
}

/* ============ outline-primary buttons: match link colour (Brad, 2026-08-05) ============
   Piloted on the Clients "Filters" button ("the Filters button colour should
   match the link colour"), now rolled out to every .btn-outline-primary
   site-wide (Filters buttons on every list screen, plus the handful of other
   outline-primary buttons). Re-points the button's own --tblr-btn-* custom
   properties at --tblr-link-color instead of --tblr-primary, so the
   outline/text is steel blue at rest and the filled hover/active state is
   steel blue too (white foreground text stays as-is), in both themes. */
.btn-outline-primary,
.btn-outline.btn-primary {
    --tblr-btn-color: var(--tblr-link-color);
    --tblr-btn-border-color: var(--tblr-link-color);
    --tblr-btn-hover-bg: var(--tblr-link-color);
    --tblr-btn-hover-border-color: var(--tblr-link-color);
    --tblr-btn-active-bg: var(--tblr-link-color);
    --tblr-btn-active-border-color: var(--tblr-link-color);
}

/* ============ edit icon: match link colour (Brad, 2026-08-05) ============
   "The colour of the edit icon ... should match the link text." Every grid's
   row-level Edit action (Client sub-grids, Staff sub-grids, and every
   Index/lookup screen with an edit column - 39 views in all) renders
   <i class="bi bi-pencil-square ... text-primary">. Bootstrap's .text-primary
   utility sets color: var(--tblr-primary) !important, so the icon was always
   Tabler blue instead of the steel-blue link colour. Beating a utility class
   needs !important too; a two-class selector (icon + utility class) gives it
   enough specificity to win outright rather than relying on source order. */
.bi-pencil-square.text-primary {
    color: var(--tblr-link-color) !important;
}
