html, body {
    font-family: Roboto !important;
}

/* ---------------------------------------------------------------------------
   Dark-mode alert contrast (WCAG AA)

   MudBlazor colours the Outlined and Text alert variants with
   --mud-palette-<severity>-darken, which it auto-derives by DARKENING the
   severity colour. That is correct on a light page and backwards on a dark
   one: against the dark background (#32333d) / paper (#373740) the derived
   values land near 2:1, well under the 4.5:1 minimum. (Info, for example,
   derives to #1868aa = 2.15:1.)

   We cannot simply reassign those palette variables, because MudBlazor also
   uses <severity>-darken as the hover/focus/active BACKGROUND of filled
   buttons, chips and FABs. Lightening them there would leave a white label on
   a pale fill (~2.3:1) every time a button is hovered.

   So the fix is scoped to the alert selectors only. Each replacement is a
   lightened version of the same hue, measured at >= 4.9:1 on dark paper and
   >= 5.2:1 on the dark background. .app-root carries the marker (rather than
   .page) so that alerts inside dialogs and snackbars are covered too.

   Light mode is untouched.
   --------------------------------------------------------------------------- */
.app-root {
    display: contents;
}

/* Contrast ratios below are new-colour vs #32333d (background) / #373740 (paper).
   Every replacement keeps the hue of the severity colour it stands in for. */

.app-root.dark-mode .mud-alert-outlined-info,
.app-root.dark-mode .mud-alert-text-info {
    color: #5CB0F2; /* 5.34:1 / 5.02:1  (was #1868aa, 2.15:1 / 2.01:1) */
}

.app-root.dark-mode .mud-alert-outlined-success,
.app-root.dark-mode .mud-alert-text-success {
    color: #45C443; /* 5.51:1 / 5.18:1 */
}

.app-root.dark-mode .mud-alert-outlined-warning,
.app-root.dark-mode .mud-alert-text-warning {
    color: #EE9A2E; /* 5.55:1 / 5.21:1 */
}

.app-root.dark-mode .mud-alert-outlined-error,
.app-root.dark-mode .mud-alert-text-error {
    color: #F58A7E; /* 5.26:1 / 4.95:1 */
}

.app-root.dark-mode .mud-alert-outlined-primary,
.app-root.dark-mode .mud-alert-text-primary {
    color: #A9A0F5; /* 5.39:1 / 5.07:1 */
}

.app-root.dark-mode .mud-alert-outlined-secondary,
.app-root.dark-mode .mud-alert-text-secondary {
    color: #F28CAE; /* 5.45:1 / 5.12:1 */
}

/* ---------------------------------------------------------------------------
   Same problem, second family of components.

   Outlined/Text chips, buttons and colour-tinted MudText paint their label
   straight from --mud-palette-<severity>, with no darken step. That is fine on
   a light page but leaves ~2.7:1 on the dark surfaces, so the same lightened
   values are applied here.

   Filled chips and filled buttons are deliberately excluded: there the
   severity colour is the BACKGROUND and the label uses <severity>ContrastText,
   which already passes.

   !important is required because MudBlazor's .mud-<severity>-text utility
   (used by MudText/MudIcon Color=) declares its colour !important.
   --------------------------------------------------------------------------- */

.app-root.dark-mode .mud-chip-outlined.mud-chip-color-info,
.app-root.dark-mode .mud-chip-text.mud-chip-color-info,
.app-root.dark-mode .mud-typography.mud-info-text,
.app-root.dark-mode .mud-button-outlined-info,
.app-root.dark-mode .mud-button-text-info {
    color: #5CB0F2 !important;
}

.app-root.dark-mode .mud-chip-outlined.mud-chip-color-success,
.app-root.dark-mode .mud-chip-text.mud-chip-color-success,
.app-root.dark-mode .mud-typography.mud-success-text,
.app-root.dark-mode .mud-button-outlined-success,
.app-root.dark-mode .mud-button-text-success {
    color: #45C443 !important;
}

.app-root.dark-mode .mud-chip-outlined.mud-chip-color-warning,
.app-root.dark-mode .mud-chip-text.mud-chip-color-warning,
.app-root.dark-mode .mud-typography.mud-warning-text,
.app-root.dark-mode .mud-button-outlined-warning,
.app-root.dark-mode .mud-button-text-warning {
    color: #EE9A2E !important;
}

.app-root.dark-mode .mud-chip-outlined.mud-chip-color-error,
.app-root.dark-mode .mud-chip-text.mud-chip-color-error,
.app-root.dark-mode .mud-typography.mud-error-text,
.app-root.dark-mode .mud-button-outlined-error,
.app-root.dark-mode .mud-button-text-error {
    color: #F58A7E !important;
}

.app-root.dark-mode .mud-chip-outlined.mud-chip-color-primary,
.app-root.dark-mode .mud-chip-text.mud-chip-color-primary,
.app-root.dark-mode .mud-typography.mud-primary-text,
.app-root.dark-mode .mud-button-outlined-primary,
.app-root.dark-mode .mud-button-text-primary {
    color: #A9A0F5 !important;
}

