/* =====================================================================================
   vsi_datatables_ux.css - VSI UX Update for the standard DataTables UI
   (plan: Vsi.RapidAutomation/ClaudeProjectPlans/plan-vsi-ux-update.md)

   Loaded after vsi_datatables.css. Everything here is scoped to pages/elements that
   carry the .vsi-bs class (added by vsi_datatables.ts to each DataTable placeholder div),
   so pages without a DataTable are unaffected.

   Tokens are CSS custom properties so a client stylesheet (ViewData["ClientCss"], applied
   last by _Layout.cshtml) can override them without touching this file.
   ===================================================================================== */

:root {
    --vsi-ux-page-bg: #f4f6fa;            /* light gray page background (same as vsi.css td.vsi-main-content-section) */
    --vsi-ux-card-radius: 0.5rem;
    --vsi-ux-card-padding: 0.75rem 1rem;
    --vsi-ux-card-gap: 1rem;              /* space between the page edge / stacked cards */
    --vsi-ux-card-border: rgba(0, 0, 0, 0.08);
    --vsi-ux-card-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.10);
    --vsi-ux-subcard-radius: 0.375rem;
    --vsi-ux-subcard-gap: 0.5rem;         /* space between stacked sub-table cards */
    --vsi-ux-subcard-inset: 0.5rem;       /* sub-table card's distance from the parent's visible left/right edges */

    /* table look (Phase 3) */
    --vsi-ux-row-padding-y: 8px;          /* DataTables .compact default is 4px */
    --vsi-ux-row-border: #eceef1;         /* DataTables default is #ddd */
    --vsi-ux-header-border: #dee2e6;      /* DataTables default is #111 */
    --vsi-ux-header-weight: 600;
    /* row hover: translucent brand tint laid over each cell (from the "DataTable Styling Revision"),
       so the odd/even striping stays visible while hovered. color-mix follows a client's --primary-color. */
    --vsi-ux-row-hover-strength-odd: 24%;
    --vsi-ux-row-hover-strength-even: 28%;
    /* sort arrows (DataTables jQuery UI styling): faint when inactive, darker for the active direction */
    --vsi-ux-sort-arrow-both: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 16'%3E%3Cpath d='M0 7 4 0 8 7z' fill='%23333' fill-opacity='.125'/%3E%3Cpath d='M0 9h8l-4 7z' fill='%23333' fill-opacity='.125'/%3E%3C/svg%3E");
    --vsi-ux-sort-arrow-asc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 16'%3E%3Cpath d='M0 7 4 0 8 7z' fill='%23333' fill-opacity='.65'/%3E%3Cpath d='M0 9h8l-4 7z' fill='%23333' fill-opacity='.125'/%3E%3C/svg%3E");
    --vsi-ux-sort-arrow-desc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 16'%3E%3Cpath d='M0 7 4 0 8 7z' fill='%23333' fill-opacity='.125'/%3E%3Cpath d='M0 9h8l-4 7z' fill='%23333' fill-opacity='.65'/%3E%3C/svg%3E");

    /* row kebab gutter (Phase 6.5.1): same width the last cell used to reserve for the kebab */
    --vsi-ux-kebab-gutter-width: 2.25rem;

    /* badges (Phase 6.5.5, D29): light background + dark text of the same hue, per named color */
    --vsi-ux-badge-gray-bg: #eaecf0;    --vsi-ux-badge-gray-fg: #344054;
    --vsi-ux-badge-blue-bg: #d1e9ff;    --vsi-ux-badge-blue-fg: #175cd3;
    --vsi-ux-badge-green-bg: #dcfae6;   --vsi-ux-badge-green-fg: #067647;
    --vsi-ux-badge-teal-bg: #ccfbef;    --vsi-ux-badge-teal-fg: #107569;
    --vsi-ux-badge-purple-bg: #ebe9fe;  --vsi-ux-badge-purple-fg: #5925dc;
    --vsi-ux-badge-yellow-bg: #fef7c3;  --vsi-ux-badge-yellow-fg: #a15c07;
    --vsi-ux-badge-orange-bg: #fdead7;  --vsi-ux-badge-orange-fg: #b93815;
    --vsi-ux-badge-red-bg: #fee4e2;     --vsi-ux-badge-red-fg: #b42318;

    /* row modal (Phase 7, D23): this much of the viewport's width and height, centered both ways */
    --vsi-ux-row-modal-width: 90%;
    --vsi-ux-row-modal-height: 90vh;
    --vsi-ux-row-modal-dim: rgba(16, 24, 40, 0.5);

    /* font (Phase 6b, D11/D18): DataTables area only */
    --vsi-ux-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

    /* pagination (Phase 6) - icons are used as masks, so they take the button's text color */
    --vsi-ux-page-btn-size: 2rem;
    --vsi-ux-page-btn-radius: 0.375rem;
    --vsi-ux-page-btn-border: #d0d5dd;
    --vsi-ux-page-btn-color: #344054;
    --vsi-ux-page-btn-hover-bg: #f2f4f7;
    --vsi-ux-page-icon-first: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3 3 8l5 5M13 3 8 8l5 5' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --vsi-ux-page-icon-previous: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M10 3 5 8l5 5' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --vsi-ux-page-icon-next: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m6 3 5 5-5 5' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --vsi-ux-page-icon-last: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 3 5 5-5 5M8 3l5 5-5 5' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}


