body {
    font-family: var(--fontFamilyBase);
    font-size: var(--fontSizeBase300);
    line-height: var(--lineHeightBase300);
    margin: 0;
    color: var(--colorNeutralForeground1);
    background: var(--colorNeutralBackground1);
}

body[data-theme="dark"] {
    color-scheme: dark;
}

.body-content {
    align-self: stretch;
    height: 100% !important;
    min-height: 0;
    display: flex;
    overflow: auto;
}

.main-content {
    padding: 0.5rem 1.5rem;
    align-self: stretch !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.app-footer {
    display: flex;
    justify-content: center;
    background: var(--colorNeutralBackground4);
    color: var(--colorNeutralForeground1);
    align-items: center;
    height: 36px;
    min-height: 36px;
    padding: 0 12px;
    box-sizing: border-box;
}

.app-footer-text {
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase200);
    line-height: var(--lineHeightBase200);
    white-space: nowrap;
}

/* Card look for sections that must not use FluentCard: its containment clips
   autocomplete and select popups. */
.card-section {
    background: var(--colorNeutralBackground1);
    color: var(--colorNeutralForeground1);
    border: 1px solid var(--colorNeutralStroke2);
    border-radius: var(--borderRadiusMedium);
    box-shadow: var(--shadow4);
    padding: 12px 16px;
    box-sizing: border-box;
}

.text-success {
    color: var(--colorStatusSuccessForeground1);
}

.text-warning {
    color: var(--colorStatusWarningForeground1);
}

.text-danger {
    color: var(--colorStatusDangerForeground1);
}

.alert {
    border: 1px dashed var(--colorBrandBackground);
    padding: 5px;
}

.wide-autocomplete-popup {
    min-width: min(500px, 100%);
}

.wide-autocomplete-popup::part(control) {
    min-width: min(500px, 100%);
}

.wide-autocomplete-popup::part(listbox),
.wide-autocomplete-popup::part(positioning-region) {
    min-width: 500px;
    max-height: min(360px, 60vh);
    overflow-y: auto;
}

.wide-autocomplete-popup div[role="listbox"] {
    width: 500px !important;
    min-width: 500px !important;
    max-height: min(360px, 60vh) !important;
    overflow-y: auto !important;
    overflow-x: hidden;
}

.wide-autocomplete-popup div[role="listbox"] fluent-option {
    width: 100%;
    box-sizing: border-box;
}

.scroll-autocomplete-popup div[role="listbox"] {
    width: 420px !important;
    max-width: calc(100vw - 48px);
    max-height: min(360px, 60vh) !important;
    overflow-y: auto !important;
    overflow-x: hidden;
}

.scroll-autocomplete-popup div[role="listbox"] fluent-option {
    width: 100%;
    box-sizing: border-box;
}


#blazor-error-ui {
    background: var(--colorPaletteYellowBackground1);
    color: var(--colorNeutralForeground1);
    bottom: 0;
    box-shadow: var(--shadow4);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    margin: 20px 0;
}

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

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyN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    }

code {
    color: var(--colorPaletteBerryForeground1);
    font-family: var(--fontFamilyMonospace);
}

.app-header {
    background-color: var(--colorNeutralBackground1) !important;
    color: var(--colorNeutralForeground1) !important;
    border-bottom: 2px solid var(--colorNeutralStroke1);
    box-sizing: border-box;
    height: 50px;
    min-height: 50px;
    padding-block: 5px;
    box-shadow: var(--shadow4);
    border-bottom-color: transparent;
    border-image: linear-gradient(
        90deg,
        transparent 0%,
        #0f6cbd 15%,
        #7c3aed 42%,
        #06b6d4 68%,
        #f59e0b 88%,
        transparent 100%
    ) 1;
}

/* Fluent styles the hamburger for a brand-colored header; this header uses a neutral background. */
.app-header.fluent-layout-item[area=header] .fluent-layout-hamburger {
    fill: var(--colorNeutralForeground1);
    color: var(--colorNeutralForeground1);
    border-radius: var(--borderRadiusMedium);
}

/* The icon SVG carries the on-brand (white) fill itself, so the container fill is not enough. */
.app-header.fluent-layout-item[area=header] .fluent-layout-hamburger svg {
    fill: var(--colorNeutralForeground1) !important;
    color: var(--colorNeutralForeground1) !important;
}

.app-header.fluent-layout-item[area=header] .fluent-layout-hamburger:hover {
    background-color: var(--colorNeutralBackground1Hover);
}

/* The nav pane scrolls vertically; its scrollbar must not push the menu wide enough to scroll sideways. */
.fluent-layout-item[area=nav] {
    overflow-x: hidden;
}

.app-header-logo {
    display: block;
    width: 200px;
    height: 36px;
    object-fit: contain;
    object-position: left center;
    margin-right: 10px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-action-button {
    background: var(--colorNeutralBackground3) !important;
    color: var(--colorNeutralForeground1) !important;
}

/* Fluent UI v5 fields reserve internal space differently from v4. Keep labels
   outside the controls in mixed field/action rows so visible controls align. */
.ui-control-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
}

.ui-control-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ui-control-label {
    color: var(--colorNeutralForeground1);
    font-size: 12px;
    line-height: 16px;
}

/* Keep badge labels on one line and aligned with surrounding text. */
.fluent-badge {
    vertical-align: middle;
    white-space: nowrap;
}

/* Fluent UI 5.0.0 paints badge IconStart/IconEnd with an inline
   --colorNeutralForegroundOnBrand fill (white) for every appearance, so the
   icon disappears on the light Tint, Outline and Ghost badges. Follow the badge
   text color instead; !important is required to beat the inline style. */
fluent-badge:not([appearance="filled"]) > svg[slot] {
    fill: currentColor !important;
}

@media (max-width: 600px) {
    .ui-control-bar > .ui-control-field,
    .ui-control-bar > fluent-text-input,
    .ui-control-bar > fluent-select,
    .ui-control-bar > fluent-date-picker {
        width: 100%;
    }
}

/* Top toast area: fixed over the page so save confirmations are visible without scrolling. */
.top-message-bars {
    position: fixed;
    top: 64px;
    right: 24px;
    width: min(420px, calc(100vw - 32px));
    z-index: 1000;
    pointer-events: none;
}

.top-message-bars > * {
    pointer-events: auto;
}