.app-root.dark-mode .mud-chip-outlined.mud-chip-color-secondary,
.app-root.dark-mode .mud-chip-text.mud-chip-color-secondary,
.app-root.dark-mode .mud-typography.mud-secondary-text,
.app-root.dark-mode .mud-button-outlined-secondary,
.app-root.dark-mode .mud-button-text-secondary {
    color: #F28CAE !important;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.code {
    font-family: "Courier New", Courier, monospace;
    font-size: 1.0rem;
}

.page-watermark,
.pageWatermark {
    position: fixed;
    top: 3.5rem;
    left: 0;
    width: 100vw;
    height: calc(100vh - 3.5rem);
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    user-select: none;
    z-index: 1100;
    opacity: 0.04;
}

@media (min-width: 641px) {
    .page-watermark,
    .pageWatermark {
        left: 250px;
        width: calc(100vw - 250px);
    }

    .page:has(.sidebar.collapsed) .page-watermark,
    .page:has(.sidebar.collapsed) .pageWatermark {
        left: 78px;
        width: calc(100vw - 78px);
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .page-watermark,
    .pageWatermark,
    .page:has(.sidebar.collapsed) .page-watermark,
    .page:has(.sidebar.collapsed) .pageWatermark {
        left: 0;
        width: 100vw;
    }
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

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

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbG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4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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: #929292;
}

.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;
}

.management-toggle {
    justify-content: flex-start;
    text-align: left;
    padding-left: 22px;
    width: 100%;
}

.mud-snackbar {
    font-size: 1.2rem;
}

/* Success toasts: a solid green strip vanished against the green survey header and the gold page
   header it pops up over, so success is a white card with a green edge and check instead. */
.mud-snackbar.mud-alert-filled-success {
    background-color: #ffffff;
    color: #1f2a1f;
    border-left: 6px solid #2e7d32;
}

    .mud-snackbar.mud-alert-filled-success .mud-snackbar-icon,
    .mud-snackbar.mud-alert-filled-success .mud-snackbar-content-action .mud-icon-root {
        color: #2e7d32;
    }

.app-root.dark-mode .mud-snackbar.mud-alert-filled-success {
    background-color: #2b2c34;
    color: #e6e6e6;
    border-left-color: #45C443;
}

    .app-root.dark-mode .mud-snackbar.mud-alert-filled-success .mud-snackbar-icon,
    .app-root.dark-mode .mud-snackbar.mud-alert-filled-success .mud-snackbar-content-action .mud-icon-root {
        color: #45C443;
    }

.active-filter-select {
    border-radius: 8px;
}

.active-filter-select .mud-input-control {
    background: linear-gradient(180deg, rgba(255, 244, 214, 0.95), rgba(255, 249, 235, 0.98));
    border-radius: 8px;
}

/* The cream fill is a light-mode cue. In dark mode it put the bright-gold active text (set per page)
   on a near-white field - most visibly on the survey's Observation Date picker - so dark mode gets a
   faint gold tint instead and the gold border carries the "active" signal. */
.dark-mode .active-filter-select .mud-input-control {
    background: rgba(255, 209, 102, 0.08);
}

.active-filter-select .mud-input-outlined-border,
.active-filter-select .mud-notched-outline {
    border-color: #d18b00 !important;
    border-width: 2px !important;
}

.active-filter-select .mud-input-label,
.active-filter-select .mud-select-input,
.active-filter-select .mud-select-value,
.active-filter-select .mud-select-adornment,
.active-filter-select .mud-input-adornment {
    color: #8a5a00 !important;
    font-weight: 700 !important;
}

.active-filter-select .mud-input-slot {
    border-radius: 8px;
}

.standalone-header {
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.section-header,
.standalone-header:not(.header-gradient-darkend) {
    background-color: rgba(255, 240, 240, 0.9);
    border: 1px solid rgba(244, 67, 54, 0.35);
    border-radius: 8px 8px 0 0;
}

.section-header .mud-alert {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.header-gradient-darkend {
    background-color: #5e5215 !important;
    border: 1px solid #5e5215;
    color: white !important;
}

.header-gradient-darkend .mud-typography,
.header-gradient-darkend .mud-icon-root {
    color: white !important;
}

.header-filter-icon {
    margin-top: 0.1rem;
}

/* Tooltips carry real content here -- the full wording of a standard behind its code chip, among
   other things -- and MudBlazor's default size is too small to read comfortably. Bumped site-wide,
   with a width cap so a long standard wraps instead of stretching across the screen. */
.mud-tooltip {
    /* MudBlazor's default is 12px, centered -- fine for a two-word hint, cramped for a sentence. */
    font-size: 0.875rem !important;
    line-height: 1.45 !important;
    text-align: left !important;
    padding: 0.5rem 0.75rem !important;
    max-width: 32rem !important;
}

/* Shared dialog/page header banner. Gradient is built from the current theme
   primary color (theme-aware: adapts in dark mode), dark at the top fading to
   light at the bottom. Defined once here and used by every dialog and the
   approval pages via class="gradient-title". */
.gradient-title {
    background-image: linear-gradient(180deg, var(--mud-palette-primary-darken) 0%, var(--mud-palette-primary) 55%, var(--mud-palette-primary-lighten) 100%);
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.55);
}
