#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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;
}

:root {
    font-size: var(--rz-root-font-size);
}

body {
    font-family: var(--rz-text-font-family);
    color: var(--rz-text-color);
    font-size: var(--rz-body-font-size);
    line-height: var(--rz-body-line-height);
    background-color: var(--rz-body-background-color);
}

.rz-body {
    --rz-body-padding: 0;
}

a {
    color: var(--rz-link-color);
}

a:hover,
a:focus {
    color: var(--rz-link-hover-color);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS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azor-error-boundary::after {
    content: "An error has occurred."
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}
/* ---- Sizing: dialogs, forms, grids, filter bar - same rules as IRErp (docs/ui/README.md) ---- */

/* Dialogs opened with DialogSizes.* (Client/Components/DialogSizes.cs) and the page body
   (MainLayout) are size containers, so a form reacts to the width it actually has rather than
   the viewport's. */
.erp-form-dialog .rz-dialog-content,
.erp-page-container {
    container-type: inline-size;
}

/* The page body may grow to 2400px (MainLayout). Text-heavy pages that read badly at that
   width wrap their content in this class to keep the former 1440px measure. */
.erp-page-narrow {
    max-width: 1440px;
    margin-inline: auto;
}

/* Opt-in on a virtualized RadzenDataGrid: fill the window height instead of a fixed page
   size. Set --erp-grid-fill-offset on the grid when the page has more chrome above it. */
.erp-grid-fill {
    height: calc(100vh - var(--erp-grid-fill-offset, 14rem));
    min-height: 20rem;
}

/* Opt-in on a paged RadzenDataGrid: grow with the rows up to the window height, then scroll
   inside with the pager still visible. Same offset variable as .erp-grid-fill. */
.erp-grid-fit {
    max-height: calc(100vh - var(--erp-grid-fill-offset, 14rem));
    min-height: 20rem;
}

/* Opt-in on a list page's root stack: the page takes the body's height and an .erp-grid-fit
   grid that is its direct child takes whatever is left below the title and filters. Works the
   same under the sidebar and the top menu, so the grid needs no --erp-grid-fill-offset. On a
   window too low for the 20rem minimum the body scrolls as before. */
.rz-body:has(.erp-page-fill) {
    display: flex;
    flex-direction: column;
}

/* width: the row centres itself with auto margins, which in a flex column would shrink it to
   its content. nowrap: a single-line row stretches the page column to the row's height; a
   wrapping one sizes it to its content. */
.rz-body:has(.erp-page-fill) > .rz-row {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    flex-wrap: nowrap;
    /* The layout's 3rem bottom gap (rz-pb-lg-12) is for pages that scroll; here it would only
       take height from the grid. Radzen's spacing classes are !important. */
    padding-bottom: 1rem !important;
}

.erp-page-container:has(> .erp-page-fill) {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.erp-page-fill {
    flex: 1 1 auto;
    min-height: 0;
}

.erp-page-fill > .erp-grid-fit {
    flex: 1 1 0;
    max-height: none;
}

/* When the grid sits in a wrapper (e.g. fin-grid-wrap for its loading overlay), the wrapper is
   the flex item and passes the height on to the grid. */
.erp-page-fill > .erp-grid-slot {
    flex: 1 1 0;
    min-height: 20rem;
    display: flex;
    flex-direction: column;
}

.erp-grid-slot > .erp-grid-fit {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
}

/* Filter bar (Client/Components/FilterBar): fixed-width fields that wrap, so more room fits
   more fields per line instead of stretching the same ones. */
.erp-filter-card.rz-card {
    padding: 0.75rem 1rem;
}

.erp-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 1rem;
}

.erp-filter-advanced {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: var(--rz-border-base-200, 1px solid #e0e0e0);
}

.erp-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 100%;
}

.erp-filter-label {
    font-size: 0.8125rem;
    color: var(--rz-text-secondary-color);
}

.erp-filter-w-date { width: 9rem; }
.erp-filter-w-range { width: 18.5rem; }
.erp-filter-w-short { width: 14rem; }
.erp-filter-w-long { width: 20rem; }

.erp-filter-range {
    display: flex;
    gap: 0.5rem;
}

.erp-filter-range > * {
    flex: 1 1 0;
    min-width: 0;
}

.erp-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.erp-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.625rem;
}

.erp-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 24rem;
    padding: 0.125rem 0.25rem 0.125rem 0.625rem;
    border-radius: 1rem;
    background-color: var(--rz-base-200);
    color: var(--rz-text-color);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.erp-filter-chip > span:not(.erp-filter-chip-label) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-filter-chip-label {
    color: var(--rz-text-secondary-color);
}