/* -------------------------------------------------------------------------------------
   Page chrome (D7: DataTables pages only)
   ------------------------------------------------------------------------------------- */

/* No line under the page header; the gray area below separates it instead. */
body:has(.vsi-bs) .vsi-main-content-header-section {
    border-bottom: none;
}

/* Everything below the header is light gray (the content area already is; the footer joins it). */
body:has(.vsi-bs) td.vsi-main-content-section,
body:has(.vsi-bs) .vsi-main-content-footer-section {
    background-color: var(--vsi-ux-page-bg);
}

/* Breathing room between the page edge and the card(s). */
body:has(.vsi-bs) .vsi-main-content {
    padding: var(--vsi-ux-card-gap);
}


/* -------------------------------------------------------------------------------------
   Font (Phase 6b, D11/D18) - Segoe UI with a system-font fallback stack, DataTables area only:
   the placeholder (.vsi-bs, which also covers the floating toolbar copy and sub-tables), the
   dropdown menus moved to <body> while open, and the fixedHeader's floating header clone.
   :where() keeps the specificity at 0, the same as vsi.css's sitewide `* { font-family: "Segoe UI",
   Arial,sans-serif }`, so this only replaces that default; any element with its own font rule
   (a monospace cell, .fancyInput, ...) keeps it.
   ------------------------------------------------------------------------------------- */

:where(.vsi-bs, .vsi-bs *, .vsi-ux-dropdown-portal, .vsi-ux-dropdown-portal *, table.fixedHeader-floating, table.fixedHeader-floating *) {
    font-family: var(--vsi-ux-font-family);
}

/* vsi_datatables.css sets its own (shorter) stack on the wrapper */
.vsi-bs .dataTables_wrapper {
    font-family: var(--vsi-ux-font-family);
}

/* Bootstrap components that read the font from a variable */
.vsi-bs {
    --bs-font-sans-serif: var(--vsi-ux-font-family);
    --bs-body-font-family: var(--vsi-ux-font-family);
}


/* -------------------------------------------------------------------------------------
   Card container around each DataTable
   NOTE: no background-color here on purpose. setTableColors() in vsi_datatables.ts paints
   the placeholder with the color scheme's backgroundColor (white by default, scheme colors
   for sub-tables), and that must keep winning.
   ------------------------------------------------------------------------------------- */

.vsi-bs.divPlaceholder {
    box-sizing: border-box;
    padding: var(--vsi-ux-card-padding);
    border: 1px solid var(--vsi-ux-card-border);
    border-radius: var(--vsi-ux-card-radius);
    box-shadow: var(--vsi-ux-card-shadow);
    /* NOTE: vsi.css gives .divPlaceholder overflow:hidden (likely to contain the floated
       search box). Left as-is for now; it will clip the Export / More Actions / row kebab
       dropdowns, which Phase 4 must address (see plan, Phase 4 design notes). */
}

/* A destroyed table leaves an empty placeholder (destroyDataTable() clears its HTML but
   keeps its classes) - don't leave an empty card behind */
.vsi-bs.divPlaceholder:empty {
    padding: 0;
    border: none;
    box-shadow: none;
}

/* Stacked tables on the same page.
   !important because placeholder divs are often declared with an inline style containing
   margin:auto (e.g. ReaderController.cs ExpandableHtml, ComponentGroupController.cs), which
   would otherwise zero the gap. Only margin-top is forced, so horizontal auto-centering stays. */
.vsi-bs.divPlaceholder + .vsi-bs.divPlaceholder {
    margin-top: var(--vsi-ux-card-gap) !important;
}

/* Sub-tables (master-detail child rows): subtler card, keep the scheme color */
.vsi-bs .vsi-bs.divPlaceholder {
    border-radius: var(--vsi-ux-subcard-radius);
    box-shadow: none;
}

.vsi-bs .vsi-bs.divPlaceholder + .vsi-bs.divPlaceholder {
    margin-top: var(--vsi-ux-subcard-gap) !important;
}

/* Sub-table cards in an expanded (child) row of a WIDE parent (Phase 6.5.1). The child row's cell spans the
   parent's whole scroll width, so the card - and its kebab gutter - would end far to the right, out of view.
   Fit the card to the parent's visible width (--vsi-ux-scroll-viewport-width, kept current by
   vsiUxTrackScrollViewport) and keep it in view while the parent scrolls sideways (sticky inside the parent's
   scroll body). The card's own table still scrolls inside it as usual.
   margin !important: controllers declare these placeholders with an inline margin:auto, which would center
   the card across the parent's full width. Child combinators: only cards directly in a child row (a row
   without odd/even) of the nearest scroll body, so each nesting level uses its own parent's width. */
