/* UI-01: colours live only in css/theme.css; this file consumes --ps-* tokens. */
h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--ps-pos);
}

.invalid {
    outline: 1px solid var(--ps-neg);
}

.validation-message {
    color: var(--ps-neg);
}

/* ui-colour-exempt: the framework error boundary is deliberately fixed (red banner, white text) in both themes. */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: var(--ps-border-strong);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ==========================================================================
   Home page — the QuickBooks Desktop layout (replaces the P11-02 strips).

   A wide left column of working panels (Vendors, Customers, Employees) and a narrow right column
   (Company, Banking). Each panel is a bordered box with its name on the top edge and lines of icons
   inside; a line's main sequence is joined by arrows, the related lists sit on the lines below. It
   collapses to one column on a narrow window so nothing scrolls sideways.
   ========================================================================== */
.ps-qb-home {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(280px, 1.15fr);
    gap: 1.25rem;
    align-items: start;
    padding-top: 1.25rem;
}

@media (max-width: 1100px) {
    .ps-qb-home {
        grid-template-columns: minmax(0, 1fr);
    }
}

.ps-qb-home__main,
.ps-qb-home__side {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    min-width: 0;
}

.ps-qb-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.75rem 1.25rem 1rem;
    background: var(--ps-surface);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow);
}

.ps-qb-panel__title {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.15rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ps-primary);
    background: var(--ps-primary-tint);
    border: 1px solid var(--ps-border-strong);
    border-radius: 3px;
    white-space: nowrap;
}

.ps-qb-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-around;
    gap: 0.75rem 0;
}

.ps-qb-node {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 108px;
    padding: 0.4rem 0.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--ps-text);
    border-radius: var(--ps-radius-sm);
    transition: background 0.12s ease;
}

a.ps-qb-node:hover {
    background: var(--ps-surface-2);
    text-decoration: none;
}

.ps-qb-node .ps-qb-node__icon {
    font-size: 2.25rem;
    line-height: 1;
    color: var(--ps-qb-accent, var(--ps-accent-0));
}

.ps-qb-node__text {
    font-size: 0.8125rem;
    line-height: 1.2;
}

/* Not merely dimmed: the inert variant is rendered as a <div> with no href at all. */
.ps-qb-node--inert {
    opacity: 0.5;
    cursor: not-allowed;
}

.ps-qb-node__badge {
    font-size: 0.6rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: var(--ps-surface-2);
    color: var(--ps-text-2);
}

/* The "this comes next" connector: a grey line that stretches to fill the gap, ending in a head. */
.ps-qb-arrow {
    position: relative;
    flex: 1 1 1rem;
    min-width: 1rem;
    height: 2px;
    margin-top: 1.55rem;
    background: var(--ps-border-strong);
}

.ps-qb-arrow::after {
    content: "";
    position: absolute;
    right: -1px;
    top: -4px;
    border-left: 8px solid var(--ps-border-strong);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}
/* ==========================================================================
   Data grid density

   Radzen 5.9.4 drives grid and input sizing through CSS custom properties, so
   nothing here touches .rz-datatable internals — those are version-coupled and
   would need revisiting on every package bump. The variables are declared on
   the theme's root scope; redeclaring them on .rz-data-grid wins because custom
   properties resolve from the nearest ancestor that defines them, and the grid
   is much nearer to its own cells than :root is. No !important needed, and
   app.css loads after the Radzen theme anyway.

   Radzen ships its own Density="Compact" (.rz-density-compact, 0.25rem 0.5rem)
   — deliberately not used. It is tighter than we want for data entry, and it is
   a per-grid parameter, so it could not give us an app-wide baseline.

   Two tiers:
     MODERATE  — the default, applied to every grid with no opt-in.
     COMPACT   — .ps-grid-entry, for grids whose cells hold inputs, not text.

   Row height is driven far more by the inputs inside cells than by cell
   padding, so both are tightened. The input variables are scoped INSIDE the
   grid: forms elsewhere on the page keep the full-size controls.
   ========================================================================== */

.rz-data-grid {
    --rz-grid-cell-padding: 0.5rem 0.75rem;
    --rz-grid-header-cell-padding: 0.5rem 0;

    --rz-input-height: 2.125rem;
    --rz-input-padding-block: 0.25rem;
    --rz-input-padding-inline: 0.625rem;
    --rz-numeric-input-padding-block: 0.25rem 0.25rem;
    --rz-numeric-input-padding-inline: 0 1rem;
}

/* Data-entry grids: every cell is a control, so the reading comfort that
   justifies the moderate tier buys nothing and costs rows on screen. */
.rz-data-grid.ps-grid-entry {
    --rz-grid-cell-padding: 0.35rem 0.5rem;
    --rz-grid-header-cell-padding: 0.35rem 0;

    --rz-input-height: 1.875rem;
    --rz-input-padding-block: 0.1875rem;
    --rz-input-padding-inline: 0.5rem;
    --rz-numeric-input-padding-block: 0.1875rem 0.1875rem;
    --rz-numeric-input-padding-inline: 0 0.875rem;
}

