/* Wave data table (T6c): Classic table geometry owned by the density enum (WaveTableDensity).
   Scoped to .wave-data-table; RwDataGrid outside a Wave table is untouched. No important flags: the
   existing grid values are changed through their variables or by more specific Wave selectors. */
.wave-data-table {
    --wave-table-row: 28px; --wave-table-head: 32px; --wave-table-toolbar: 32px;
    --wave-table-pad: 16px; --wave-table-search-icon: 8px;
    display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%;
}
.wave-data-table[data-density="short32"] { --wave-table-row: 32px; }
.wave-data-table[data-density="medium40"] { --wave-table-row: 40px; }
.wave-data-table[data-density="touch44"] { --wave-table-row: 44px; --wave-table-head: 48px; --wave-table-toolbar: 48px; --wave-table-search-icon: 16px; }
.wave-data-table[data-density="classic48"] { --wave-table-row: 48px; --wave-table-head: 48px; --wave-table-toolbar: 48px; --wave-table-search-icon: 16px; }
/* Phone (the grid's touch switch below 768): dense rows rise to the touch row; Classic48 keeps 48. */
@media (max-width: 767.98px) {
    .wave-data-table:not([data-density="classic48"]) { --wave-table-row: 44px; --wave-table-head: 48px; --wave-table-toolbar: 48px; --wave-table-search-icon: 16px; }
}
/* Minimum visible rows (T5): header + 3 rows, computed from the density on the table and on its template. */
.wave-data-table {
    --wave-template-row: var(--wave-table-row); --wave-template-head: calc(var(--wave-table-head) + 1px);
    --wave-template-region: calc(var(--wave-table-head) + 1px + 3 * var(--wave-table-row) + 1px);
}
.wave-template:has(.wave-data-table[data-density="short32"]) { --wave-template-row: 32px; }
.wave-template:has(.wave-data-table[data-density="medium40"]) { --wave-template-row: 40px; }
.wave-template:has(.wave-data-table[data-density="touch44"]) { --wave-template-row: 44px; --wave-template-head: 49px; }
.wave-template:has(.wave-data-table[data-density="classic48"]) { --wave-template-row: 48px; --wave-template-head: 49px; }
@media (max-width: 767.98px) {
    .wave-template:has(.wave-data-table) { --wave-template-head: 49px; }
}
.wave-data-table > .wave-state-region { flex: 1 1 auto; height: auto; min-height: var(--wave-template-region); }
.wave-data-table > .wave-state-region > .wave-state-loading > .wave-state-skeleton { height: var(--wave-table-row); }
.wave-data-table > .wave-state-region > .wave-state-loading[data-region="true"] > .wave-state-skeleton:first-child { height: calc(var(--wave-table-head) + 1px); }

/* Surface roles (53): white table, Classic header #e0e0e0, row hover/selected from the layer. */
.wave-data-table .rw-grid-root {
    --cds-layer-hover: var(--wave-layer-hover); --cds-layer-hover-01: var(--wave-layer-hover);
    --cds-layer-selected: var(--wave-layer-selected); --cds-layer-selected-01: var(--wave-layer-selected); --cds-grid-select: var(--wave-layer-selected);
    --cds-grid-cell-border: var(--wave-border-subtle); --cds-grid-border: var(--wave-border-subtle);
    --cds-rw-ctrl-bg: var(--wave-surface);
}

