/* pioneer-theme.css — Maps --pioneer-* CSS variables to Bootstrap overrides.
   Scoped under .pioneer-layout so only pages using PioneerLayout are affected.
   Ship as Static Web Asset: <link href="_content/Pioneer.Common.Blazor/pioneer-theme.css" /> */

/* ====== Body / Page Background ====== */
/* The <html>/<body> elements sit ABOVE .pioneer-layout in the tree, so they can't
   inherit the --pioneer-body-bg custom property (it's set as an inline style on the
   .pioneer-layout div and CSS variables only cascade downward). Without a themed
   background on these root elements, any content that overflows past .pioneer-layout
   — e.g. at a landscape-phone width where the 250px sidebar still shows and content
   is cramped — spills onto the browser's default WHITE body, flashing a white band
   on a dark theme.

   Anti-flash coordination: App.razor's inline <head> script paints
   document.documentElement (the <html> element) with the cached body bg from
   localStorage (key "pioneer_body_bg") BEFORE Blazor boots — falling back to the dark
   default #141b27 when nothing is cached. That inline style wins over any stylesheet
   rule on <html> (inline > stylesheet specificity), so we deliberately do NOT theme
   <html> here in a way that could fight the pre-load paint. Instead:
     - <body> inherits the <html> background, so the JS-painted color flows down to it
       and the overflow area always matches the active theme.
     - <html> carries the same #141b27 fallback the inline script uses, purely as a
       safety net for the (Blazor-Server-impossible) JS-disabled case; the inline
       script overrides it whenever it runs.
   These are UNSCOPED (global) rules — <html>/<body> are outside .pioneer-layout. */
html {
    background-color: #141b27;
}

body {
    background-color: inherit;
}

