html, body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--mud-palette-background);
}

h1:focus {
    outline: none;
}

/* ---- App bar: degradê azul sobre a cor sólida do tema MudBlazor ---- */
.app-gradient-bar {
    background: linear-gradient(120deg, #173BAA 0%, #2456E8 55%, #0EA5E9 130%) !important;
}

.app-brand-icon {
    height: 34px;
    width: auto;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.app-brand {
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ---- Fase 2a: preferências de tema (topbar/menu), data-attributes gravados por MainLayout
   a partir do cookie acrm_theme — ver ThemePreferences.cs. "gradient"/"light" já são o
   default (.app-gradient-bar acima cobre o topbar), só "dark" precisa de override aqui. ---- */
.acrm-shell[data-topbar="light"] .mud-appbar {
    background: #FFFFFF !important;
    color: #1B2333 !important;
}

.acrm-shell[data-topbar="light"] .app-brand,
.acrm-shell[data-topbar="light"] .mud-appbar .mud-icon-root {
    color: #1B2333 !important;
}

.acrm-shell[data-topbar="dark"] .mud-appbar {
    background: #0B1E4B !important;
}

.acrm-shell[data-menu="dark"] .mud-drawer {
    background: #0B1E4B;
    color: #FFFFFF;
}

.acrm-shell[data-menu="dark"] .sidebar-section-label,
.acrm-shell[data-menu="dark"] .mud-text-secondary {
    color: rgba(255, 255, 255, 0.6) !important;
}

.acrm-shell[data-menu="brand"] .mud-drawer {
    background: #2456E8;
    color: #FFFFFF;
}

.acrm-shell[data-menu="brand"] .sidebar-section-label,
.acrm-shell[data-menu="brand"] .mud-text-secondary {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* ---- Sidebar: 3 tamanhos (Padrão/Compacto/Condensado) — ver SidebarNavItem.razor ---- */
.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-section-label {
    white-space: nowrap;
    overflow: hidden;
}

.acrm-shell[data-sidebar="compact"] .sidebar-section-label,
.acrm-shell[data-sidebar="condensed"] .sidebar-section-label {
    display: none;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    margin: 0.15rem 0.5rem;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease;
}

.sidebar-item:hover {
    background: rgba(36, 86, 232, 0.08);
}

.sidebar-item.active {
    background: rgba(36, 86, 232, 0.12);
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.sidebar-item-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.sidebar-item-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Compacto: ícone em cima, rótulo abreviado embaixo, empilhado e centralizado */
.sidebar-item-compact {
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.25rem;
    text-align: center;
}

.sidebar-item-compact .sidebar-item-label {
    font-size: 0.65rem;
    line-height: 1.1;
    max-width: 100%;
}

/* Condensado: só ícone, tooltip via CSS puro no hover (não MudTooltip — mantém o
   componente não-interativo, sem precisar de MudPopoverProvider) */
.sidebar-item-condensed {
    justify-content: center;
    padding: 0.6rem;
}

.sidebar-item-tooltip {
    position: absolute;
    left: calc(100% + 0.5rem);
    top: 50%;
    transform: translateY(-50%);
    background: #1B2333;
    color: #fff;
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 20;
}

.sidebar-item-condensed:hover .sidebar-item-tooltip {
    opacity: 1;
}

/* Grupo "Ajustes" (expansível em Padrão/Compacto, flyout em Condensado) */
.sidebar-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    margin: 0.1rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
}

.sidebar-group-header:hover {
    background: rgba(36, 86, 232, 0.08);
}

.sidebar-group.sidebar-item-compact .sidebar-group-header {
    flex-direction: column;
    gap: 0.15rem;
    text-align: center;
}

.sidebar-group.sidebar-item-compact .sidebar-group-header .sidebar-item-label {
    font-size: 0.65rem;
}

.sidebar-group-chevron {
    margin-left: auto;
}

.sidebar-group-items {
    display: flex;
    flex-direction: column;
    padding-left: 1.5rem;
}

/* Fase 14: o ativador do MudMenu agora é um MudIcon puro (ActivatorContent), não mais um
   MudIconButton com padding/ripple padrão — isso é o que fazia o ícone de engrenagem "saltar"
   visualmente em relação aos outros ícones simples do menu Condensado ao clicar. */
.sidebar-flyout-wrapper .mud-menu-activator {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-settings-flyout {
    min-width: 260px;
    max-height: 70vh;
    overflow-y: auto;
}

/* ---- Diálogo "Configurações do Tema" ---- */
.theme-option-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.theme-option-card {
    position: relative;
    width: 96px;
    padding: 0.75rem 0.5rem;
    border-radius: 12px !important;
    border: 1.5px solid var(--mud-palette-lines-default);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: border-color 0.12s ease;
}

.theme-option-card:hover {
    border-color: var(--mud-palette-primary-lighten);
}

.theme-option-card-selected {
    border-color: var(--mud-palette-primary);
}

.theme-option-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #fff;
    border-radius: 50%;
}

.theme-option-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
}

.theme-option-swatch {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--mud-palette-lines-default);
}

.theme-option-label {
    white-space: nowrap;
}

.mini-sidebar-preview {
    width: 48px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background-gray);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 6px;
}

.mini-sidebar-preview span {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: var(--mud-palette-primary);
}

.mini-sidebar-standard span { width: 100%; }
.mini-sidebar-compact span { width: 60%; }
.mini-sidebar-condensed span { width: 8px; }

/* ---- Login ---- */
.login-backdrop {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(circle at 20% 20%, #2E63F2 0%, #173BAA 45%, #0B1E4B 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2rem;
    border-radius: 16px !important;
}

.login-logo {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    margin: 0 auto 1.5rem;
}

.login-button {
    background: linear-gradient(90deg, #2456E8, #0EA5E9) !important;
}

/* ---- Dashboard KPI cards ---- */
.kpi-card {
    padding: 1.25rem;
    border-radius: 12px !important;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
}

/* ---- Blazor stock error UI ---- */
#blazor-error-ui {
    background: #D8394C;
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.9rem 1rem 0.9rem 1.2rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

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