h1:focus {
    outline: none;
}

html, body {
    font-family: Roboto, Helvetica, Arial, sans-serif;
    background: var(--trace-main-bg, #f7f8fb);
}

.trace-main {
    background: var(--trace-main-bg, #f7f8fb);
    min-height: 100vh;
    transition: background-color 160ms ease, color 160ms ease;
}

.trace-shell {
    --trace-main-bg: #f7f8fb;
    --trace-feature-border: #e3e7ef;
    --trace-empty-bg: #f8f9fa;
    --trace-empty-border: #d6d5d5;
    --trace-valid: #26b050;
    --trace-invalid: #e50790;
    --trace-error-ui-bg: #fff6bf;
    --trace-error-ui-text: #281d00;
    color-scheme: light;
}

.trace-dark-mode {
    --trace-main-bg: #0a0a0a;
    --trace-feature-border: #1a1a1a;
    --trace-empty-bg: #111111;
    --trace-empty-border: #2a2a2a;
    --trace-valid: #22c55e;
    --trace-invalid: #ef4444;
    --trace-error-ui-bg: #1c1c1c;
    --trace-error-ui-text: #ffe680;
    color-scheme: dark;
}

.trace-dark-mode .trace-appbar {
    border-bottom: 1px solid #e5bb00;
    box-shadow: 0 1px 0 rgba(255, 204, 0, 0.18);
}

.trace-dark-mode .trace-side-drawer {
    border-right: 1px solid #1a1a1a;
}

.trace-dark-mode .trace-feature,
.trace-dark-mode .mud-paper {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
}

.trace-dark-mode .mud-table-head .mud-table-cell {
    color: #ffe680;
}

.trace-dark-mode .mud-table-row:hover {
    background: rgba(255, 204, 0, 0.06);
}

.trace-dark-mode .mud-input-control .mud-input {
    background: #0d0d0d;
}

.trace-dark-mode .trace-mobile-nav {
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.46);
}

.trace-page-container {
    width: min(calc(100% - 6rem), 1600px);
}

.trace-env-badge {
    align-items: center;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 6px;
    color: #ffffff;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 700;
    height: 1.35rem;
    letter-spacing: 0;
    line-height: 1;
    margin-left: 0.75rem;
    padding: 0 0.5rem;
    white-space: nowrap;
}

.trace-dark-mode .trace-env-badge {
    background: #1c1c1c;
    border-color: #ffcc00;
    color: #ffe680;
}

.trace-version-badge {
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 600;
    height: 1.35rem;
    letter-spacing: 0;
    line-height: 1;
    margin-left: 0.5rem;
    max-width: 10rem;
    overflow: hidden;
    padding: 0 0.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trace-env-badge-dev {
    background: #7c4a03;
    border-color: #f2c86b;
}

.trace-env-badge-stg {
    background: #274472;
    border-color: #8fb7e8;
}

.trace-env-badge-prod {
    background: #195b3b;
    border-color: #87d8a4;
}

.trace-dark-mode .trace-env-badge-dev {
    background: #1c1c1c;
    border-color: #ffcc00;
    color: #ffe680;
}

.trace-dark-mode .trace-env-badge-stg {
    background: #101010;
    border-color: #4f9ef8;
    color: #cfe5ff;
}

.trace-dark-mode .trace-env-badge-prod {
    background: #101010;
    border-color: #22c55e;
    color: #bbf7d0;
}

.trace-feature {
    border: 1px solid var(--trace-feature-border, #e3e7ef);
    border-radius: 8px;
    height: 100%;
}

.trace-mobile-nav {
    display: none;
}

.auth-actions {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    min-width: 0;
}

.auth-profile-button,
.auth-login-button {
    align-items: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    gap: 0.4rem;
    min-height: 2.1rem;
    padding: 0.15rem 0.65rem 0.15rem 0.2rem;
    text-decoration: none;
    white-space: nowrap;
}

.trace-dark-mode .auth-profile-button,
.trace-dark-mode .auth-login-button {
    border-color: rgba(10, 10, 10, 0.36);
    color: #0a0a0a;
}

.trace-dark-mode .auth-profile-button:hover,
.trace-dark-mode .auth-login-button:hover {
    background: rgba(10, 10, 10, 0.08);
}

.auth-profile-button:disabled {
    opacity: 0.72;
}

.auth-avatar {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    color: #195b84;
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 800;
    height: 1.7rem;
    justify-content: center;
    letter-spacing: 0;
    min-width: 1.7rem;
    padding-inline: 0.25rem;
}

.trace-dark-mode .auth-avatar {
    background: #0a0a0a;
    color: #ffcc00;
}

.auth-action-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-heading h1 {
    margin-bottom: 0.25rem;
}

.empty-state {
    border: 1px solid var(--trace-empty-border, #d6d5d5);
    border-radius: 8px;
    padding: 1.25rem;
    background: var(--trace-empty-bg, #f8f9fa);
}

.empty-state h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

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

.invalid {
    outline: 1px solid var(--trace-invalid, #e50790);
}

.validation-message {
    color: var(--trace-invalid, #e50790);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveG1sIiBvdmVyZmxvdz0iaGlkZGVuIj48ZGVmcz48Y2xpcFBhdGggaWQ9ImNsaXAwIj48cmVjdCB4PSIyMzUiIHk9IjUxIiB3aWR0aD0iNTYiIGhlaWdodD0iNDkiLz48L2NsaXBQYXRoPjwvZGVmcz48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDApIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjM1IC01MSkiPjxwYXRoIGQ9Ik0yNjMuNTA2IDUxQzI2NC43MTcgNTEg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ny4zODcgOTIuMjgzNyAyNjcuMzg3IDg5Ljc5MjEgMjY3LjM4NyA4Ny4zMDA1IDI2Ni4xMTYgODYuMDU0NyAyNjMuNTc2IDg2LjA1NDdaIiBmaWxsPSIjRkZFNTAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L2c+PC9zdmc+) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

@media (max-width: 960px) {
    .trace-page-container {
        width: min(calc(100% - 2rem), 1600px);
    }
}

@media (max-width: 720px) {
    .trace-side-drawer,
    .mud-drawer.trace-side-drawer {
        display: none !important;
        width: 0 !important;
    }

    .trace-drawer-toggle {
        display: none !important;
    }

    .mud-layout,
    .mud-main-content,
    .trace-main {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
    }

    .trace-main {
        padding-bottom: 4.5rem;
    }

    .trace-page-container {
        width: min(calc(100% - 0.75rem), 1600px);
    }

    .trace-page-container.py-6 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .trace-page-container .mud-typography-h3 {
        font-size: 2rem;
        line-height: 1.15;
    }

    .trace-page-heading {
        align-items: stretch !important;
        flex-direction: column !important;
        gap: 0.65rem !important;
        width: 100%;
    }

    .trace-page-intro {
        width: 100%;
    }

    .trace-page-intro .mud-typography-body1 {
        max-width: 32rem;
    }

    .trace-page-actions {
        display: grid !important;
        gap: 0.45rem !important;
        grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
        width: 100%;
    }

    .trace-page-actions .mud-button-root {
        min-height: 2.55rem;
        padding-inline: 0.55rem;
        width: 100%;
    }

    .trace-page-actions .mud-button-label {
        font-size: 0.75rem;
        line-height: 1.15;
        white-space: normal;
    }

    .trace-page-actions .mud-button-icon-start {
        margin-left: 0;
        margin-right: 0.35rem;
    }

    .trace-page-container .mud-paper {
        overflow-x: auto;
    }

    .trace-page-container .mud-table {
        background: transparent;
    }

    .trace-page-container .mud-table-root {
        min-width: 0;
    }

    .trace-page-container .mud-table-head {
        display: none;
    }

    .trace-page-container .mud-table-body {
        display: grid;
        gap: 0.75rem;
    }

    .trace-page-container .mud-table-row {
        background: var(--mud-palette-surface, #ffffff);
        border: 1px solid var(--mud-palette-lines-default, #dce3ed);
        border-radius: 8px;
        display: grid;
        gap: 0;
        overflow: hidden;
        padding: 0.35rem 0;
    }

    .trace-page-container .mud-table-cell {
        align-items: flex-start;
        border-bottom: 1px solid var(--mud-palette-lines-default, #dce3ed);
        display: grid !important;
        gap: 0.5rem;
        grid-template-columns: minmax(6.25rem, 38%) minmax(0, 1fr);
        min-height: 2.5rem;
        padding: 0.55rem 0.8rem !important;
        text-align: left !important;
        white-space: normal;
        word-break: break-word;
    }

    .trace-page-container .mud-table-cell:last-child {
        border-bottom: 0;
    }

    .trace-page-container .mud-table-cell::before {
        color: var(--mud-palette-text-secondary, #526174);
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0;
        line-height: 1.25;
        padding-top: 0.12rem;
        text-transform: uppercase;
    }

    .trace-page-container .mud-table-cell[data-label="Actions"] {
        align-items: center;
        grid-template-columns: minmax(6.25rem, 38%) minmax(0, 1fr);
        min-height: 2.25rem;
    }

    .trace-page-container .mud-table-cell[data-label="Actions"] .mud-stack-row {
        justify-content: flex-end !important;
    }

    .trace-page-container .mud-table-cell .mud-typography-body2,
    .trace-page-container .mud-table-cell .mud-typography-caption {
        overflow-wrap: anywhere;
    }

    .trace-page-container .mud-table-cell .mud-chip {
        max-width: 100%;
    }

    .trace-page-container .mud-table-pagination {
        border-top: 0;
        flex-wrap: wrap;
        justify-content: center;
        padding-inline: 0;
    }

    .trace-env-badge,
    .trace-version-badge {
        height: 1.25rem;
        padding-inline: 0.4rem;
    }

    .trace-mobile-nav {
        align-items: center;
        background: var(--mud-palette-surface, #ffffff);
        border-top: 1px solid var(--mud-palette-lines-default, #dce3ed);
        bottom: 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.12);
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        left: 0;
        min-height: 4rem;
        padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
        position: fixed;
        right: 0;
        z-index: 1200;
    }

    .trace-mobile-nav a {
        align-items: center;
        color: var(--mud-palette-text-secondary, #526174);
        display: inline-flex;
        flex-direction: column;
        font-size: 0.72rem;
        font-weight: 600;
        gap: 0.15rem;
        letter-spacing: 0;
        min-width: 0;
        padding: 0.25rem;
        text-decoration: none;
    }

    .trace-mobile-nav a:focus,
    .trace-mobile-nav a:hover {
        color: var(--mud-palette-primary, #195b84);
    }

    .trace-mobile-nav span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .trace-appbar .auth-actions {
        flex: 0 0 auto;
        margin-left: 0;
        order: 0;
    }

    .trace-appbar .auth-status,
    .trace-appbar .auth-action-text {
        display: none;
    }

    .trace-appbar .auth-profile-button,
    .trace-appbar .auth-login-button {
        border: 0;
        min-height: 2rem;
        padding: 0;
    }

    .trace-appbar .auth-avatar {
        height: 2rem;
        min-width: 2rem;
    }
}

@media (max-width: 420px) {
    .trace-page-container .mud-typography-h3 {
        font-size: 1.7rem;
    }

    .trace-version-badge {
        max-width: 5.5rem;
    }

    .trace-page-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trace-page-container .mud-paper.pa-4 {
        padding: 0.75rem !important;
    }

    .trace-page-container .mud-table-cell {
        gap: 0.35rem;
        grid-template-columns: minmax(5.25rem, 34%) minmax(0, 1fr);
        padding-inline: 0.65rem !important;
    }

    .trace-page-container .mud-table-cell::before {
        font-size: 0.68rem;
    }
}