/* Server validation messages render UNDER their input, inside the cell. Radzen
   gives .rz-cell-data `white-space: nowrap`, which lays the message out on the
   same line as the input — so it sat ON TOP of the control rather than beneath
   it, at every density. Forcing the message to its own block makes the cell (and
   the row) grow to contain it, which is what keeps it legible once the padding
   is tightened. Scoped to our own class so ordinary cell truncation is
   unaffected. */
.rz-data-grid .psa-server-validation-message {
    display: block;
    white-space: normal;
    line-height: 1.25;
    margin-top: 0.125rem;
}

/* A cell holding one must be allowed to grow; without this the message is
   clipped by the wrapper's overflow once the row is tighter than its content. */
.rz-data-grid .rz-cell-data:has(.psa-server-validation-message) {
    overflow: visible;
    white-space: normal;
}

/* ==========================================================================
   Grid width: there is deliberately no rule here

   This file used to carry a .ps-grid-fill class setting
   `.rz-grid-table { width: 100% }`. It was a no-op — the Radzen theme already
   does exactly that (material-base.css:15237) — confirmed by toggling the class
   on a live grid and measuring an identical table width and column width. It is
   removed rather than left to imply it does something.

   The real mechanic, and the whole of it: .rz-grid-table is `width: 100%` with
   `table-layout: fixed`. If the declared column widths sum to LESS than the
   container, the single auto column absorbs the remainder and all is well. If
   they sum to MORE, the declared widths win, the table's used width becomes that
   sum, the auto column is allotted zero, and the container scrolls. The fix is
   therefore entirely a budgeting exercise in the markup — trim the pinned widths
   and give the flexible column a MinWidth floor. See CLAUDE.md, "UI styling".
   ========================================================================== */

/* ==========================================================================
   P4-11: printable financial documents (first user: the year-end pre-close
   report at /year-end-close).

   Plain <table> markup rather than RadzenDataGrid throughout, deliberately.
   The grid virtualises its rows, so printing one puts only the rows that
   happen to be on screen onto the paper — silently, and with the totals
   still correct underneath, which is the worst way for a financial document
   to be wrong. It also sidesteps the known Browser-pane grid-visibility
   quirk noted in CLAUDE.md.
   ========================================================================== */

.ps-report-heading {
    font-weight: 600;
    margin: 1rem 0 0.25rem;
}

.ps-report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ps-report-table th,
.ps-report-table td {
    text-align: left;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--ps-border);
    vertical-align: top;
}

.ps-report-table thead th {
    font-weight: 600;
    border-bottom: 2px solid var(--ps-border);
    white-space: nowrap;
}

.ps-report-table tfoot td {
    font-weight: 600;
    border-top: 2px solid var(--ps-border);
    border-bottom: none;
}

.ps-amount-table td.ps-right,
.ps-amount-table th.ps-right,
.ps-right {
    text-align: right;
    font-family: var(--ps-font-mono);
    font-variant-numeric: tabular-nums;
}

.ps-surplus-table {
    margin-top: 0.75rem;
    border-top: 2px solid var(--ps-border);
}

.ps-surplus-table td {
    border-bottom: none;
}

/* A negative income line is a deduction (concessions, refunds), not an error — coloured to be
   noticed, never used as the only signal that a figure is negative. */
.ps-negative {
    color: var(--ps-neg);
}

.ps-row-blocked {
    background: var(--ps-neg-tint);
}

.ps-guidance {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    opacity: 0.85;
}

.ps-result-list {
    margin: 0;
    padding-left: 1.25rem;
}

.ps-result-list li {
    margin-bottom: 0.35rem;
}