.pioneer-layout {
    background-color: var(--pioneer-body-bg, #f0f2f5);
    color: var(--pioneer-text-primary, #212529);
}

/* ====== Cards ====== */
.pioneer-layout .card,
.pioneer-layout .card.border-0,
.pioneer-layout .card.shadow-sm,
.pioneer-layout .card.h-100 {
    background-color: var(--pioneer-card-bg, white) !important;
    border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .card-header {
    background-color: var(--pioneer-card-bg, white);
    color: var(--pioneer-text-primary, #212529);
    border-bottom-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

.pioneer-layout .card-footer {
    border-top-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

/* ====== Clickable-card hover affordance (card-hover) ======
   Applied by PioneerDataTable / PioneerCardList (stacked-card rows) and
   PioneerStatCard (KPI cards with an Href) to signal "this whole card is
   clickable." The class was referenced by those components but defined
   nowhere — so clickable cards had no hover feedback at all.

   Subtle, theme-variable-driven so it reads correctly on all themes (12 dark +
   10 light): the surface lifts slightly (accent-tinted overlay via color-mix
   over the card bg), the border picks up an accent tint, and a soft shadow +
   1px raise confirm clickability without shouting. The transition keeps it
   from feeling abrupt. color-mix degrades to the literal fallbacks below on
   any engine without support. */
.pioneer-layout .card.card-hover {
    cursor: pointer;
    transition: background-color 0.12s ease-in-out,
                border-color 0.12s ease-in-out,
                box-shadow 0.12s ease-in-out,
                transform 0.12s ease-in-out;
}

.pioneer-layout .card.card-hover:hover {
    background-color: color-mix(in srgb, var(--pioneer-accent, #0d6efd) 7%, var(--pioneer-card-bg, #ffffff)) !important;
    border-color: color-mix(in srgb, var(--pioneer-accent, #0d6efd) 40%, var(--pioneer-card-border, rgba(0,0,0,0.125)));
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

/* ====== Tables ====== */
.pioneer-layout .table {
    background-color: var(--pioneer-card-bg, white);
    color: var(--pioneer-text-primary, #212529);
    border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

.pioneer-layout .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--pioneer-table-stripe, rgba(0,0,0,0.02));
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .table > :not(caption) > * > * {
    border-bottom-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

.pioneer-layout .table th {
    background-color: var(--pioneer-table-stripe, rgba(0,0,0,0.02));
    color: var(--pioneer-text-primary, #212529);
}

/* Optional sticky header — opt-in via PioneerDataTable StickyHeader="true" (the
   component adds .pioneer-sticky-thead to the <thead> and bounds the body in a
   max-height scroll container). position:sticky lives on the <th> (more reliable
   cross-browser than on <thead>); the OPAQUE card background overrides the default
   translucent header tint so scrolled body rows don't bleed through. */
.pioneer-layout .pioneer-sticky-thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--pioneer-card-bg, #fff);
}

.pioneer-layout .table > tbody > tr > * {
    background-color: transparent;
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .table-hover > tbody > tr:hover > * {
    background-color: var(--pioneer-table-stripe, rgba(0,0,0,0.02));
    color: var(--pioneer-text-primary, #212529);
}

/* ====== Bootstrap contextual TABLE ROW classes (dark-theme safe) ======
   .table-danger/.table-warning/.table-success/etc. on a <tr> set light --bs-table-*
   colors (cream/pink/green) meant for light themes. The base cell bg is already
   neutralized above, but Bootstrap paints the hover/stripe/active state via a
   box-shadow inset driven by --bs-table-bg-state (= --bs-table-hover-bg etc.), which
   that override does NOT touch — so contextual rows wash out to an illegible
   cream-on-light smear on hover. Redefine each class's table vars to a same-hue
   translucent tint + the theme's light text so contextual rows read correctly in
   every state (base / striped / hover / active), on dark AND light themes. */
.pioneer-layout .table-danger    { --pioneer-row-tint: 220, 53, 69; }
.pioneer-layout .table-warning   { --pioneer-row-tint: 245, 158, 11; }
.pioneer-layout .table-success   { --pioneer-row-tint: 25, 135, 84; }
.pioneer-layout .table-info      { --pioneer-row-tint: 13, 202, 240; }
.pioneer-layout .table-primary   { --pioneer-row-tint: 13, 110, 253; }
.pioneer-layout .table-secondary { --pioneer-row-tint: 141, 162, 192; }
.pioneer-layout .table-active    { --pioneer-row-tint: 141, 162, 192; }

.pioneer-layout .table-danger,
.pioneer-layout .table-warning,
.pioneer-layout .table-success,
.pioneer-layout .table-info,
.pioneer-layout .table-primary,
.pioneer-layout .table-secondary,
.pioneer-layout .table-active {
    --bs-table-color: var(--pioneer-text-primary, #212529);
    --bs-table-bg: rgba(var(--pioneer-row-tint), 0.16);
    --bs-table-border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
    --bs-table-striped-color: var(--pioneer-text-primary, #212529);
    --bs-table-striped-bg: rgba(var(--pioneer-row-tint), 0.20);
    --bs-table-active-color: var(--pioneer-text-primary, #212529);
    --bs-table-active-bg: rgba(var(--pioneer-row-tint), 0.24);
    --bs-table-hover-color: var(--pioneer-text-primary, #212529);
    --bs-table-hover-bg: rgba(var(--pioneer-row-tint), 0.24);
    color: var(--pioneer-text-primary, #212529);
}

/* ====== Bootstrap Subtle Backgrounds (dark-theme safe) ====== */
.pioneer-layout .bg-light-subtle,
.pioneer-layout .bg-light {
    background-color: rgba(255,255,255,0.05) !important;
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .bg-success-subtle {
    background-color: rgba(40,167,69,0.1) !important;
}

.pioneer-layout .bg-danger-subtle {
    background-color: rgba(220,53,69,0.1) !important;
}

.pioneer-layout .bg-warning-subtle {
    background-color: rgba(255,193,7,0.1) !important;
}

.pioneer-layout .bg-info-subtle {
    background-color: rgba(23,162,184,0.1) !important;
}

.pioneer-layout .bg-primary-subtle {
    background-color: color-mix(in srgb, var(--pioneer-accent, #0d6efd) 15%, transparent) !important;
}

/* Added 2026-06-01 — bg-secondary-subtle was missing from the override set
   (success/danger/warning/info/primary/light-subtle all had darkened
   variants but secondary did not), so any badge or chip using
   `bg-secondary-subtle text-secondary-emphasis` rendered as light-gray text
   on Bootstrap's default near-white secondary-subtle background — illegible
   on dark themes. Caught after CashierDirectory + CashierDetail prototypes
   used this pattern extensively for Cashier-type badges + store-code chips.
   bg-dark-subtle added for completeness even though rarely used. */
.pioneer-layout .bg-secondary-subtle {
    background-color: rgba(108,117,125,0.15) !important;
}

.pioneer-layout .bg-dark-subtle {
    background-color: rgba(0,0,0,0.20) !important;
}

/* ====== Emphasis text color on subtle badges (dark themes only) ======
   The .bg-*-subtle rules above darken the badge BACKGROUNDS for dark themes, but
   Bootstrap's text-*-emphasis colors stay at their LIGHT-mode values (dark green,
   dark amber, ...) because Pioneer's dark themes use .pioneer-theme-dark, NOT
   data-bs-theme="dark" — so Bootstrap's own dark emphasis values never kick in.
   Result: a `bg-success-subtle text-success-emphasis` badge = dark-green text on a
   near-black-green tint, unreadable (Store Data Flow loyalty pill, Fuel Overrun
   status column, and every other subtle badge). Flip emphasis text to light
   semantic colors in dark themes ONLY (these are Bootstrap 5.3's own dark-mode
   emphasis values); light themes keep their readable dark emphasis text. */
.pioneer-theme-dark .text-primary-emphasis   { color: #6ea8fe !important; }
.pioneer-theme-dark .text-secondary-emphasis { color: #a7acb1 !important; }
.pioneer-theme-dark .text-success-emphasis   { color: #75b798 !important; }
.pioneer-theme-dark .text-info-emphasis      { color: #6edff6 !important; }
.pioneer-theme-dark .text-warning-emphasis   { color: #ffda6a !important; }
.pioneer-theme-dark .text-danger-emphasis    { color: #ea868f !important; }
.pioneer-theme-dark .text-light-emphasis     { color: #f8f9fa !important; }
.pioneer-theme-dark .text-dark-emphasis      { color: #dee2e6 !important; }

/* Bootstrap .btn-close is a black SVG — invisible on dark cards/panels.
   Auto-apply the invert filter to every .btn-close inside a dark Pioneer theme
   so components don't have to opt in per-instance. Light themes keep the default. */
.pioneer-theme-dark { --pioneer-btn-close-filter: invert(1) grayscale(100%) brightness(200%); }
.pioneer-theme-dark .btn-close { filter: var(--pioneer-btn-close-filter); }

/* ====== Form switches + checkboxes (dark theme) ======
   Bootstrap's .form-check-input renders white track + dark-grey thumb by default.
   On dark surfaces the white track screams against the page + the dark thumb
   disappears. Pioneer's dark themes use .pioneer-theme-dark (not
   data-bs-theme="dark"), so Bootstrap's own dark form-switch CSS variables never
   fire. Manual override:
     - Unchecked input: dark input bg + lighter border (matches form-control).
     - Checked input: accent color (matches buttons / focus rings).
     - Form-switch thumb SVG: light-grey unchecked, white checked, so it stays
       visible against the dark track. */
.pioneer-theme-dark .form-check-input {
    background-color: var(--pioneer-input-bg, #2a3441);
    border-color: var(--pioneer-input-border, #495057);
}

.pioneer-theme-dark .form-check-input:checked {
    background-color: var(--pioneer-accent, #0d6efd);
    border-color: var(--pioneer-accent, #0d6efd);
}

.pioneer-theme-dark .form-switch .form-check-input {
    /* Lighter thumb circle for visibility on dark track (unchecked state). */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255, 255, 255, 0.55%29'/%3e%3c/svg%3e");
}

.pioneer-theme-dark .form-switch .form-check-input:checked {
    /* Solid white thumb on the accent-colored track when checked. */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.pioneer-theme-dark .form-check-label {
    color: var(--pioneer-text-primary);
}

/* ====== Forms ====== */
.pioneer-layout .form-control,
.pioneer-layout .form-select {
    background-color: var(--pioneer-input-bg, white);
    border-color: var(--pioneer-input-border, #dee2e6);
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .form-control:focus,
.pioneer-layout .form-select:focus {
    border-color: var(--pioneer-accent, #0d6efd);
    box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--pioneer-accent, #0d6efd) 25%, transparent);
}

.pioneer-layout .form-control::placeholder {
    color: var(--pioneer-text-muted, #6c757d);
    opacity: 0.6;
}

.pioneer-layout .form-label {
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .form-text {
    color: var(--pioneer-text-muted, #6c757d);
}

.pioneer-layout .input-group-text {
    background-color: var(--pioneer-input-bg, white);
    border-color: var(--pioneer-input-border, #dee2e6);
    color: var(--pioneer-text-primary, #212529);
}

/* Disabled / read-only inputs (dark-theme-safe).
   Bootstrap's :disabled / [readonly] fall back to --bs-secondary-bg — a LIGHT
   value that never darkens on Pioneer's dark themes (they use
   .pioneer-theme-dark, NOT data-bs-theme="dark", so Bootstrap's own dark vars
   never kick in — same root cause as the form-check / badge / table-row rules
   above). Without this, a non-editable field renders as a washed light box on
   every dark theme. Re-derive a recessed surface from the theme's OWN input
   vars so it reads correctly on all 22 themes (12 dark + 10 light); the input
   border is the mid-tone between bg and text, so blending toward it nudges the
   field to a recessed "disabled" surface in the right direction either way.
   opacity:1 overrides Bootstrap's default dimming so the value stays legible. */
.pioneer-layout .form-control:disabled,
.pioneer-layout .form-select:disabled,
.pioneer-layout .form-control[readonly] {
    background-color: color-mix(in srgb, var(--pioneer-input-border, #dee2e6) 35%, var(--pioneer-input-bg, #e9ecef));
    border-color: var(--pioneer-input-border, #dee2e6);
    color: var(--pioneer-text-muted, #6c757d);
    opacity: 1;
}

/* Native <select> caret is a dark Bootstrap SVG (stroke #343a40) → near-invisible
   on a dark input background — the same .pioneer-theme-dark blind spot fixed for
   the form-switch thumb above. Swap to a light chevron on dark themes; light
   themes keep Bootstrap's default dark caret (correct on a light input). */
.pioneer-theme-dark .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Range sliders: Bootstrap's track uses --bs-tertiary-bg (a light value that
   never darkens under .pioneer-theme-dark) → a light bar on dark. Theme the
   track from the input bg + the thumb from the accent; light themes unchanged. */
.pioneer-theme-dark .form-range::-webkit-slider-runnable-track { background-color: var(--pioneer-input-bg, #2a3441); }
.pioneer-theme-dark .form-range::-moz-range-track { background-color: var(--pioneer-input-bg, #2a3441); }
.pioneer-theme-dark .form-range::-webkit-slider-thumb { background-color: var(--pioneer-accent, #0d6efd); }
.pioneer-theme-dark .form-range::-moz-range-thumb { background-color: var(--pioneer-accent, #0d6efd); }

/* ====== Progress bars ====== */
/* Track inherits inset/recessed surface; fill (.progress-bar.bg-*) keeps its semantic color. */
.pioneer-layout .progress {
    background-color: var(--pioneer-input-bg, #e9ecef);
}

/* ====== Buttons ====== */
.pioneer-layout .btn-primary {
    background-color: var(--pioneer-accent, #0d6efd);
    border-color: var(--pioneer-accent, #0d6efd);
}

.pioneer-layout .btn-primary:hover,
.pioneer-layout .btn-primary:focus {
    background-color: var(--pioneer-accent-hover, #0b5ed7);
    border-color: var(--pioneer-accent-hover, #0b5ed7);
}

.pioneer-layout .btn-outline-primary {
    color: var(--pioneer-accent, #0d6efd);
    border-color: var(--pioneer-accent, #0d6efd);
}

.pioneer-layout .btn-outline-primary:hover,
.pioneer-layout .btn-outline-primary:focus {
    background-color: var(--pioneer-accent, #0d6efd);
    border-color: var(--pioneer-accent, #0d6efd);
    color: white;
}

/* ====== Badges ====== */
.pioneer-layout .badge.bg-primary {
    background-color: var(--pioneer-accent, #0d6efd) !important;
}

.pioneer-layout .badge.border:not([class*="bg-"]) {
    background-color: color-mix(in srgb, var(--pioneer-accent, #0d6efd) 15%, transparent);
    color: var(--pioneer-text-primary, #212529);
    border-color: color-mix(in srgb, var(--pioneer-accent, #0d6efd) 30%, transparent) !important;
}

/* ====== Outlined badge family (fleet design-language standard, 2026-06-19) ======
   The locked badge look: ~8% same-hue fill + a 1px colored border + colored text,
   legible on all 22 themes. Replaces the older solid `bg-*` + `-subtle` badge mix.
   Each hue carries FIXED domain meaning (R=green, S=blue, D=amber, DD=red, K=cyan,
   C=violet, A=teal; severity Critical=red/High=amber/Medium=blue/Low=green) so the
   hue must NOT drift with the per-app accent — these are intentionally fixed colors,
   unlike buttons/links/cards which follow --pioneer-accent.

   FILLED is reserved for a live alarm ONLY (e.g. a Critical severity badge) — use the
   .badge-filled-{hue} family for that lone exception; everything else stays outlined.

   Driven by the shared <PioneerBadge> component (presentation-only: each app maps its
   own domain value → Hue). Light themes read the base hue as text; dark themes lighten
   the text to the same palette used by .text-*-emphasis above (lines ~206-213).
   `muted` is a calm blue-gray neutral — never gray `bg-secondary` (operator preference:
   color draws attention, neutral stays quiet). violet/teal expose theme vars so a theme
   MAY retint them; the rest are fixed. color-mix degrades to the literal base on engines
   without support. */
.pioneer-layout .badge-outline-success { background-color: color-mix(in srgb, #198754 8%, transparent); color: #198754; border: 1px solid color-mix(in srgb, #198754 50%, transparent); }
.pioneer-layout .badge-outline-primary { background-color: color-mix(in srgb, #0d6efd 8%, transparent); color: #0d6efd; border: 1px solid color-mix(in srgb, #0d6efd 50%, transparent); }
.pioneer-layout .badge-outline-warning { background-color: color-mix(in srgb, #f59e0b 10%, transparent); color: #b86e00; border: 1px solid color-mix(in srgb, #f59e0b 50%, transparent); }
.pioneer-layout .badge-outline-danger  { background-color: color-mix(in srgb, #dc3545 8%, transparent); color: #dc3545; border: 1px solid color-mix(in srgb, #dc3545 50%, transparent); }
.pioneer-layout .badge-outline-info    { background-color: color-mix(in srgb, #0dcaf0 10%, transparent); color: #0a93b0; border: 1px solid color-mix(in srgb, #0dcaf0 50%, transparent); }
.pioneer-layout .badge-outline-violet  { background-color: color-mix(in srgb, var(--pioneer-product-violet, #8b5cf6) 10%, transparent); color: #7c3aed; border: 1px solid color-mix(in srgb, var(--pioneer-product-violet, #8b5cf6) 50%, transparent); }
.pioneer-layout .badge-outline-teal    { background-color: color-mix(in srgb, var(--pioneer-product-teal, #14b8a6) 10%, transparent); color: #0d9488; border: 1px solid color-mix(in srgb, var(--pioneer-product-teal, #14b8a6) 50%, transparent); }
.pioneer-layout .badge-outline-muted   { background-color: color-mix(in srgb, #8da2c0 8%, transparent); color: #5f6f87; border: 1px solid color-mix(in srgb, #8da2c0 45%, transparent); }

/* Dark-theme text lightening (mirrors .text-*-emphasis dark values) — the fill/border
   stay; only the text flips to the lighter semantic value for legibility on dark bg. */
.pioneer-theme-dark .badge-outline-success { color: #75b798; }
.pioneer-theme-dark .badge-outline-primary { color: #6ea8fe; }
.pioneer-theme-dark .badge-outline-warning { color: #ffda6a; }
.pioneer-theme-dark .badge-outline-danger  { color: #ea868f; }
.pioneer-theme-dark .badge-outline-info    { color: #6edff6; }
.pioneer-theme-dark .badge-outline-violet  { color: #a78bfa; }
.pioneer-theme-dark .badge-outline-teal    { color: #2dd4bf; }
.pioneer-theme-dark .badge-outline-muted   { color: #aab8d0; }

/* Filled badges — RESERVED for live alarms (Critical). Solid base + contrasting text;
   uses dedicated class names (not bg-*) so the bg-warning/info/light theme overrides
   above can't turn them translucent. */
.pioneer-layout .badge-filled-success { background-color: #198754; color: #fff; border: 1px solid #198754; }
.pioneer-layout .badge-filled-primary { background-color: #0d6efd; color: #fff; border: 1px solid #0d6efd; }
.pioneer-layout .badge-filled-warning { background-color: #f59e0b; color: #212529; border: 1px solid #f59e0b; }
.pioneer-layout .badge-filled-danger  { background-color: #dc3545; color: #fff; border: 1px solid #dc3545; }
.pioneer-layout .badge-filled-info    { background-color: #0dcaf0; color: #212529; border: 1px solid #0dcaf0; }
.pioneer-layout .badge-filled-violet  { background-color: var(--pioneer-product-violet, #8b5cf6); color: #fff; border: 1px solid var(--pioneer-product-violet, #8b5cf6); }
.pioneer-layout .badge-filled-teal    { background-color: var(--pioneer-product-teal, #14b8a6); color: #fff; border: 1px solid var(--pioneer-product-teal, #14b8a6); }
.pioneer-layout .badge-filled-muted   { background-color: #6c757d; color: #fff; border: 1px solid #6c757d; }

/* ====== Links ====== */
.pioneer-layout a:not(.btn):not(.nav-link):not(.navbar-brand):not(.nav-item a):not(.dropdown-item) {
    color: var(--pioneer-accent, #0d6efd);
}

.pioneer-layout a:not(.btn):not(.nav-link):not(.navbar-brand):not(.nav-item a):not(.dropdown-item):hover {
    color: var(--pioneer-accent-hover, #0b5ed7);
}

/* ====== Muted Text ====== */
.pioneer-layout .text-muted {
    color: var(--pioneer-text-muted, #6c757d) !important;
}

/* ====== Modals ====== */
.pioneer-layout .modal-content {
    background-color: var(--pioneer-card-bg, white);
    color: var(--pioneer-text-primary, #212529);
    border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

.pioneer-layout .modal-header {
    border-bottom-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

.pioneer-layout .modal-footer {
    border-top-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

/* ====== Dropdowns ====== */
.pioneer-layout .dropdown-menu {
    background-color: var(--pioneer-card-bg, white);
    border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .dropdown-item {
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .dropdown-item:hover,
.pioneer-layout .dropdown-item:focus {
    background-color: var(--pioneer-table-stripe, rgba(0,0,0,0.04));
    color: var(--pioneer-text-primary, #212529);
}

.pioneer-layout .dropdown-divider {
    border-top-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

/* ====== List Groups ====== */
.pioneer-layout .list-group-item {
    background-color: var(--pioneer-card-bg, white);
    border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
    color: var(--pioneer-text-primary, #212529);
}

/* ====== Pagination ====== */
/* The resting .page-link is themed below, but Bootstrap paints the HOVER,
   FOCUS, and DISABLED states from --bs-secondary-bg / --bs-tertiary-bg — light
   values that never darken under .pioneer-theme-dark, so a hovered or disabled
   pager button (e.g. "Previous" on page 1 of a PioneerDataTable) flashes a
   washed light box on dark. Drive the component's own vars from theme vars. */
.pioneer-layout .pagination {
    --bs-pagination-hover-bg: var(--pioneer-table-stripe, rgba(0,0,0,0.04));
    --bs-pagination-hover-color: var(--pioneer-accent, #0d6efd);
    --bs-pagination-hover-border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
    --bs-pagination-focus-bg: var(--pioneer-table-stripe, rgba(0,0,0,0.04));
    --bs-pagination-disabled-bg: var(--pioneer-card-bg, white);
    --bs-pagination-disabled-color: var(--pioneer-text-muted, #6c757d);
    --bs-pagination-disabled-border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
}

.pioneer-layout .page-link {
    background-color: var(--pioneer-card-bg, white);
    border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
    color: var(--pioneer-accent, #0d6efd);
}

.pioneer-layout .page-item.active .page-link {
    background-color: var(--pioneer-accent, #0d6efd);
    border-color: var(--pioneer-accent, #0d6efd);
    color: #fff;
}

/* ====== Alerts (theme-aware) ====== */
.pioneer-layout .alert {
    --bs-alert-color: var(--pioneer-text-primary, #212529);
    border-left-width: 4px;
    border-left-style: solid;
}

.pioneer-layout .alert-info {
    --bs-alert-bg: rgba(13, 110, 253, 0.1);
    --bs-alert-border-color: rgba(13, 110, 253, 0.25);
    border-left-color: #0d6efd;
}

.pioneer-layout .alert-success {
    --bs-alert-bg: rgba(25, 135, 84, 0.1);
    --bs-alert-border-color: rgba(25, 135, 84, 0.25);
    border-left-color: #198754;
}

.pioneer-layout .alert-warning {
    --bs-alert-bg: rgba(255, 193, 7, 0.1);
    --bs-alert-border-color: rgba(255, 193, 7, 0.25);
    border-left-color: #ffc107;
}

.pioneer-layout .alert-danger {
    --bs-alert-bg: rgba(220, 53, 69, 0.1);
    --bs-alert-border-color: rgba(220, 53, 69, 0.25);
    border-left-color: #dc3545;
}

/* secondary + primary: without these, Bootstrap's light default backgrounds
   collide with the theme's light --bs-alert-color → unreadable light-on-light
   in the dark theme. Match the translucent-tint pattern of the variants above. */
.pioneer-layout .alert-secondary {
    --bs-alert-bg: rgba(108, 117, 125, 0.12);
    --bs-alert-border-color: rgba(108, 117, 125, 0.3);
    border-left-color: #6c757d;
}

.pioneer-layout .alert-primary {
    --bs-alert-bg: rgba(13, 110, 253, 0.1);
    --bs-alert-border-color: rgba(13, 110, 253, 0.25);
    border-left-color: #0d6efd;
}

/* ====== Accordions ====== */
.pioneer-layout .accordion {
    --bs-accordion-bg: var(--pioneer-card-bg, white);
    --bs-accordion-color: var(--pioneer-text-primary, #212529);
    --bs-accordion-border-color: var(--pioneer-card-border, rgba(0,0,0,0.125));
    --bs-accordion-btn-bg: var(--pioneer-card-bg, white);
    --bs-accordion-btn-color: var(--pioneer-text-primary, #212529);
    --bs-accordion-active-bg: var(--pioneer-card-bg, white);
    --bs-accordion-active-color: var(--pioneer-text-primary, #212529);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--pioneer-accent, #0d6efd) 25%, transparent);
}

.pioneer-layout .accordion-button::after {
    filter: var(--pioneer-accordion-arrow-filter, none);
}

.pioneer-layout .accordion-button:not(.collapsed)::after {
    filter: var(--pioneer-accordion-arrow-filter, none);
}

/* ====== Date Pickers ====== */
/* Standard date input: hide native calendar icon, use Bootstrap Icons addon instead.
   Markup pattern:
     <div class="input-group">
       <input type="date" class="form-control pioneer-date-input" />
       <span class="input-group-text pioneer-date-icon"
             onclick="this.previousElementSibling.showPicker()">
         <i class="bi bi-calendar3 text-info"></i>
       </span>
     </div>
*/
.pioneer-theme-dark .pioneer-date-input {
    color-scheme: dark;
}
.pioneer-date-input::-webkit-calendar-picker-indicator {
    display: none;
}
.pioneer-date-icon {
    cursor: pointer;
}

/* Fleet-wide fallback: ANY native date/time picker (not just .pioneer-date-input) renders its
   native controls — including the calendar icon — for a dark UI under dark themes, so the icon is
   legible on the dark backgrounds. Light themes (.pioneer-theme-light) keep default rendering. No
   per-input markup required. */
.pioneer-theme-dark input[type="date"],
.pioneer-theme-dark input[type="datetime-local"],
.pioneer-theme-dark input[type="time"],
.pioneer-theme-dark input[type="month"],
.pioneer-theme-dark input[type="week"] {
    color-scheme: dark;
}

/* ====== Spin animation (refresh buttons, loading indicators) ====== */
.pioneer-layout .spin {
    animation: pioneer-spin 1s linear infinite;
}

@keyframes pioneer-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ====== Breadcrumbs ====== */
.pioneer-layout .breadcrumb {
    background-color: transparent;
}

.pioneer-layout .breadcrumb-item a {
    color: var(--pioneer-accent, #0d6efd);
}

.pioneer-layout .breadcrumb-item.active {
    color: var(--pioneer-text-muted, #6c757d);
}

/* ====== Connection Status (built-in Blazor reconnect UI) ====== */
.pioneer-layout #components-reconnect-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

.pioneer-layout #components-reconnect-modal .reconnect-state {
    display: none;
}

.pioneer-layout #components-reconnect-modal.components-reconnect-show .reconnecting {
    display: block;
}

.pioneer-layout #components-reconnect-modal.components-reconnect-failed .failed {
    display: block;
}

.pioneer-layout #components-reconnect-modal.components-reconnect-rejected .failed {
    display: block;
}

.pioneer-reconnect-banner {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    backdrop-filter: blur(8px);
}

.pioneer-reconnect-warning {
    background-color: var(--pioneer-card-bg, #1e2940);
    color: var(--pioneer-accent, #ffc107);
    border-bottom: 2px solid var(--pioneer-accent, #ffc107);
}

.pioneer-reconnect-error {
    background-color: var(--pioneer-card-bg, #1e2940);
    color: #e57373;
    border-bottom: 2px solid #e57373;
}

.pioneer-reconnect-reload {
    display: inline-block;
    padding: 4px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    background-color: var(--pioneer-accent, #3498db);
    color: #ffffff;
    border: none;
}

.pioneer-reconnect-reload:hover {
    opacity: 0.85;
    color: #ffffff;
}

/* ====== Inline <code> elements ======
   Bootstrap defaults <code> color to #d63384 (pink/red) which carries an
   unintended "error" or "critical" semantic. Pioneer apps use <code> for
   scannable inline values (version strings, commit hashes, image tags,
   IDs) — none of which are critical. Override to a theme-aware color
   that reads as "monospaced reference value, not error."

   Per-theme overrides should set --pioneer-code-color in their theme
   variable block. Default is a bright green that reads well against
   Pioneer's default dark theme; light themes may want to override to a
   darker variant (e.g. #15803d) for adequate contrast.

   <pre><code> blocks (for multi-line code) inherit from their <pre>
   context so syntax highlighting stays unaffected. */
.pioneer-layout code {
    color: var(--pioneer-code-color, #4ade80);
}

.pioneer-layout pre code {
    color: inherit;
}

/* ====== Bootstrap .badge.bg-light + .text-dark theme override ======
   Bootstrap's bg-light + text-dark pairing is light-theme-only. On Pioneer's
   default dark themes, bg-light renders as ~5% opacity white (essentially
   transparent on the dark page) and text-dark stays near-black, making
   "neutral / unknown" status pills unreadable. Bootstrap's default
   .badge.border also uses --bs-border-color (light gray) which clashes on
   dark themes.

   Re-base text + bg + border on Pioneer theme variables so neutral badges
   stay readable on every theme. Defaults use a warm orange — visually
   distinct from green (Healthy), cyan (Docker / info), and red (Failed),
   and orange carries an "unknown / caution / verify" semantic that fits
   the Unknown status. Per-theme overrides may set
   --pioneer-badge-neutral-bg / -color / -border in their variable block. */
.pioneer-layout .badge.bg-light {
    background-color: var(--pioneer-badge-neutral-bg, rgba(251, 146, 60, 0.15)) !important;
    color: var(--pioneer-badge-neutral-color, #fdba74) !important;
}

.pioneer-layout .badge.text-dark,
.pioneer-layout .badge .text-dark {
    color: var(--pioneer-badge-neutral-color, #fdba74) !important;
}

.pioneer-layout .badge.bg-light.border {
    border-color: var(--pioneer-badge-neutral-border, rgba(251, 146, 60, 0.4)) !important;
}

/* ====== Bootstrap .badge.bg-warning theme override ======
   Sibling override to .bg-light above. Bootstrap's default .bg-warning is
   bright #ffc107 yellow, which on Pioneer's dark themes reads as harsh
   high-saturation yellow against the dark page (technically "readable" but
   uncomfortable, and the only badge family that shouts at the operator).
   Pair: Stale agent / Needs heal / Pending / Rolled-back / Partial-rollout
   pills — all "caution / verify" semantics that should read as warm-amber,
   not road-sign yellow.

   Re-base bg + text on theme variables. Defaults use a low-saturation amber
   tint that visually pairs with the orange neutral override above —
   warning ≈ neutral but with slightly more bg saturation to keep the
   "caution" weight distinct from "unknown." Per-theme overrides may set
   --pioneer-badge-warning-bg / -color in their variable block.

   Callsites that pair `bg-warning` with `text-dark` should drop the
   `text-dark` class — the .badge.text-dark override above resolves to the
   same amber, so leaving it in just adds noise. */
.pioneer-layout .badge.bg-warning {
    background-color: var(--pioneer-badge-warning-bg, rgba(245, 158, 11, 0.18)) !important;
    color: var(--pioneer-badge-warning-color, #fcd34d) !important;
}

/* ====== Bootstrap .badge.bg-info theme override ======
   Sibling override to .bg-warning + .bg-light above. Bootstrap's default
   .bg-info is bright cyan #0dcaf0 with auto-paired dark text (light-theme
   default); on Pioneer's dark themes the cyan glares and any callsite that
   adds `text-dark` ends up with the .badge.text-dark amber override above
   on top of the cyan bg — light cyan + light amber = unreadable.

   Re-base bg + text on theme variables. Defaults use a low-saturation sky
   tint that pairs visually with the amber warning + orange neutral overrides
   above — info ≈ informational/neutral but with cyan hue to keep the
   "behind / pending / available" weight distinct from "caution" and
   "unknown." Per-theme overrides may set --pioneer-badge-info-bg /
   -color in their variable block.

   Callsites that pair `bg-info` with `text-dark` should drop the `text-dark`
   class — same convention as `bg-warning` above. */
.pioneer-layout .badge.bg-info {
    background-color: var(--pioneer-badge-info-bg, rgba(56, 189, 248, 0.18)) !important;
    color: var(--pioneer-badge-info-color, #7dd3fc) !important;
}

/* ============================================================================
   ====== MOBILE / RESPONSIVE ======
   ============================================================================
   PIONEER MOBILE BREAKPOINT — the single shared anchor for the library.

   Standardize on  max-width: 768.98px  (≈ Bootstrap `md`). This is the value
   PioneerLayout.razor.css + PioneerNavMenu.razor.css already use for the
   sidebar → stacked-nav reflow, so all hand-rolled responsive rules across the
   library converge on ONE number instead of the historical drift
   (768.98 / 769 / 992 / 576 / Bootstrap-md=768). See
   `initiatives/pioneer-blazor-mobile-responsive/overview.md` (Phase 1).

   Notes on the .98 fraction: 768.98px pairs with min-width:769px without a 1px
   gap — the standard Bootstrap idiom. Keep it; just keep the base number (768)
   consistent. Component-internal step breakpoints (e.g. PioneerDrawer's
   992/576 sizing steps) are allowed to differ — this anchor governs the
   page-level "is this a phone?" reflow, not every internal sizing step.

   Phase 1 is ADDITIVE: every rule below is gated behind the mobile @media (or
   the w-sm-auto min-width opt-in) and does NOT change desktop (≥769px)
   behavior. Per-component @media rules in the layout .razor.css files are left
   in place (they already use this exact breakpoint).
   ============================================================================ */

/* ---- w-sm-auto utility (NOT a Bootstrap 5 class) ----
   Bootstrap 5 ships w-auto / w-25 / w-50 / w-75 / w-100 but NO responsive
   w-{breakpoint}-auto variants. PioneerConfirmDialog + PioneerWizard assume
   `w-sm-auto` exists (paired with `w-100`) to get "full-width on phone, auto
   width on tablet+" buttons — without this definition the buttons silently
   stay full-width at EVERY breakpoint (a latent desktop bug, not just mobile).

   Defined UNSCOPED (global), exactly like Bootstrap's own w-* utilities, so it
   works wherever those components render regardless of .pioneer-layout nesting.
   `sm` = 576px per Bootstrap's scale (these are modal/wizard footer buttons,
   which go auto-width one step below the page mobile anchor). */
@media (min-width: 576px) {
    .w-sm-auto {
        width: auto !important;
    }
}

/* ---- Document-level horizontal-scroll guard (the definitive guard) ----
   PioneerLayout.razor.css already clips .pioneer-layout's own horizontal
   overflow at this breakpoint. But .pioneer-layout sits BELOW the document
   scroller in the box tree, so a descendant that is wider than the viewport
   can still widen the <body>/<html> box and make the DOCUMENT itself scroll
   sideways — which drags the nav header + hamburger (top of the now-full-width
   stacked sidebar) off-screen. The .pioneer-layout clip can't stop a scroll
   that happens on an ancestor scroll container.

   Clip the horizontal overflow on <body> ONLY — deliberately NOT on <html>.

   Why body-only, not `html, body`:
     - Setting overflow-x:hidden on <html> (while overflow-y stays visible)
       makes <html> compute overflow-y to `auto` per the CSS overflow spec —
       i.e. <html> becomes its OWN scroll container. That moves scrolling off
       the viewport and onto the <html> box, which BREAKS `position: sticky;
       top: 0` for the .pioneer-dev-bypass-banner (it would pin to the top of
       the html padding-box that scrolls with content, not to the visible
       viewport edge), and can disturb the toast/drawer fixed positioning.
     - Setting overflow-x:hidden on <body> while leaving <html> as `visible`
       PROPAGATES the clip up to the viewport (CSS propagates the <body>'s
       overflow to the viewport when the <html> overflow is `visible`) WITHOUT
       turning <html> or <body> into a separate scroll container. The viewport
       stays the scroller, so the sticky dev-bypass banner still pins to the
       top of the screen and .table-responsive boxes keep their own internal
       overflow-x:auto (a descendant's independent scroll container is
       unaffected by an ancestor clip).
   Verified: banner stickiness preserved + internal table scroll preserved.
   UNSCOPED (global) — <html>/<body> are outside .pioneer-layout. */
@media (max-width: 768.98px) {
    body {
        overflow-x: hidden;
    }
}

/* ---- Long-text badge wrap on phones ----
   Bootstrap badges default to white-space:nowrap, so a long-text badge — e.g.
   the Loyalty "Loyalty tickets …% vs non-loyalty" pill on the Store Data Flow
   Monitor — can't break and instead forces its line (and the widget card) past
   the viewport width, contributing to horizontal overflow. Let badges wrap and
   break unbreakable tokens at the mobile breakpoint only. Short status pills
   are unaffected (they have nothing to wrap), and desktop badge behavior is
   left untouched (additive ≤768.98px). */
@media (max-width: 768.98px) {
    .pioneer-layout .badge {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* ---- Toast container — full-width bottom-center on phones ----
   Mirrors PioneerToastContainer.razor's own MOBILE BEHAVIOR doc:
     xs/sm: fixed bottom-center, full-width toasts (easier to read on a phone).
     md+:   fixed bottom-right corner, max-width 350px.
   The .pioneer-toast-container hook class already exists in the markup
   (position-fixed bottom-0 end-0 p-3); only this @media rule was missing.
   On md+ the markup's Bootstrap utilities (bottom-0 end-0) already park it
   bottom-right, so no desktop rule is needed here. */
@media (max-width: 768.98px) {
    .pioneer-layout .pioneer-toast-container {
        left: 0 !important;
        right: 0 !important;
    }

    .pioneer-layout .pioneer-toast-container > * {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ---- Nav-link tap targets — ≥44px on phones ----
   PioneerNavLink.razor.css gives nav links height/line-height: 2rem (~32px),
   under the ~44px touch-target guideline. Bump to 2.75rem (44px) inside the
   mobile block only — desktop nav density is unchanged. ::deep is unavailable
   in a global stylesheet, so this targets the rendered anchor structure
   (.pioneer-nav-menu .nav-item a) instead of the scoped ::deep selector. */
@media (max-width: 768.98px) {
    .pioneer-layout .pioneer-nav-menu .nav-item a {
        min-height: 2.75rem;
        line-height: 2.75rem;
    }
}

/* ---- Stacked-card rows fit the viewport on phones ----
   PioneerCardList (the shared "table → cards" renderer used by PioneerDataTable
   / PioneerDetailTable / PioneerLogViewer / PioneerAuditLogViewer in auto-card
   mode) lays out each visible column as a label/value flex row inside a card.
   The label carries flex-shrink-0 and the value can contain an unbreakable
   token — a <code> machine name / image tag / version, a URL, a long word —
   which (with no min-width:0 / wrap) forces the value flex item past the card
   body width, growing the card past the viewport. On the Apps page that shows
   as cards wider than the screen.

   These hooks (added by PioneerCardList.razor) fix it at the mobile breakpoint
   only — desktop card rendering is unchanged:
     - card clamps to its container (never wider than the content column);
     - the label/value pair STACKS vertically so neither has to share a line —
       the value gets the full card width and the label can shrink;
     - the value gets min-width:0 + overflow-wrap so long tokens break/wrap
       inside the card instead of pushing its width;
     - text-end on the value is relaxed to left-align once stacked (a wrapped
       value reads better flush-left under its label).
   These are global (unscoped under .pioneer-layout) so consumer cards in every
   app pick them up, matching how the other card theme rules are written. */
@media (max-width: 768.98px) {
    .pioneer-layout .card.pioneer-card-list-item {
        max-width: 100%;
    }

    .pioneer-layout .pioneer-card-list-item .card-body {
        overflow-wrap: anywhere;
    }

    .pioneer-layout .pioneer-card-list-row {
        flex-direction: column;
        align-items: stretch !important;
    }

    /* Once stacked, the label no longer needs the right-margin gutter that
       separated it from the value on the same line, and it must be allowed to
       shrink (the flex-shrink-0 in the markup was for the side-by-side layout). */
    .pioneer-layout .pioneer-card-list-row > .fw-semibold {
        flex-shrink: 1 !important;
        margin-right: 0 !important;
    }

    .pioneer-layout .pioneer-card-list-value {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        text-align: start !important;
    }
}