.vsi-bs .dataTables_scrollBody > table > tbody > tr:not(.odd):not(.even) > td > .vsi-bs.divPlaceholder {
    position: sticky;
    left: var(--vsi-ux-subcard-inset);
    box-sizing: border-box;
    max-width: calc(var(--vsi-ux-scroll-viewport-width, 100%) - 2 * var(--vsi-ux-subcard-inset));
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Tables shown inside jQuery UI dialogs: the dialog is already the container */
.ui-dialog .vsi-bs.divPlaceholder {
    border: none;
    box-shadow: none;
    padding: 0;
}


/* -------------------------------------------------------------------------------------
   Table look (Phase 3) - CSS only; the DataTables rendering itself is unchanged (D2)

   Scoping: header/footer/sort-arrow rules use `table.dataTable` WITHOUT .vsi-bs, because
   DataTables' fixedHeader clones the header into a floating table appended to <body>,
   outside the placeholder, and the clone must look the same. Body-row rules are scoped
   to .vsi-bs.
   ------------------------------------------------------------------------------------- */

/* ---- header / footer ---- */

/* softer line under the header (DataTables default is near-black #111) */
table.dataTable thead th,
table.dataTable thead td {
    border-bottom-color: var(--vsi-ux-header-border);
}

table.dataTable tfoot th,
table.dataTable tfoot td {
    border-top-color: var(--vsi-ux-header-border);
}

table.dataTable.no-footer,
.dataTables_wrapper.no-footer .dataTables_scrollBody {
    border-bottom-color: var(--vsi-ux-header-border);
}

/* semi-bold column names (browsers bold <th> at 700 by default) */
table.dataTable thead th,
table.dataTable thead td,
table.dataTable tfoot th,
table.dataTable tfoot td {
    font-weight: var(--vsi-ux-header-weight);
}

/* breathing room between the column names and the body. Applied to the cell's inner wrapper div
   because vsi_datatables.css forces the header cells' own padding to 0 !important. With scrollX,
   DataTables keeps zero-height copies of the header/footer inside the scroll body, wrapped in
   div.dataTables_sizing - those must stay unpadded or they open a gap at the top/bottom of the body. */
table.dataTable thead th > div:not(.dataTables_sizing) {
    padding-top: 4px;
    padding-bottom: 6px;
}

table.dataTable tfoot th > div:not(.dataTables_sizing) {
    padding-top: 6px;
    padding-bottom: 4px;
}

/* ---- sort arrows ----
   The engine renders <img src="/images/sort[_asc|_desc|_none].png"> and updateSortIndicators()
   swaps the src. Rather than change the engine, hide the image and draw the jQuery UI-style
   arrows on its wrapper, picked by the current src via :has(). */
table.dataTable thead .buttonhover > img[src*="/images/sort"],
table.dataTable tfoot .buttonhover > img[src*="/images/sort"] {
    display: none;
}

table.dataTable thead .buttonhover:has(> img[src*="/images/sort"])::before,
table.dataTable tfoot .buttonhover:has(> img[src*="/images/sort"])::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 16px;
    margin-right: 6px;
    vertical-align: middle;
    background: var(--vsi-ux-sort-arrow-both) no-repeat center / 8px 16px;
}

table.dataTable thead .buttonhover:has(> img[src$="/sort_asc.png"])::before,
table.dataTable tfoot .buttonhover:has(> img[src$="/sort_asc.png"])::before {
    background-image: var(--vsi-ux-sort-arrow-asc);
}

table.dataTable thead .buttonhover:has(> img[src$="/sort_desc.png"])::before,
table.dataTable tfoot .buttonhover:has(> img[src$="/sort_desc.png"])::before {
    background-image: var(--vsi-ux-sort-arrow-desc);
}

/* non-sortable column: no arrows, but keep the space so column names stay aligned */
table.dataTable thead .buttonhover:has(> img[src$="/sort_none.png"])::before,
table.dataTable tfoot .buttonhover:has(> img[src$="/sort_none.png"])::before {
    visibility: hidden;
}

/* ---- body rows (scoped to the DataTables area) ---- */

/* more room above and below row text (the doc: "more like the Full AI Revision").
   Only real data rows: not child rows holding sub-tables, and not client-side condensed rows,
   which rely on line-height:0 to collapse. */
.vsi-bs table.dataTable tbody tr:is(.odd, .even):not(.client-side-condensed-row) > td {
    padding-top: var(--vsi-ux-row-padding-y);
    padding-bottom: var(--vsi-ux-row-padding-y);
}

/* lighter row separators (DataTables default is #ddd) */
.vsi-bs table.dataTable.display tbody th,
.vsi-bs table.dataTable.display tbody td {
    border-top-color: var(--vsi-ux-row-border);
}

/* no column separators (vsi_datatables.css draws border-right on evenColumn/oddColumn cells) */
.vsi-bs table.dataTable tbody td.evenColumn,
.vsi-bs table.dataTable tbody td.oddColumn {
    border-right: none;
}

/* row hover: replace the color scheme's filter: brightness(125%) (injected per table by
   setTableColors(), invisible on white/near-white rows, and a filter would also trap the row
   kebab dropdowns) with a translucent brand tint over each cell. The doubled .dataTable outranks
   the injected rule (.X.X:not(.selected).odd:not(.nohighlight):hover). */
