/* ── NOTHING IN A GRID IS CUT OFF (rochem-tasks#1181) ─────────────────────────────────────────
   JJ, 2026-10-01: "never cut anything off." Grid text was clipped in some thirty different ways --
   an ellipsis in a page's stylesheet, an overflow:hidden CellStyle on a column, a line clamp on a
   memo, a fixed max-width on a vendor -- and over half of the daily health check's truncation
   findings were dates ("09/18/2026" shown as "09/18/20").

   js/grid-no-cutoff.js finds them on screen, whatever caused them, and sets .g1-full on the
   element doing the hiding. Whole words define the minimum column width; fixed-layout tables
   switch to automatic layout so wrapping never splits a word into fragments.

   Edit boxes are deliberately not touched -- an input that is too narrow for its value is
   the narrow-edit-box ticket. Same screen-only, 1100px floor as every other grid rule. */
@media screen and (min-width: 1100px) {
    /* Triple class + html body: pages that clip do it with !important at two or three classes'
       weight (QD Inbound: ".qd-grid tbody .mud-table-cell { overflow: hidden !important }"), and
       the un-cut has to outrank every one of them. */
    html body .g1-full.g1-full.g1-full {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        max-width: none !important;
        max-height: none !important;
        -webkit-line-clamp: unset !important;
        line-clamp: none !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
    }
    /* Preserve old spill markers without reintroducing mid-word breaks. */
    html body .g1-break.g1-break.g1-break {
        overflow-wrap: normal !important;
        word-break: normal !important;
    }
    /* Fixed layout ignores a cell's minimum content width. Switch only tables with clipped
       text to automatic layout so the longest word has room and adjacent cells cannot overlap. */
    html body table.g1-grow.g1-grow.g1-grow {
        table-layout: auto !important;
    }
    html body table.g1-grow.g1-grow.g1-grow td,
    html body table.g1-grow.g1-grow.g1-grow th,
    html body table.g1-grow.g1-grow.g1-grow td *:not(input):not(textarea) {
        overflow-wrap: normal !important;
        word-break: normal !important;
    }
    /* A button's label never wraps -- "Order / Details" inside a 20px button is unreadable. The
       button grows to its label instead (Needs Invoicing's Order Details). */
    html body .mud-button-root .g1-full.g1-full.g1-full,
    html body .mud-button-label.g1-full.g1-full.g1-full,
    html body .g1-full.g1-full.g1-full .mud-button-label {
        white-space: nowrap !important;
        overflow-wrap: normal !important;
    }
    .mud-button-root:has(.g1-full) {
        width: auto !important;
        max-width: none !important;
        min-width: max-content !important;
    }

    /* Report memo columns are shown whole -- no clamp, nothing behind a "more" link. */
    .rv-table td.rv-wrap .rv-clamp:not(.rv-clamp-open) {
        display: block !important;
        -webkit-line-clamp: unset !important;
        line-clamp: none !important;
        overflow: visible !important;
    }
    .rv-table td.rv-wrap .rv-clamp-more { display: none !important; }
}

/* Virtualized rows use one line so Blazor's spacer height remains correct. The full-text
   repair must not override that invariant; columns grow sideways unless explicitly bounded. */
@media screen and (min-width: 601px) {
    html body .wbi3-grid table:has(.mud-table-body-virtualized) {
        table-layout: auto !important;
    }
    html body .wbi3-grid.wbi3-grid .mud-table-body-virtualized td.mud-table-cell,
    html body .wbi3-grid.wbi3-grid .mud-table-body-virtualized td.mud-table-cell
        *:not(.rv-bounded-text):not(input):not(textarea):not(button):not(svg):not(path):not(.mud-input-control):not(.mud-input-control *):not(.mud-button-root):not(.mud-button-root *) {
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
        max-width: none !important;
        max-height: none !important;
        -webkit-line-clamp: unset !important;
        line-clamp: none !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
    }
    html body .wbi3-grid .mud-table-body-virtualized .g1-full.g1-full.g1-full {
        white-space: nowrap !important;
    }
    .wbi3-grid .mud-table-container:has(.mud-table-body-virtualized) {
        overflow-anchor: none;
    }
}

/* #1479: JJ requested bounded long text with the complete value on hover.
   An explicit opt-in: categories, sorting and exported values are unchanged. */
.wbi3-grid .rv-bounded-text {
    display: block;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