.erp-filter-chip-remove {
    display: inline-flex;
    padding: 0.125rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.erp-filter-chip-remove:hover {
    background-color: var(--rz-base-300);
}

.erp-filter-chip-remove .rzi {
    font-size: 1rem;
}

/* Opt-in on the form root: label/field rows flow into two columns once the dialog is wide
   enough. Anything that is not a row (buttons, alerts) and rows marked .erp-span-all keep the
   full width. */
@container (min-width: 1000px) {
    .erp-form-reflow {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 2rem;
        align-items: start;
    }

    .erp-form-reflow > :not(.rz-row),
    .erp-form-reflow > .erp-span-all {
        grid-column: 1 / -1;
    }
}

/* Controlled-document reports (P3a): a row whose acknowledgement or review is late. Danger text colour of the theme, so it
   follows light and dark. Rows are marked with data- attributes (CtrlUi.MarkRow): a class would replace Radzen's own. The
   text sits in .rz-cell-data, which a Radzen row colours itself, so it is set there too. */
.rz-data-grid tr[data-overdue] > td,
.rz-data-grid tr[data-overdue] > td .rz-cell-data {
    color: var(--rz-danger);
}

/* R1 row of a document the caller may not open (an owner sees the whole master list). */
.rz-data-grid tr[data-noopen] > td {
    cursor: default;
}

/* --------------------------------------------------------------------------
   In-app help panel (docs/help/help-system-spec.md §6.2).
   A fixed right-side panel ABOVE Radzen dialogs: it is opened from a
   dialog's HelpLink and must be readable beside the form. Equal z-index to the
   dialog (--rz-dialog-zindex, 1001); rendered after RadzenComponents in the DOM,
   so it wins the tie. Notifications (1002) stay on top of both.
   -------------------------------------------------------------------------- */
.ir-help-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(480px, 100vw);
    z-index: var(--rz-dialog-zindex, 1001);
    display: flex;
    flex-direction: column;
    background: var(--rz-base-background-color);
    border-left: var(--rz-panel-border);
    box-shadow: -2px 0 12px rgba(0, 0, 0, .12);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .2s ease-in-out, visibility 0s linear .2s;
}

.ir-help-panel--open {
    transform: translateX(0);
    visibility: visible;
    transition: transform .2s ease-in-out, visibility 0s;
}

.ir-help-panel__header {
    border-bottom: var(--rz-panel-border);
    flex: 0 0 auto;
}

.ir-help-panel__title {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ir-help-panel__body {
    flex: 1 1 auto;
    overflow-y: auto;
}

.ir-help-panel__list,
.ir-help-toc {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.ir-help-panel__list li,
.ir-help-toc li {
    padding: .2rem 0;
}

.ir-help-toc--active .rz-link-text {
    font-weight: 600;
}

/* Topic body: headings smaller than page headings — the topic is a document inside a page or panel. */
.ir-help-topic .rz-markdown h2 { font-size: 1.25rem; margin-top: 1.5rem; }
.ir-help-topic .rz-markdown h3 { font-size: 1.05rem; margin-top: 1rem; }

/* Heading self-links (RadzenMarkdown AutoLinkHeadingDepth, Radzen 12): a link icon plus "Link to this section" in
   .rz-sr-only, which the theme CSS does not define, so the text showed. Screen-reader only here; icon on hover. */
.ir-help-topic .rz-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ir-help-topic .rz-markdown :is(h2, h3) > a {
    margin-left: .35rem;
    font-size: .8em;
    text-decoration: none;
    opacity: 0;
    transition: opacity .15s;
}

.ir-help-topic .rz-markdown :is(h2, h3):hover > a,
.ir-help-topic .rz-markdown :is(h2, h3) > a:focus-visible {
    opacity: .6;
}
.ir-help-topic .rz-markdown blockquote {
    margin: 1rem 0;
    padding: .5rem 1rem;
    border-left: 4px solid var(--rz-primary);
    background: var(--rz-base-100, rgba(0, 0, 0, .03));
}

/* "Polja": one collapsible group per tab. */
.ir-help-topic__fields {
    /* Not --rz-panel-border: empty in Material 3, which left the groups without an outline. */
    border: 1px solid var(--rz-base-300, rgba(0, 0, 0, .12));
    border-radius: var(--rz-border-radius, 4px);
    margin: .5rem 0;
    padding: .25rem .75rem;
}

.ir-help-topic__fields > summary {
    cursor: pointer;
    font-weight: 600;
    padding: .25rem 0;
}

/* Help screenshots (Playwright capture, spec §8): fit the panel, open full size on click (interop.js). */
.ir-help-topic .rz-markdown img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--rz-base-300, rgba(0, 0, 0, .12));
    border-radius: var(--rz-border-radius, 4px);
    cursor: zoom-in;
}

/* HelpLink at the top of a dialog: its own row, right-aligned, kept tight (a float would narrow the
   erp-form-reflow grid next to it). */
.ir-help-link-corner {
    display: flex;
    justify-content: flex-end;
    margin: -0.5rem 0 -0.25rem;
}

/* --------------------------------------------------------------------------
   New version downloading / ready (App.razor, service-worker update script).
   Fixed in the empty middle of the header row, so both menu layouts show it
   without the menu overflow arithmetic measuring it; above dialogs, a document
   dialog may be open for an hour.
   -------------------------------------------------------------------------- */
.ir-app-update {
    position: fixed;
    top: .5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: .5rem;
    max-width: calc(100vw - 2rem);
    padding: .25rem .75rem;
    border-radius: 999px;
    background: var(--rz-info-lighter, #e3f2fd);
    color: var(--rz-on-info-lighter, #0d47a1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    font-size: .875rem;
    white-space: nowrap;
    cursor: default;
}

.ir-app-update[hidden],
.ir-app-update__apply[hidden] {
    display: none;
}

.ir-app-update[data-status="ready"] {
    background: var(--rz-success-lighter, #e8f5e9);
    color: var(--rz-on-success-lighter, #1b5e20);
}

.ir-app-update__icon {
    font-size: 1.25rem;
}

.ir-app-update[data-status="downloading"] .ir-app-update__icon,
.ir-app-update[data-status="applying"] .ir-app-update__icon {
    animation: ir-app-update-spin 1.5s linear infinite;
}

@keyframes ir-app-update-spin {
    to { transform: rotate(-360deg); }
}

.ir-app-update__text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ir-app-update__apply {
    border: 0;
    border-radius: 999px;
    padding: .125rem .75rem;
    background: var(--rz-success, #2e7d32);
    color: var(--rz-on-success, #fff);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* Phones: the header is full of buttons; sit at the bottom instead. */
@media (max-width: 767px) {
    .ir-app-update {
        top: auto;
        bottom: 1rem;
    }
}