.vsi-bs table.dataTable.dataTable tbody tr:is(.odd, .even):not(.selected):not(.nohighlight):hover {
    filter: none;
}

/* .vsi-ux-gutter-hover: the row's kebab slot (Phase 6.5.1) is hovered */
.vsi-bs table.dataTable tbody tr.odd:not(.nohighlight):is(:hover, .vsi-ux-gutter-hover) > td {
    box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--primary-color, #144A75) var(--vsi-ux-row-hover-strength-odd), transparent);
}

.vsi-bs table.dataTable tbody tr.even:not(.nohighlight):is(:hover, .vsi-ux-gutter-hover) > td {
    box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--primary-color, #144A75) var(--vsi-ux-row-hover-strength-even), transparent);
}

.vsi-bs table.dataTable tbody tr:is(.odd, .even) > td {
    transition: box-shadow 0.15s ease;
}

/* ---- sub-tables ----
   A sub-table in an expanded (child) row sits inside the parent table's tbody, so DataTables'
   own "table.dataTable.display tbody tr:hover { background-color: #f6f6f6 }" also matches the
   sub-table's header/footer rows and turns them near-white. Darken the scheme color instead. */
.vsi-bs table.dataTable tbody table.dataTable thead tr:hover,
.vsi-bs table.dataTable tbody table.dataTable tfoot tr:hover {
    background-color: rgba(0, 0, 0, 0.06);
}


/* -------------------------------------------------------------------------------------
   Single-row toolbar (Phase 4) - markup from vsiUxBuildToolbarHtml() in vsi_datatablesUx.ts
   [+ Add] [Export v] [row actions] [More Actions v] [page controls] ...... [search] [switches]
   ------------------------------------------------------------------------------------- */

.vsi-bs .vsi-ux-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--vsi-ux-card-border);   /* one card + divider (Phase 4 decision) */
}

.vsi-bs .vsi-ux-toolbar-actions,
.vsi-bs .vsi-ux-toolbar-search,
.vsi-bs .vsi-ux-extra-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* search + switches stay on one line (Phase 6.5.2): when the row is too narrow the whole group wraps
   below the actions as a unit, instead of the switches dropping under the search box */
.vsi-bs .vsi-ux-toolbar-search {
    margin-left: auto;
    gap: 0.75rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
    max-width: 100%;
}

/* phones: not enough width for search + switches side by side; let the switches wrap again */
@media screen and (max-width: 575.98px) {
    .vsi-bs .vsi-ux-toolbar-search {
        flex-wrap: wrap;
        flex-shrink: 1;
    }
}

/* Bootstrap's Reboot (not included, see vsi-bs README) normally enforces this; the display:flex
   rules here would otherwise override the hidden attribute used to mirror hidden original buttons */
.vsi-bs [hidden],
.vsi-ux-dropdown-portal [hidden] {
    display: none !important;
}

/* buttons: icon + label, softer secondary buttons */
.vsi-bs .vsi-ux-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
    text-decoration: none;
}

.vsi-bs .vsi-ux-btn.btn-light {
    --bs-btn-color: #344054;
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #d0d5dd;
    --bs-btn-hover-color: #1d2939;
    --bs-btn-hover-bg: #f2f4f7;
    --bs-btn-hover-border-color: #c4c9d1;
    --bs-btn-active-bg: #eaecf0;
    --bs-btn-active-border-color: #c4c9d1;
    --bs-btn-disabled-bg: #fff;
    --bs-btn-disabled-border-color: #e4e7ec;
}

/* Edit / Delete beside Add (Phase 8.3, D33): btn-primary / btn-danger once rows are selected; while disabled
   (nothing selected) a gray outline in the Actions button's palette instead of a faded fill */
.vsi-bs .vsi-ux-btn.vsi-ux-selection-btn {
    --bs-btn-disabled-color: #98a2b3;
    --bs-btn-disabled-bg: #fff;
    --bs-btn-disabled-border-color: #d0d5dd;
    --bs-btn-disabled-opacity: 1;
}

.vsi-bs .vsi-ux-icon {
    width: 1em;
    text-align: center;
    flex-shrink: 0;
}

.vsi-bs .vsi-ux-icon-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.vsi-bs .vsi-ux-icon-btn {
    min-width: 2rem;
    justify-content: center;
}

/* search box: the input keeps vsi_datatables.css's .clearable class (clear "x" image on the right),
   so leave room for it; hide the browser's own search clear button to avoid two "x"s */
.vsi-bs .vsi-ux-search {
    width: 16rem;
    max-width: 100%;
    flex-wrap: nowrap;
}

.vsi-bs .vsi-bs-toolbar .vsi-ux-search .form-control.clearable {
    padding-right: 1.5rem;
}

.vsi-bs .vsi-ux-search input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

/* advanced search / row condenser switches */
.vsi-bs .vsi-bs-toolbar .vsi-ux-switch {
    margin-bottom: 0;
    white-space: nowrap;
}

.vsi-bs .vsi-bs-toolbar .vsi-ux-switch .form-check-input,
.vsi-bs .vsi-bs-toolbar .vsi-ux-switch .form-check-label {
    cursor: pointer;
}