/* Header: one height per density, Classic heading 14/18 600, 16px inline padding. */
.wave-data-table .rwgrid.cds-rwgrid .header,
.wave-data-table .rwgrid.cds-rwgrid .header-container,
.wave-data-table .rwgrid.cds-rwgrid .header-container > :is(.rw-column, .rw-column-sx) {
    box-sizing: border-box; height: var(--wave-table-head); min-height: var(--wave-table-head);
}
.wave-data-table .rwgrid.cds-rwgrid .header-container > .rw-column,
.wave-data-table .rwgrid.cds-rwgrid .header-container > .rw-column * {
    font: 600 14px/18px var(--wave-font-sans); letter-spacing: .16px; color: var(--cds-text-primary, #161616);
}
/* The grid's left-aligned header text carries the fixed .75rem utility padding; the column adds the rest of 16px. */
.wave-data-table .rwgrid.cds-rwgrid .header-container > .rw-column:not(:first-child):has(> .ps-3:first-child) { padding-inline-start: calc(var(--wave-table-pad) - .75rem); }

/* Rows and cells: Classic body 14/18, 16px inline padding, 1px row line inside the row height. */
.wave-data-table .rwgrid.cds-rwgrid .rw-data-row { box-sizing: border-box; font: 400 14px/18px var(--wave-font-sans); letter-spacing: .16px; color: var(--cds-text-secondary, #525252); }
.wave-data-table .rwgrid.cds-rwgrid .rw-data-row:is(:hover, .rw-row-selected) { color: var(--cds-text-primary, #161616); }
.wave-data-table .rwgrid.cds-rwgrid .rw-cell .rw-cell-content-container .rw-cell-content { padding-inline-start: var(--wave-table-pad); }
.wave-data-table .rwgrid.cds-rwgrid .rw-cell .rw-cell-content-container { line-height: 18px; }

/* Check boxes: 16px box; the whole selector cell (row height) is the hit area (wave-data-table.js). */
.wave-data-table .rwgrid .rw-row-selector-cell,
.wave-data-table .rwgrid .rw-column-selector { cursor: pointer; }
.wave-data-table .rwgrid .rw-grid-row-selector-check { box-sizing: border-box; width: 16px; height: 16px; min-width: 16px; margin: 0; flex: none; }

/* Keyboard cursor: 2px focus inside the cell. Selected row: Gray 10 selected + left indicator (53). */
.wave-data-table .rwgrid.cds-rwgrid .rw-cell.rw-cell-focused::after { border-color: transparent; }
.wave-data-table .rwgrid.cds-rwgrid:focus-within .rw-cell.rw-cell-focused::after { border-color: var(--cds-focus, #0f62fe); }

/* Cell editor: the editor fills the row height (G1), 1px bottom line (G2), 2px inner focus outline (G3). */
.wave-data-table .rwgrid .rw-cell[data-cell-editing="true"] { position: relative; overflow: visible; }
.wave-data-table .rwgrid .rw-cell[data-cell-editing="true"] > .rw-cell-editor-container {
    position: absolute; inset: 0 0 -1px 0; z-index: 2; width: auto; height: auto;
}
.wave-data-table .rwgrid .rw-cell[data-cell-editing="true"] .rw-cell-editor-container .rw-cell-editor {
    --wave-control-height: var(--wave-table-row); --wave-input-height: var(--wave-table-row);
    box-sizing: border-box; width: 100%; height: var(--wave-table-row); min-height: 0; max-height: none; margin: 0;
    padding: 0 var(--wave-table-pad); border: 0; border-bottom: 1px solid var(--cds-border-strong-01, #8d8d8d);
    background-color: var(--wave-field, #f4f4f4); font: 400 14px/18px var(--wave-font-sans); letter-spacing: .16px; color: var(--cds-text-primary, #161616);
    outline: 2px solid var(--cds-focus, #0f62fe); outline-offset: -2px;
}
.wave-data-table .rwgrid .rw-cell[data-cell-editing="true"][aria-invalid="true"] .rw-cell-editor-container .rw-cell-editor { outline-color: var(--cds-support-error, #da1e28); }

/* Table toolbar (Classic): small 32 for dense rows, tall 48 for Touch44/Classic48. */
.wave-table-toolbar { position: relative; display: flex; align-items: stretch; flex: none; box-sizing: border-box; min-width: 0; height: var(--wave-table-toolbar); background-color: var(--wave-surface, #ffffff); }
.wave-table-search { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; background-color: var(--wave-field, #f4f4f4); }
.wave-table-search > .carbon-icon { position: absolute; inset-inline-start: var(--wave-table-search-icon); top: calc(50% - 8px); color: var(--cds-icon-secondary, #525252); pointer-events: none; }
.wave-table-search-input {
    box-sizing: border-box; width: 100%; height: 100%; margin: 0; padding: 0 var(--wave-table-pad) 0 calc(var(--wave-table-search-icon) * 2 + 16px);
    border: 0; border-radius: 0; background: transparent; font: 400 14px/18px var(--wave-font-sans); letter-spacing: .16px; color: var(--cds-text-primary, #161616);
    outline: 2px solid transparent; outline-offset: -2px;
}
.wave-table-search-input::placeholder { color: var(--cds-text-placeholder, #a8a8a8); }
.wave-table-search-input:focus { outline-color: var(--cds-focus, #0f62fe); }
.wave-table-search-input::-webkit-search-cancel-button { cursor: pointer; }
.wave-table-actions { display: flex; align-items: center; flex: none; margin-inline-start: auto; }
.wave-table-toolbar .wave-button { --wave-button-height: var(--wave-table-toolbar); align-self: center; }

/* Batch action bar: replaces the toolbar while rows are checked. */
.wave-table-batch { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; background-color: var(--cds-background-brand, #0f62fe); color: var(--cds-text-on-color, #ffffff); }
.wave-table-batch-count { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0 var(--wave-table-pad); overflow: hidden; font: 400 14px/18px var(--wave-font-sans); letter-spacing: .16px; white-space: nowrap; text-overflow: ellipsis; }
.wave-table-batch-actions { display: flex; align-items: center; flex: none; height: 100%; }
.wave-table-batch .wave-button { --wave-button-text: var(--cds-text-on-color, #ffffff); --wave-button-hover: var(--cds-button-primary-hover, #0353e9); --wave-button-active: var(--cds-button-primary-active, #002d9c); }
.wave-table-batch .wave-button:is(.wave-button-ghost, .wave-button-ghost-secondary):hover:not(:disabled) { color: var(--cds-text-on-color, #ffffff); }
.wave-table-batch .wave-button:focus { border-color: var(--cds-text-on-color, #ffffff); box-shadow: inset 0 0 0 1px var(--cds-text-on-color, #ffffff), inset 0 0 0 2px var(--cds-background-brand, #0f62fe); }
.wave-table-batch [data-wave-batch-cancel]::before { content: ""; position: absolute; inset-inline-start: 0; top: calc(50% - 8px); width: 1px; height: 16px; background-color: var(--cds-text-on-color, #ffffff); }

/* Scan result: highlighted row (color plus the aria-live notice). */
.wave-data-table .rwgrid .rw-data-row:has(> .rw-cell.wave-table-hit) {
    --cds-rw-ctrl-bg: var(--cds-highlight, #edf5ff); --cds-layer-hover: var(--cds-highlight, #edf5ff); --cds-layer-hover-01: var(--cds-highlight, #edf5ff);
    color: var(--cds-text-primary, #161616);
}
.wave-data-table .rwgrid .rw-data-row:has(> .rw-cell.wave-table-hit) > :first-child { box-shadow: inset 3px 0 0 var(--cds-support-info, #0043ce); }
.wave-table-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
