html, body {
    font-family: 'Figtree', 'Helvetica', 'Arial', sans-serif;
    margin: 0;
    max-width: 100%;
}

*, *::before, *::after {
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Taviraj', serif;
}

#blazor-error-ui {
    background: #b32121;
    padding: 1rem;
    color: white;
    position: fixed;
    bottom: 0;
    width: 100%;
    display: none;
}

#blazor-error-ui .reload {
    color: white;
    margin-left: 0.5rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 1rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

/* MudToggleItem is rendered inside MudBlazor, so its selected class must be
   styled globally rather than through MainLayout's isolated stylesheet. */
.environment-selector-selected {
    background-color: var(--mud-palette-warning) !important;
    color: #fff !important;
}

.environment-selector-selected .mud-button-label {
    color: #fff !important;
    font-weight: 700;
}

/* Keep intrinsically wide MudBlazor content from widening the document. */
.mud-layout,
.mud-main-content,
.mud-grid,
.mud-grid-item,
.mud-paper,
.mud-card,
.mud-table,
.mud-table-container,
.mud-dialog,
.mud-dialog-content,
.mud-input-control {
    min-width: 0;
    max-width: 100%;
}

.responsive-table-shell {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.wide-data-grid {
    min-width: 70rem;
}

.operations-data-grid {
    min-width: 73.75rem;
}

@media (max-width: 600px) {
    .mud-main-content {
        margin: 0.5rem !important;
    }

    .mobile-action-bar {
        align-items: stretch !important;
        display: grid !important;
        gap: 0.5rem !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .mobile-action-bar > * {
        min-width: 0;
        width: 100%;
    }

    .mobile-action-bar .mud-button-root {
        height: 100%;
        min-height: 44px;
        padding-inline: 0.5rem;
        width: 100%;
    }

    .mobile-section-header {
        align-items: flex-start !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    .mobile-form-row {
        align-items: stretch !important;
        flex-direction: column !important;
        width: 100%;
    }

    .mobile-form-row > * {
        min-width: 0;
        width: 100%;
    }

    .responsive-table-shell {
        overflow-x: hidden;
    }

    .wide-data-grid {
        min-width: 0 !important;
        width: 100%;
    }

    /* MudDataGrid changes rows into labelled lists below Breakpoint.Sm. Ensure
       both the generated labels and the values can shrink and wrap. */
    .mud-xs-table,
    .mud-xs-table .mud-table-container,
    .mud-xs-table .mud-table-body,
    .mud-xs-table .mud-table-row {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .mud-xs-table .mud-table-cell {
        align-items: flex-start;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-wrap: anywhere;
        white-space: normal !important;
        width: 100% !important;
        word-break: normal;
    }

    .mud-xs-table .mud-table-cell::before {
        flex: 0 0 min(40%, 9rem);
        min-width: 5.5rem;
        overflow-wrap: anywhere;
        padding-right: 0.75rem;
        white-space: normal;
    }

    .mud-xs-table .mud-table-cell > * {
        flex: 1 1 60%;
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .mud-xs-table .mud-table-pagination-toolbar {
        flex-wrap: wrap;
        height: auto;
        justify-content: flex-end;
        min-height: 52px;
    }

    .mud-dialog-container,
    .mud-dialog {
        max-width: calc(100vw - 1rem) !important;
    }

    .mud-dialog-content,
    .mud-dialog-actions {
        overflow-wrap: anywhere;
        padding-inline: 1rem;
    }

    .auth-action-button,
    .auth-action-button .mud-button-label {
        min-width: 0;
        white-space: nowrap;
    }
}

@media (max-width: 400px) {
    .auth-action-button .mud-button-label {
        font-size: 0.7rem;
    }
}