/* dropdown menus: moved to <body> while open (vsiUxInitDropdownPortal) so they aren't clipped */
.vsi-ux-dropdown-portal {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1080;   /* above jQuery UI dialogs and the floating fixed header */
}

.vsi-bs .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

/* group header in a menu (More Actions "Selected rows", Phase 6.5.3). It's an <h6>; Bootstrap's Reboot
   (not included) would zero its top margin, so the browser's default heading margin showed above it */
.vsi-bs .dropdown-header {
    margin-top: 0;
}

.vsi-bs .dropdown-item.disabled .vsi-ux-icon-img {
    opacity: 0.5;
}

/* flyout submenu in a dropdown (Phase 8.2, D32: "Export ▸" in More Actions). Opens to the right of its item,
   aligned with it; vsiUxPositionSubmenu flips it to the left (-start) or moves it up near the window edges */
.vsi-bs .vsi-ux-submenu {
    position: relative;
}

.vsi-bs .vsi-ux-submenu > .vsi-ux-submenu-menu {
    top: calc(-1 * (var(--bs-dropdown-padding-y) + var(--bs-dropdown-border-width)));
    left: 100%;
    margin: 0;
}

.vsi-bs .vsi-ux-submenu > .vsi-ux-submenu-menu.vsi-ux-submenu-menu-start {
    left: auto;
    right: 100%;
}

.vsi-bs .vsi-ux-submenu.vsi-ux-submenu-open > .vsi-ux-submenu-menu {
    display: block;
}

/* the item stays highlighted while its flyout is open, like a Windows menu */
.vsi-bs .vsi-ux-submenu.vsi-ux-submenu-open > .vsi-ux-submenu-toggle {
    color: var(--bs-dropdown-link-hover-color);
    background-color: var(--bs-dropdown-link-hover-bg);
}

/* ▸ at the item's right edge, with room between it and the label */
.vsi-bs .vsi-ux-submenu-toggle .vsi-ux-label {
    margin-right: 1rem;
}

.vsi-bs .vsi-ux-submenu-toggle::after {
    content: "";
    margin-left: auto;
    border-top: 0.3em solid transparent;
    border-bottom: 0.3em solid transparent;
    border-left: 0.3em solid currentColor;
}

/* the floating fixed header's copy of the left-side actions (adjustFixedHeaderWhenItShowsUp) */
.floatingButtonDiv.vsi-bs .vsi-ux-toolbar-actions {
    padding: 0.375rem 0.5rem;
}


/* -------------------------------------------------------------------------------------
   Row kebab (⋮) menu (Phase 5 D19, Phase 6.5.1 D20) - built by vsiUxSetupRowKebabs() /
   vsiUxLayoutRowKebabs() in vsi_datatablesUx.ts.
   The kebab is NOT a DataTables column. Each table with row actions reserves a gutter on the right
   of its scroll area (.dataTables_scroll); the table scrolls in the remaining width, so a kebab is
   reachable however far a wide table is scrolled and never sits over table text. A "rail" in the
   gutter holds one slot per data row; JS lines each slot up with its row and copies the row's
   background, text color and top line onto it, so it reads as part of the row. Caps continue the
   header (and the footer row, when shown) across the gutter.
   The :has() form reserves the gutter before DataTables first measures the columns (the table
   carries vsi-ux-has-row-kebab from the start), so the header stays aligned with the body.
   ------------------------------------------------------------------------------------- */

.vsi-bs .dataTables_scroll:has(> .dataTables_scrollBody > table.vsi-ux-has-row-kebab),
.vsi-bs .vsi-ux-kebab-gutter {
    position: relative;
    padding-right: var(--vsi-ux-kebab-gutter-width);
}

.vsi-bs .vsi-ux-kebab-rail,
.vsi-bs .vsi-ux-kebab-cap {
    position: absolute;
    right: 0;
    width: var(--vsi-ux-kebab-gutter-width);
    box-sizing: border-box;
}

.vsi-bs .vsi-ux-kebab-rail {
    top: 0;
    bottom: 0;
    pointer-events: none;   /* only the slots take the mouse */
}

.vsi-bs .vsi-ux-kebab-slot {
    position: absolute;
    left: 0;
    right: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: box-shadow 0.15s ease;
}

/* the same hover tint as the row (see "row hover" above), shown on the slot while either is hovered */
.vsi-bs .vsi-ux-kebab-slot.vsi-ux-hover:not(.vsi-ux-nohighlight)[data-vsi-ux-parity="odd"] {
    box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--primary-color, #144A75) var(--vsi-ux-row-hover-strength-odd), transparent);
}

.vsi-bs .vsi-ux-kebab-slot.vsi-ux-hover:not(.vsi-ux-nohighlight)[data-vsi-ux-parity="even"] {
    box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--primary-color, #144A75) var(--vsi-ux-row-hover-strength-even), transparent);
}

