html, body {
    font-family: 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* ── The table floor: the least height of a table in FullHeightPage ──
   The header row (39 px), four rows (45 px each) and the pager (52 px) — owner's decision of 20.11.2026
   (plans/plan-common-ui-design-fix-01.md). One number, read by the grid rule below, by the paper that holds the table
   under cards (.fhp-table-paper) and by the phone's cards (ResponsiveListView.razor.css). */
:root {
    --tsg-table-min-height: 280px;
}

/* ── The content field scrolls, not the document ──
   MainLayout and HeldLayout give MudMainContent the class tsg-main: the window under the app bar, a column of the
   announcement banner and the content field — the MudContainer .tsg-page, whose padding is in css/phone.css. Whatever
   a page holds that does not fit, the field scrolls (owner's decision of 20.11.2026). Until then the document
   scrolled, and FullHeightPage computed its own height from the window, so a short window cut its fields.
   The padding at the top that keeps the field under the fixed app bar is MudBlazor's own, set per breakpoint, so the
   height counts it in (border-box) rather than repeating it. Our class rather than .mud-main-content, so the rules
   reach only the two layouts that draw the field. ⚠️ MudBlazor.min.css is loaded after this file (App.razor), so a
   property it set on these elements at the same weight would win; 9.4.0 sets none of ours — on .mud-main-content only
   margin, flex, padding-top and transition, on .mud-container width, display, box-sizing and margin. Not in
   MainLayout's scoped stylesheet either: the layout writes no element of its own above MudMainContent, and a scoped
   style reaches only those (claude/ui-design.md).
   The field outlives the page, so it is taken back to the top on a new page by ContentFieldScrollReset. */
.tsg-main {
    height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.tsg-main > .tsg-page {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
}

/* ── DataGrid header — matches design (uppercase, distinct bg) ──────────── */
.mud-table-head th.mud-table-cell {
    background-color: var(--mud-palette-drawer-background) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    white-space: nowrap;
    border-bottom: 1px solid var(--mud-palette-table-lines) !important;
}

/* ── Dialog action bar — a hairline above the buttons, so the footer reads as its own
   band and does not float against the last form field ──────────────────────── */
.mud-dialog-actions {
    border-top: 1px solid var(--mud-palette-divider);
}

/* ── Data grids inside FullHeightPage: fill the page, table area scrolls, pager pinned ──
   The floor (--tsg-table-min-height) is what keeps them so in a short window. The page may grow taller than the
   content field (FullHeightPage.razor.css), and a grid asked how tall it wants to be would answer "all of my rows":
   the page would grow to them, the table would stop scrolling inside and the pager would leave the window. With
   contain: size it answers nothing and min-height gives it the floor — in a tall window it fills what the page leaves
   it, in a short one it keeps the floor and the field scrolls the rest. On the TABLE, not on the grid's third row:
   measured on 20.11.2026, a floor on the row left an empty 280 px band on the pages with two rows. No details page
   holds a MudDataGrid, so the rule reaches lists and reports. */
.full-height-page .mud-data-grid {
    height: 100%;
    display: flex;
    flex-direction: column;
    contain: size;
    min-height: var(--tsg-table-min-height);
}

.full-height-page .mud-data-grid > .mud-table-container {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
}

/* ── Natural-height content inside FullHeightPage: the page grows to it ──
   The two rules above make every grid FILL its parent, which is right for a list and wrong for a dashboard: a
   grid among cards has a parent of natural height, and filling it means a table container of 0 px — measured on
   27.09.2026, the project dashboard showed none of its rows (known-debt W.13). Such content is wrapped in
   .fhp-flow, the page's third child, and a grid inside it takes the height of its rows. Since 20.11.2026 the page
   grows to the whole of it and the content field scrolls it like any page — one scroll bar, not a second one inside
   the third row; overflow: auto is left for what is wider than the field. */
.full-height-page .fhp-flow {
    min-height: 0;
    overflow: auto;
}

/* Without the floor too: among cards a grid keeps the height of its rows, as before it had one. */
.full-height-page .fhp-flow .mud-data-grid {
    height: auto;
    contain: none;
    min-height: 0;
}

.full-height-page .fhp-flow .mud-data-grid > .mud-table-container {
    flex: none;
}

/* ── The paper that holds the table under cards ──
   Nine screens put cards (or a note) and the table's paper in one third child, a flex column, and the paper fills
   what the cards leave. Its own min-height was 0, so with the floor on the table alone the paper still shrank under
   the table and cut it, and the page did not grow — the empty state of /store/report/stock stayed out of reach,
   measured on 20.11.2026. The class gives the paper the floor as well. */
.full-height-page .fhp-table-paper {
    flex: 1 1 0;
    min-height: var(--tsg-table-min-height);
}

/* ── The row a list has just saved or switched active flashes once (RowHighlight) ──
   A global rule, because the class lands on a <tr> the grid draws, and a list's scoped stylesheet reaches only the
   elements that list writes itself. Until 16.10.2026 this rule stood in CompanyBrowse.razor.css, which writes none,
   so the row flashed in none of the nine lists that set the class (known-debt W.64). It runs as long as
   RowHighlight.Duration. */
.row-recent-edit > td {
    animation: row-recent-edit-flash 2.5s ease-out;
}

@keyframes row-recent-edit-flash {
    0%   { background-color: rgba(var(--mud-palette-primary-rgb), 0.18); }
    100% { background-color: transparent; }
}

/* ── Chat room single-pane mobile view ──
   Below MudBlazor's md breakpoint (960px) the two chat panes stack vertically and the
   fixed 70vh papers overflow the clipped .full-height-page container, hiding the message
   input + Send. Show one pane at a time: the conversation list by default, then swap to
   the message pane (full width) once a conversation is selected (.chat-grid--open). */
@media (max-width: 959.98px) {
    /* !important is required: the MudItem panes carry an inline display:flex, which
       would otherwise outrank these stylesheet rules. */
    .chat-pane-conversation {
        display: none !important;
    }

    .chat-grid--open .chat-pane-list {
        display: none !important;
    }

    .chat-grid--open .chat-pane-conversation {
        display: flex !important;
    }
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #16a34a;
}

.invalid {
    outline: 1px solid #dc2626;
}

.validation-message {
    color: #dc2626;
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtc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ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Password show/hide on the statically rendered Identity pages.
   Both eye icons are rendered into the adornment (PasswordTextField.razor) because a page without a circuit
   cannot swap the icon from C#; exactly one of them is shown here, keyed on the class wwwtsgPasswordToggle
   puts on the button. */
.tsg-pwd-eye-off {
    display: none;
}

.tsg-password-visible .tsg-pwd-eye {
    display: none;
}

.tsg-password-visible .tsg-pwd-eye-off {
    display: inline;
}

/* A grid column the list's search matches carries a small magnifier before its title, so the screen says where the
   search looks (plans/plan-multi-column-search.md). The class is SearchColumnsDisplay's, handed to the column's
   HeaderClass from the list's one search declaration — or to a MudTh's Class, where a MudTable has no column header
   of its own; the glyph is a mask, so it takes the header's own colour. */
th.tsg-searched .column-header::before,
th.tsg-searched:not(:has(.column-header))::before {
    content: "";
    display: inline-block;
    flex: none;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    background-color: currentColor;
    opacity: 0.55;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* The print form of a document in a dialog (plans/plan-preview-and-print.md, 4.1): while PrintFormDialog is open,
   wwwtsgPrintForm.open (js/app.js) gives <body> this class and a note of its own — the preview's "it does not print",
   the print's "print it from Download PDF" — so printing the page prints the note and nothing else, the pictures of
   the pages included: they are drawn for the screen, and the paper comes from the PDF. Global, because a style
   isolated to the dialog cannot reach <body>. */
#tsg-print-form-note {
    display: none;
}

@media print {
    body.tsg-print-form-open > :not(#tsg-print-form-note) {
        display: none !important;
    }

    body.tsg-print-form-open > #tsg-print-form-note {
        display: block;
        margin: 3cm 2cm;
        font-size: 16pt;
        text-align: center;
    }
}
