h1:focus {
    outline: none;
}

/*
 * Loading screen. Global because it is used twice with the same look: as plain HTML in App.razor while the
 * WebAssembly app downloads, and as the <Authorizing> content of the router while the session is checked.
 * It cannot depend on the MudBlazor theme (MudThemeProvider lives in MainLayout, which is not rendered yet),
 * so the colors follow the operating system preference.
 */
.portal-carregando {
    --portal-carregando-fundo: #f5f5f5;
    --portal-carregando-texto: #1f2937;
    --portal-carregando-suave: #6b7280;
    --portal-carregando-trilho: rgba(80, 82, 186, 0.15);
    --portal-carregando-destaque: #5052ba;

    align-items: center;
    background: var(--portal-carregando-fundo);
    color: var(--portal-carregando-texto);
    display: flex;
    font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 2000;
}

@media (prefers-color-scheme: dark) {
    .portal-carregando {
        --portal-carregando-fundo: #111111;
        --portal-carregando-texto: #f3f4f6;
        --portal-carregando-suave: #9ca3af;
        --portal-carregando-trilho: rgba(1, 112, 243, 0.2);
        --portal-carregando-destaque: #0170f3;
    }
}

.portal-carregando__conteudo {
    align-items: center;
    animation: portal-carregando-entrada 0.4s ease-out both;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    text-align: center;
}

.portal-carregando__logo {
    height: 72px;
    max-width: 80vw;
    object-fit: contain;
}

.portal-carregando__titulo {
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.portal-carregando__barra {
    background: var(--portal-carregando-trilho);
    border-radius: 999px;
    height: 4px;
    overflow: hidden;
    position: relative;
    width: min(240px, 70vw);
}

.portal-carregando__barra > span {
    animation: portal-carregando-barra 1.4s ease-in-out infinite;
    background: var(--portal-carregando-destaque);
    border-radius: 999px;
    height: 100%;
    left: 0;
    position: absolute;
    width: 40%;
}

.portal-carregando__texto {
    color: var(--portal-carregando-suave);
    font-size: 0.875rem;
}

/* The static screen steps aside as soon as the app has rendered anything of its own after it (the router's own copy, the login, the layout) */
.portal-carregando--inicial:has(~ :not(script, link, style, template, [hidden])) {
    display: none;
}

@keyframes portal-carregando-barra {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(250%);
    }
}

@keyframes portal-carregando-entrada {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-carregando__conteudo,
    .portal-carregando__barra > span {
        animation: none;
    }

    .portal-carregando__barra > span {
        width: 60%;
    }
}

.blazor-error-boundary {
    padding: 1rem;
    color: white;
    background: #b32121;
}

.blazor-error-boundary::after {
    content: "Ocorreu um erro inesperado.";
}

/*
 * Sidebar: the menu scrolls on its own and the footer (© year, version) stays pinned to the bottom.
 * Global on purpose: a scoped "::deep" rule cannot match here because MainLayout renders the drawer
 * through MudBlazor components, so no ancestor carries the scope attribute.
 */
.portal-drawer .mud-drawer-content {
    min-height: 0;
    overflow: hidden;
}

.portal-drawer .portal-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.portal-drawer__footer {
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    justify-content: space-between;
    opacity: 0.7;
    padding: 0.75rem 1.25rem;
}