.vsi-bs .vsi-ux-row-kebab-toggle {
    --bs-btn-padding-x: 0;
    --bs-btn-padding-y: 0;
    --bs-btn-color: #475467;
    --bs-btn-hover-color: #1d2939;
    --bs-btn-hover-bg: rgba(0, 0, 0, 0.08);
    --bs-btn-active-color: #1d2939;
    --bs-btn-active-bg: rgba(0, 0, 0, 0.12);
    --bs-btn-border-width: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.vsi-bs .vsi-ux-row-kebab-toggle::before {
    content: "\22EE";   /* vertical ellipsis */
    font-size: 1.125rem;
    font-weight: 700;
}

/* keep the kebab readable on a selected (scheme-colored) row: the slot carries the row's text color */
.vsi-bs .vsi-ux-kebab-slot.vsi-ux-selected .vsi-ux-row-kebab-toggle {
    --bs-btn-color: inherit;
    --bs-btn-hover-color: inherit;
    --bs-btn-hover-bg: rgba(255, 255, 255, 0.2);
    --bs-btn-active-color: inherit;
    --bs-btn-active-bg: rgba(255, 255, 255, 0.3);
}

/* Floating header (FixedHeader 3.3.1) over the gutter (Phase 6.5.1). FixedHeader sizes its floating copy
   (div.dtfh-floatingparenthead, appended to <body>) to the scroll body's width, which ends at the gutter, and
   vsi_datatables.css makes it scrollable. Widening it would change its scroll range (the header would drift
   off its columns at the far right), so instead a solid box-shadow, offset by exactly the gutter width,
   paints a band of the same height to its right: it covers the rows and kebabs passing beneath, like the
   header does. The floating table is a clone of the real one, so it carries vsi-ux-has-row-kebab.
   A table wider than its scroll area (vsi-ux-table-overflows, set by vsiUxLayoutRowKebabs) shows a scrollbar
   below the floating header line, so its band has no line (same call as the header cap); otherwise a
   second shadow continues the header line along the band's bottom pixel. */
.dtfh-floatingparenthead:has(> table.vsi-ux-has-row-kebab) {
    box-shadow: var(--vsi-ux-kebab-gutter-width) 0 0 0 #fff;   /* #fff: vsi_datatables.css's floating header background */
}

.dtfh-floatingparenthead:has(> table.vsi-ux-has-row-kebab:not(.vsi-ux-table-overflows)) {
    box-shadow:
        var(--vsi-ux-kebab-gutter-width) -1px 0 0 #fff,
        var(--vsi-ux-kebab-gutter-width) 0 0 0 var(--vsi-ux-header-border);
}

/* a menu opened by right-click is focused itself (so the arrow keys work); no focus ring on it */
.vsi-ux-dropdown-portal .vsi-ux-row-kebab-menu:focus {
    outline: none;
}

/* -------------------------------------------------------------------------------------
   Table footer bar and pagination (Phase 6)
   vsi_datatables.ts wraps DataTables' length menu, page buttons and info in one div
   (dom: 'Bfrt<"vsi-ux-table-footer"lpi>'):  [Show 25 v]   [<< < 1 2 3 > >>]   [Showing 1 to 25 of 80]
   The DataTables pager markup itself is unchanged (D2); it is restyled here. The First/Previous/
   Next/Last links keep their text for screen readers; it is hidden visually (font-size:0) and the
   icon is drawn with a mask.
   ------------------------------------------------------------------------------------- */

.vsi-bs .vsi-ux-table-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;   /* keeps the page buttons centered whatever the side widths */
    align-items: center;
    gap: 0.5rem 1rem;
    padding-top: 0.75rem;
}

/* hidePaging + hidePagingDescription: nothing rendered, so no empty bar */
.vsi-bs .vsi-ux-table-footer:empty {
    display: none;
}

/* explicit cells (not auto-placement) so a missing part (e.g. hidden paging) leaves the others in place;
   float/clear/padding-top come from datatables.min.css and vsi_datatables.css */
.vsi-bs .vsi-ux-table-footer > .dataTables_length,
.vsi-bs .vsi-ux-table-footer > .dataTables_paginate,
.vsi-bs .vsi-ux-table-footer > .dataTables_info {
    grid-row: 1;
    float: none;
    clear: none;
    padding-top: 0;
    margin: 0;
}

.vsi-bs .vsi-ux-table-footer > .dataTables_length {
    grid-column: 1;
    justify-self: start;
}

.vsi-bs .vsi-ux-table-footer > .dataTables_paginate {
    grid-column: 2;
}

.vsi-bs .vsi-ux-table-footer > .dataTables_info {
    grid-column: 3;
    justify-self: end;
    text-align: right;
}

/* page-length select */
.vsi-bs .vsi-ux-table-footer .dataTables_length select {
    margin: 0 0.25rem;
    padding: 0.25rem 0.375rem;
    border: 1px solid var(--vsi-ux-page-btn-border);
    border-radius: var(--vsi-ux-page-btn-radius);
    background-color: #fff;
    color: var(--vsi-ux-page-btn-color);
}

/* ---- page buttons ---- */

