/* ==========================================================================
   Portal.UI — DevExpress Blazor overrides
   Applies portal tokens to DX component selectors. Version-coupled to
   DevExpress.Blazor 26.1.3 — verify on DX version bumps.
   ========================================================================== */

/* The DevExpress theme ships Bootstrap's base styles and loads after
   portal-ui.css, so it wins on plain element selectors. Restore the Portal's
   own: brand-red links, and field labels as blocks (Bootstrap makes labels
   inline-block, which shrinks them and the inputs inside to their content). */
a { color: var(--portal-brand); }
a:hover { color: var(--portal-brand-hover); }
.portal-field > label { display: block; }

/* DxGrid — used on .worksites-grid consumer class */
.worksites-grid {
    font-family: var(--portal-font-ui);
    font-size: var(--portal-size-grid);
}
/* Header row: warm-stone band with black uppercase text. Do NOT set
   flex/align-items on `.dxbl-grid-header` itself — DevExpress relies on
   its own internal layout and forcing flex there breaks the whole grid.
   Bottom-alignment happens inside `.dxbl-grid-header-content` below. */
.worksites-grid .dxbl-grid-header {
    background: var(--nt-stone);
    color: var(--nt-black);
}
.worksites-grid .dxbl-grid-header-content,
.worksites-grid .dxbl-grid-header-content .dxbl-text {
    color: var(--nt-black);
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-heavy);
    font-size: var(--portal-size-meta);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
/* Bottom-align ALL header captions at the bottom of the tall row (whose
   height is driven by the vertical status captions). DX renders headers
   as table-cells; DX's own theme rule `.dxbl-grid .dxbl-grid-table >
   thead > tr > th` sets vertical-align: middle at higher specificity,
   so !important is needed to override. */
.worksites-grid .dxbl-grid-header {
    vertical-align: bottom !important;
}
/* Vertical status headers: writing-mode vertical-rl + rotate(180deg)
   reads bottom-to-top (first character at bottom-left). Kept the working
   pattern from the previous peek round. */
.worksites-grid .dxbl-grid-header:not([class*="fixed"]) .dxbl-grid-header-content {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    min-height: 140px;
    padding: var(--portal-space-2) var(--portal-space-1);
}
/* Cells inside non-frozen status columns need overflow: visible so the
   CSS tooltip on .status-icon can escape the cell clipping. DX renders
   status cells as <td class="dxbl-align-center"> with overflow: hidden
   at a higher specificity than our unscoped rule can beat by structure
   alone — hence !important. Status columns are tick/cross-only (no long
   text) so we don't need the clipping. */
.worksites-grid td.dxbl-align-center,
.worksites-grid .dxbl-grid-cell:not([class*="fixed"]),
.worksites-grid .dxbl-grid-row {
    overflow: visible !important;
}
/* Centre any status cell regardless of DX's own align class. DX aligns
   columns by FieldName type — bool → center, DateTime/string → start/end
   — so columns like Shutdown (string) and DateCL/DateFABR (unconditional
   DateTime) were left-aligned. `:has()` catches every TD holding a
   status icon so we don't need to hunt column-by-column. */
.worksites-grid td:has(> .status-icon),
.worksites-grid td:has(> .worksite-check),
.worksites-grid td:has(> .status-filter-cycle) {
    text-align: center !important;
}
/* Cells inside the same narrow columns: centre the tick/cross icon so it
   sits under the vertical column caption. */
.worksites-grid .dxbl-grid-cell:not([class*="fixed"]) .status-icon {
    display: block;
    text-align: center;
    margin: 0 auto;
}
.worksites-grid .dxbl-grid-cell:not([class*="fixed"]) .worksite-check {
    display: flex;
    margin: 0 auto;
}
/* Three-state cycle button used inside FilterRowCellTemplate on each
   status column. Small square button, glyph-only, colour matches
   StatusIcon symbology. */
.worksites-grid .status-filter-cycle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 22px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--portal-radius-sm);
    color: var(--symbol-pending);
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-strong);
    font-size: 0.9375rem;
    line-height: 1;
    cursor: pointer;
}
.worksites-grid .status-filter-cycle:hover {
    border-color: var(--portal-border);
    background: var(--nt-white);
}
.worksites-grid .status-filter-cycle.status-filter-ok   { color: var(--symbol-ok); }
.worksites-grid .status-filter-cycle.status-filter-fail { color: var(--symbol-fail); }
/* Contractor filter DxComboBox: keep it constrained to the frozen
   column's width; the default combobox stretches to fill parent flex. */
.worksites-grid .worksites-contractor-filter { max-width: 100%; }
.worksites-grid .dxbl-grid-edit-row {
    background: var(--nt-stone);
}
/* Filter row: set apart from the stone header above and the data below, so
   it reads as a strip of controls. A paler stone, a white gap above and a
   sand rule below. Set on the cells: DX paints frozen cells' own background,
   at higher specificity, hence !important. */
.worksites-grid .dxbl-grid-filter-row > td {
    background: color-mix(in srgb, var(--nt-stone) 40%, var(--nt-white)) !important;
    border-top: 4px solid var(--nt-white) !important;
    border-bottom: 2px solid var(--nt-sand) !important;
    padding-block: var(--portal-space-1) !important;
}
.worksites-grid .dxbl-grid-filter-row input {
    background: var(--nt-white);
}
/* The cycle buttons look like controls in the filter row: white box with a
   border, filled when a filter is on. */
.worksites-grid .dxbl-grid-filter-row .status-filter-cycle {
    background: var(--nt-white);
    border-color: var(--portal-border);
}
.worksites-grid .dxbl-grid-filter-row .status-filter-cycle.status-filter-ok,
.worksites-grid .dxbl-grid-filter-row .status-filter-cycle.status-filter-fail {
    border-color: currentColor;
}
/* Hovered and selected rows. DX 26.1 renders data rows as a bare
   <tr data-visible-index> (no row class) and paints each cell, frozen cells
   opaquely, so the tint goes on the cells and must itself be opaque. */
.worksites-grid tr[data-visible-index]:hover > td {
    background-color: color-mix(in srgb, var(--nt-red-2) 8%, var(--nt-white)) !important;
    cursor: pointer;
}
.worksites-grid tr[data-visible-index][aria-selected="true"] > td {
    background-color: color-mix(in srgb, var(--nt-red-2) 12%, var(--nt-white)) !important;
}

/* DxComboBox — used for the staff contractor filter */
.dxbl-combobox {
    font-family: var(--portal-font-body);
    font-size: var(--portal-size-body);
}
.dxbl-combobox .dxbl-input:focus-within {
    outline: 2px solid var(--portal-focus);
    outline-offset: 2px;
}

/* DxTextBox — used for the global search box */
.dxbl-textbox .dxbl-input:focus-within {
    outline: 2px solid var(--portal-focus);
    outline-offset: 2px;
}