/* Label/value pairs — the close summary and the confirmation dialog. */
.ps-kv-table {
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ps-kv-table th,
.ps-kv-table td {
    text-align: left;
    padding: 0.3rem 0.75rem 0.3rem 0;
    vertical-align: top;
}

.ps-kv-table th {
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.75;
}

.ps-confirm-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.ps-confirm-input {
    width: 100%;
}

/* Print-only furniture: rendered on paper, suppressed on screen where the app chrome and the
   toolbar already carry the same information. */
.ps-print-only {
    display: none;
}

@media print {
    /* Radzen's layout is fixed/absolutely positioned, which prints as a single clipped page.
       Unpin it before anything else. */
    .rz-header,
    .rz-sidebar,
    .ps-topbar,
    .ps-sidebar,
    .rz-notification,
    .ps-no-print {
        display: none !important;
    }

    .rz-body,
    .rz-layout,
    body {
        margin: 0 !important;
        padding: 0 !important;
        position: static !important;
        overflow: visible !important;
        height: auto !important;
        background: var(--ps-surface) !important;
    }

    .ps-print-only {
        display: block;
    }

    span.ps-print-only {
        display: inline;
    }

    /* Radzen cards carry a shadow and a heavy background that cost toner and read as clutter on
       paper; the section headings alone do the separating. */
    .ps-print-document .rz-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin-bottom: 1.25rem !important;
        background: transparent !important;
        break-inside: auto;
    }

    .ps-print-document {
        font-size: 11pt;
        color: var(--ps-text);
    }

    .ps-print-masthead {
        text-align: center;
        margin-bottom: 1.25rem;
        padding-bottom: 0.5rem;
        border-bottom: 2px solid var(--ps-text);
    }

    .ps-print-institution {
        font-size: 15pt;
        font-weight: 700;
    }

    .ps-print-title {
        font-size: 12pt;
        font-weight: 600;
        margin-top: 0.15rem;
    }

    .ps-print-meta {
        font-size: 9pt;
    }

    /* Keep a row's guidance with its row, and never orphan a table header at a page foot. */
    .ps-report-table tr,
    .ps-kv-table tr {
        break-inside: avoid;
    }

    .ps-report-table thead {
        display: table-header-group;
    }

    .ps-signature-block {
        display: flex;
        justify-content: space-between;
        gap: 2rem;
        margin-top: 3rem;
        break-inside: avoid;
    }

    .ps-signature {
        flex: 1 1 0;
        font-size: 9pt;
        text-align: center;
    }

    .ps-signature-line {
        border-top: 1px solid var(--ps-text);
        margin-bottom: 0.25rem;
    }

    a[href] {
        color: var(--ps-text);
        text-decoration: none;
    }
}
/* P9-37.2 — the document viewer's frame.
   An iframe with no styling renders at the HTML default 300x150 with a border, which would show a
   full A4 document through a letterbox. It is sized to the page and given a plain white ground so
   the preview reads as a sheet of paper rather than a widget. */
.ps-document-frame {
    width: 100%;
    height: calc(100vh - 190px);
    min-height: 420px;
    border: 1px solid var(--ps-border);
    /* Paper stays light in dark mode: it previews a printed document. */
    background: var(--ps-paper);
}

/* A disabled dropdown item is a GROUP HEADER here, not something temporarily unavailable.
   Radzen dims it, and because opacity multiplies through descendants the first version of the
   account picker added .65 on the inner span as well — the parent rows came out almost white.
   Opacity is restored to 1 and the "you cannot pick this" signal is carried by colour and cursor
   instead, which is legible at any nesting depth.

   Scope note: this is every disabled RadzenDropDown item in the app, because the popup is not
   reliably inside the component's own DOM at runtime and cannot be selected more narrowly. That is
   acceptable today — the item form's two account pickers are the ONLY dropdowns using
   DisabledProperty (checked across the Blazor project). A second one that means "unavailable"
   rather than "heading" would need its own class and a narrower rule. */
.rz-dropdown-panel .rz-dropdown-item.rz-state-disabled {
    opacity: 1;
    color: var(--ps-text-2);
    cursor: default;
}

/* ===========================================================================
   Sign-in pages — LoginLayout (staff login, company picker) and PortalLoginLayout.
   These layouts have no RadzenLayout around them, so nothing gave the page the theme's font, a
   background or any centring: labels and button text fell back to the browser's default serif and the
   card sat at the top of a white page. The shell below supplies exactly that, once, for all three
   pages. The card keeps its plain-HTML <form> (the cookie sign-in needs a real POST), so the form
   controls are styled by class here rather than swapped for Radzen components.
   =========================================================================== */
.ps-auth-shell {
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--ps-primary-tint) 0%, var(--ps-bg) 60%);
    font-family: var(--ps-font);
    color: var(--ps-text);
}

.ps-auth-card {
    width: 100%;
    max-width: var(--ps-auth-width, 420px);
}

.ps-auth-card .rz-card {
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--ps-shadow);
    border: 1px solid var(--ps-border);
}

.ps-auth-card .rz-form-field {
    display: block;
    width: 100%;
    margin-bottom: 1.25rem;
}

.ps-auth-card .ps-auth-sub {
    color: var(--ps-text-2);
}

.ps-auth-card label {
    display: block;
    margin-bottom: 0.35rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
}

.ps-auth-card input.rz-textbox {
    box-sizing: border-box;
    width: 100%;
    height: var(--rz-input-height, 2.5rem);
    padding: 0 0.9375rem;
    font-family: inherit;
    font-size: 1rem;
}

.ps-auth-card button.rz-button {
    width: 100%;
    height: 2.75rem;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}

/* One selectable row on the company picker: radio beside its label (the theme's .rz-form-field is a column
   flex box, which stacked the radio above the text), the whole row clickable, the chosen one highlighted. */
.ps-auth-card label.ps-auth-option {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--ps-border-strong);
    border-radius: 8px;
    font-weight: 400;
    cursor: pointer;
}

.ps-auth-card label.ps-auth-option:hover {
    background: var(--ps-surface-2);
}

.ps-auth-card label.ps-auth-option:has(input:checked) {
    border-color: var(--ps-primary);
    background: var(--ps-primary-tint);
}

.ps-auth-card label.ps-auth-option input[type="radio"] {
    margin: 0;
    flex: none;
}