.vsi-bs .vsi-ux-table-footer .dataTables_paginate {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* DataTables wraps the numbered buttons in a bare <span>; let them join the flex row */
.vsi-bs .vsi-ux-table-footer .dataTables_paginate > span {
    display: contents;
}

/* !important on color only: datatables.min.css sets the button colors with !important */
.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--vsi-ux-page-btn-size);
    height: var(--vsi-ux-page-btn-size);
    margin: 0;
    padding: 0 0.5rem;
    border: 1px solid var(--vsi-ux-page-btn-border);
    border-radius: var(--vsi-ux-page-btn-radius);
    background: #fff;
    box-shadow: none;
    color: var(--vsi-ux-page-btn-color) !important;
    font-size: 0.8125rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button:hover {
    border-color: #c4c9d1;
    background: var(--vsi-ux-page-btn-hover-bg);
    color: #1d2939 !important;
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button:focus-visible {
    outline: 2px solid var(--primary-color, #144A75);
    outline-offset: 1px;
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button.current,
.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button.current:hover {
    border-color: var(--primary-color, #144A75);
    background: var(--primary-color, #144A75);
    color: #fff !important;
    font-weight: 600;
    cursor: default;
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button.disabled,
.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button.disabled:hover,
.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button.disabled:active {
    border-color: #e4e7ec;
    background: #fff;
    color: var(--vsi-ux-page-btn-color) !important;
    opacity: 0.45;
    cursor: default;
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .ellipsis {
    padding: 0 0.25rem;
    color: var(--vsi-ux-page-btn-color);
}

/* First / Previous / Next / Last: icon only (text stays in the DOM for screen readers) */
.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button:is(.first, .previous, .next, .last) {
    width: var(--vsi-ux-page-btn-size);
    padding: 0;
    font-size: 0;
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button:is(.first, .previous, .next, .last)::before {
    content: "";
    width: 0.875rem;
    height: 0.875rem;
    background-color: currentColor;
    -webkit-mask: var(--vsi-ux-page-icon-next) center / contain no-repeat;
    mask: var(--vsi-ux-page-icon-next) center / contain no-repeat;
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button.first::before {
    -webkit-mask-image: var(--vsi-ux-page-icon-first);
    mask-image: var(--vsi-ux-page-icon-first);
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button.previous::before {
    -webkit-mask-image: var(--vsi-ux-page-icon-previous);
    mask-image: var(--vsi-ux-page-icon-previous);
}

.vsi-bs .vsi-ux-table-footer .dataTables_paginate .paginate_button.last::before {
    -webkit-mask-image: var(--vsi-ux-page-icon-last);
    mask-image: var(--vsi-ux-page-icon-last);
}

/* narrow screens: stack the three parts, centered (datatables.min.css does the same below 767px) */
@media screen and (max-width: 767px) {
    .vsi-bs .vsi-ux-table-footer {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .vsi-bs .vsi-ux-table-footer > .dataTables_length,
    .vsi-bs .vsi-ux-table-footer > .dataTables_paginate,
    .vsi-bs .vsi-ux-table-footer > .dataTables_info {
        grid-column: 1;
        grid-row: auto;
        justify-self: center;
        text-align: center;
    }
}


/* -------------------------------------------------------------------------------------
   Row modal (Phase 7, D23): an expandable row's content (its sub-tables) opens in a
   modal instead of a child row. Built by vsiUxOpenRowModal (vsi_datatablesUx.ts) inside a
   <body>-level .vsi-ux-row-modal-host.vsi-bs wrapper.
   ------------------------------------------------------------------------------------- */

/* Stacking: z-index 10 with the host appended to <body> when the modal opens. That puts the modal
   above the page (the layout's fixed left side bar is also 10, but earlier in the document) and
   BELOW every dialog that can open from inside it: DataTables Editor's lightbox (10/11, appended to
   <body> each time it opens, so after the host), jquery-modal (21/22), jQuery UI (.ui-front 100),
   select2/date pickers and the dropdown portal (1080). Bootstrap's default (1055) would hide Editor. */
.vsi-bs .modal.vsi-ux-row-modal {
    --bs-modal-zindex: 10;
    /* no Bootstrap backdrop (it is appended outside .vsi-bs, see 7.1): the modal element dims the page */
    background-color: var(--vsi-ux-row-modal-dim);
}

/* no .fade class (open/close stay synchronous), so a short fade-in is done here */
.vsi-bs .modal.vsi-ux-row-modal.show {
    animation: vsi-ux-row-modal-in 0.15s ease-out;
}

@keyframes vsi-ux-row-modal-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .vsi-bs .modal.vsi-ux-row-modal.show {
        animation: none;
    }
}

/* --vsi-ux-row-modal-width wide and --vsi-ux-row-modal-height tall, centered both ways */
.vsi-bs .vsi-ux-row-modal .modal-dialog {
    max-width: none;
    width: var(--vsi-ux-row-modal-width);
    height: var(--vsi-ux-row-modal-height);
    margin: calc((100vh - var(--vsi-ux-row-modal-height)) / 2) auto;
}

.vsi-bs .vsi-ux-row-modal .modal-content {
    height: 100%;
}

/* Reboot isn't loaded, so the heading keeps the browser's margins and size unless set here */
.vsi-bs .vsi-ux-row-modal .modal-title {
    margin: 0;
    min-width: 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* the body scrolls (modal-dialog-scrollable); page gray so the sub-table cards stand out as they do on the page */
.vsi-bs .vsi-ux-row-modal .modal-body {
    background-color: var(--vsi-ux-page-bg);
}

/* row details area (D25, Phase 7.4): flagged columns as label/value pairs in a responsive grid; a long list
   scrolls on its own so the tabs below stay in view */
.vsi-bs .vsi-ux-row-modal-details {
    margin-bottom: 1rem;
    max-height: 30vh;
    overflow: auto;
    background-color: #fff;
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--vsi-ux-subcard-radius);
}

.vsi-bs .vsi-ux-row-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.75rem 1.5rem;
    margin: 0;
    padding: 0.75rem 1rem;
}

.vsi-bs .vsi-ux-row-details > div {
    min-width: 0;
}

.vsi-bs .vsi-ux-row-details dt {
    margin: 0 0 0.125rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #667085;
}

.vsi-bs .vsi-ux-row-details dd {
    margin: 0;
    color: #101828;
    overflow-wrap: anywhere;
}

.vsi-bs .vsi-ux-row-modal-details[hidden] {
    display: none;
}

/* Tabs (Phase 7.3, D26): with [data-vsi-tab] blocks the body stops scrolling as a whole. The details area,
   any unmarked content and the tab strip stay put, and only the tab panes below the strip scroll. */
.vsi-bs .vsi-ux-row-modal .modal-body.vsi-ux-row-modal-has-tabs {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vsi-bs .vsi-ux-row-modal-has-tabs > .vsi-ux-row-modal-details {
    flex: 0 0 auto;
}

.vsi-bs .vsi-ux-row-modal-has-tabs > .vsi-ux-row-modal-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.vsi-bs .vsi-ux-row-modal-has-tabs > .vsi-ux-row-modal-content > * {
    flex: 0 0 auto;
}

.vsi-bs .vsi-ux-row-modal-tabs {
    --bs-nav-link-color: #475467;
    --bs-nav-link-hover-color: var(--primary-color, #0d6efd);
    --bs-nav-tabs-link-active-color: #101828;
    --bs-nav-tabs-link-active-bg: #fff;
    --bs-nav-tabs-link-active-border-color: var(--bs-border-color) var(--bs-border-color) #fff;
}

/* tabs are <button>s; without Reboot they'd use the browser's smaller button font */
.vsi-bs .vsi-ux-row-modal-tabs .nav-link {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.vsi-bs .vsi-ux-row-modal-tabs .nav-item[hidden] {
    display: none;
}

/* the white panel below the strip, joined to the active tab; the sub-table cards sit inside it */
.vsi-bs .vsi-ux-row-modal-has-tabs > .vsi-ux-row-modal-content > .vsi-ux-row-modal-panes {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 0.75rem;
    background-color: #fff;
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-top: 0;
}


/* -------------------------------------------------------------------------------------
   Badges (Phase 6.5.5, D29): columns with showAsBadge display their value as a soft-colored
   pill (vsiUxBadgeHtml in vsi_datatablesUx.ts). The cell keeps its row background, so the
   stripe, hover tint and selection still show around the pill.
   ------------------------------------------------------------------------------------- */
.vsi-bs .vsi-ux-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    vertical-align: middle;
    background-color: var(--vsi-ux-badge-bg);
    color: var(--vsi-ux-badge-fg);
}

.vsi-bs .vsi-ux-badge-gray   { --vsi-ux-badge-bg: var(--vsi-ux-badge-gray-bg);   --vsi-ux-badge-fg: var(--vsi-ux-badge-gray-fg); }
.vsi-bs .vsi-ux-badge-blue   { --vsi-ux-badge-bg: var(--vsi-ux-badge-blue-bg);   --vsi-ux-badge-fg: var(--vsi-ux-badge-blue-fg); }
.vsi-bs .vsi-ux-badge-green  { --vsi-ux-badge-bg: var(--vsi-ux-badge-green-bg);  --vsi-ux-badge-fg: var(--vsi-ux-badge-green-fg); }
.vsi-bs .vsi-ux-badge-teal   { --vsi-ux-badge-bg: var(--vsi-ux-badge-teal-bg);   --vsi-ux-badge-fg: var(--vsi-ux-badge-teal-fg); }
.vsi-bs .vsi-ux-badge-purple { --vsi-ux-badge-bg: var(--vsi-ux-badge-purple-bg); --vsi-ux-badge-fg: var(--vsi-ux-badge-purple-fg); }
.vsi-bs .vsi-ux-badge-yellow { --vsi-ux-badge-bg: var(--vsi-ux-badge-yellow-bg); --vsi-ux-badge-fg: var(--vsi-ux-badge-yellow-fg); }
.vsi-bs .vsi-ux-badge-orange { --vsi-ux-badge-bg: var(--vsi-ux-badge-orange-bg); --vsi-ux-badge-fg: var(--vsi-ux-badge-orange-fg); }
.vsi-bs .vsi-ux-badge-red    { --vsi-ux-badge-bg: var(--vsi-ux-badge-red-bg);    --vsi-ux-badge-fg: var(--vsi-ux-badge-red-fg); }
