/*
 * Estilos só do Vendas, carregados depois do template HyperGestor (ADR-0012). Os arquivos do hub
 * (hypergestor-*.css) não são editados: o que muda aqui sobrepõe eles.
 */

/* ===== Abas dos slideovers de cadastro (empresa, loja) =====
 * O template esconde o ícone e alinha as abas à esquerda; nos formulários em abas elas ficam
 * centralizadas e com ícone, para separar bem cada assunto. */
.hg-resource-page .fi-modal .fi-sc-tabs > .fi-tabs {
    display: flex;
    margin-inline: auto;
}

.hg-resource-page .fi-modal .fi-tabs-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.hg-resource-page .fi-modal .fi-tabs-item .fi-icon {
    display: inline-flex;
    width: 1rem;
    height: 1rem;
}

/* ===== Ícones no laranja da marca, em todos os painéis =====
 * Padrão do Vendas: ícone de aba e de botão dentro de campo (lupa do CNPJ e do CEP, "+" de criar opção, gerar senha)
 * nunca no cinza do Filament, que num traço fino de 16 px parece sujo. Vale em página, slideover e relation manager. */
.fi-tabs-item .fi-icon,
.fi-input-wrp-actions .fi-icon-btn .fi-icon,
.fi-input-wrp-prefix .fi-icon-btn .fi-icon {
    color: var(--hg-primary);
}

/* "X" que limpa os campos de busca: laranja da marca, no lugar da cor padrão do navegador. */
input[type='search']::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 0.75rem;
    height: 0.75rem;
    cursor: pointer;
    background-color: var(--hg-primary);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* "Entrar como cliente" na sidebar do admin (ADR-0010): resultados da busca, no estilo do campo do Pós-Vendas. */
.hg-sidebar-viewas__results {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 14rem;
    margin: 0;
    padding: 0.2rem;
    overflow-y: auto;
    list-style: none;
    border: 1px solid rgb(255 255 255 / 0.18);
    border-radius: 0.45rem;
    background: rgb(0 0 0 / 0.22);
}

.hg-sidebar-viewas__result {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    min-width: 0;
    padding: 0.35rem 0.45rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: #fff;
    text-align: left;
    cursor: pointer;
}

.hg-sidebar-viewas__result:hover,
.hg-sidebar-viewas__result:focus-visible {
    background: rgb(244 129 32 / 0.25);
    outline: none;
}

.hg-sidebar-viewas__result-name,
.hg-sidebar-viewas__result-meta {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hg-sidebar-viewas__result-name {
    font-size: 11px;
    font-weight: 600;
}

.hg-sidebar-viewas__result-meta,
.hg-sidebar-viewas__empty {
    font-size: 10px;
    color: rgb(255 255 255 / 0.6);
}

.hg-sidebar-viewas__empty {
    margin: 0;
    line-height: 1.35;
}

/* Topbar: foto do perfil dentro do círculo do avatar, e "Meu perfil" com o mesmo desenho do "Sair" do menu. */
.hg-topbar-avatar {
    overflow: hidden;
}

.hg-topbar-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hg-topbar-profile-link {
    color: var(--hg-foreground);
    text-decoration: none;
}

.hg-topbar-profile-link:hover {
    background: var(--hg-secondary);
}

/* Seção "aside" (título e descrição à esquerda, campos à direita, como no Meu perfil): só os campos ganham o cartão, como
 * no 3dcors; o título fica solto, sem a faixa de cabeçalho. Sem isso o cartão da seção engolia o título e o cartão dos
 * campos, e virava caixa dentro de caixa. */
.hg-resource-page .fi-section.fi-aside {
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.hg-resource-page .fi-section.fi-aside > .fi-section-header {
    padding: 0;
    border-bottom: 0;
    background: transparent;
}

.hg-resource-page .fi-section.fi-aside > .fi-section-content-ctn {
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius);
    background: var(--hg-card);
    box-shadow: none;
}

/* "Meu perfil" no menu do usuário: ícone no laranja da marca, como os outros ícones do Vendas. */
.hg-topbar-profile-link svg {
    color: var(--hg-primary);
}

/* Formulário em página (Meu perfil e o que vier): os mesmos campos dos slideovers (hg-label, hg-input, hg-field-hint),
 * que o template só aplica dentro de modal. */
.hg-resource-page .fi-fo-field-label-content {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hg-muted-foreground);
}

.hg-resource-page .fi-input-wrp {
    border-radius: calc(var(--hg-radius) - 2px);
    border: 1px solid var(--hg-input);
    background: var(--hg-card);
    box-shadow: none;
}

.hg-resource-page .fi-input-wrp:focus-within {
    outline: 2px solid color-mix(in srgb, var(--hg-primary) 30%, transparent);
    outline-offset: 1px;
}

.hg-resource-page .fi-input,
.hg-resource-page .fi-select-input {
    font-size: 0.875rem;
    color: var(--hg-foreground);
}

.hg-resource-page .fi-fo-field-wrp-helper-text {
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

/* Botões do Filament dentro das nossas páginas (o "Salvar" de cada bloco do Meu perfil e o que vier): hg-btn e
 * hg-btn-primary, como os do rodapé dos slideovers, que o template só pinta dentro de modal. */
.hg-resource-page .fi-btn {
    height: 2.25rem;
    padding: 0 0.875rem;
    border-radius: calc(var(--hg-radius) - 2px);
    border: 1px solid var(--hg-border);
    background: var(--hg-card);
    color: var(--hg-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: none;
}

.hg-resource-page .fi-btn:hover {
    background: var(--hg-muted);
}

.hg-resource-page .fi-btn.fi-color-primary,
.hg-resource-page .fi-btn.fi-color-warning,
.hg-resource-page .fi-btn.fi-color-success {
    background: var(--hg-primary);
    border-color: var(--hg-primary);
    color: var(--hg-primary-foreground);
    font-weight: 600;
}

.hg-resource-page .fi-btn.fi-color-primary:hover,
.hg-resource-page .fi-btn.fi-color-warning:hover,
.hg-resource-page .fi-btn.fi-color-success:hover {
    background: var(--hg-primary-hover);
    border-color: var(--hg-primary-hover);
}

.hg-resource-page .fi-btn.fi-color-danger {
    background: var(--hg-destructive);
    border-color: var(--hg-destructive);
    color: var(--hg-destructive-foreground);
    font-weight: 600;
}

.hg-resource-page .fi-btn .fi-icon {
    color: currentColor;
}

/* Links de ação do Filament nas nossas páginas ("Configurar" do MFA no Meu perfil e o que vier): o laranja da marca,
 * texto e ícone, no lugar do tom escuro que o Filament usa. */
.hg-resource-page .fi-link,
.hg-resource-page .fi-link .fi-icon {
    color: var(--hg-primary);
}

.hg-resource-page .fi-link:hover {
    color: var(--hg-primary-hover);
}

/* Telas de acesso no desenho do login (x-hg.auth-card): link discreto no pé do cartão (Sair, voltar ao login) e o
 * "Esqueci a senha" do login. */
.hg-auth-card-footer {
    margin-top: 1rem;
    text-align: center;
}

.hg-auth-card-link {
    border: 0;
    background: transparent;
    color: rgb(255 255 255 / 0.6);
    font-size: 0.8125rem;
    text-decoration: none;
    cursor: pointer;
}

.hg-auth-card-link:hover {
    color: var(--hg-primary);
}

/* Botão do formulário nas telas de acesso próprias (troca obrigatória): o mesmo respiro do login. */
form.hg-login-form > .hg-login-submit {
    width: 100%;
    margin-top: 1.25rem;
}

/* Formulário em página própria (Conexão com o HUB): o Salvar à direita, depois das seções. */
.hg-page-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hg-page-form-actions {
    display: flex;
    justify-content: flex-end;
}

/* Importação de usuários (ADR-0030): etapas ligadas por uma linha, um cartão de situação (ícone, título, progresso ao
 * vivo e totais numa faixa só, com a cor da situação na borda) e as linhas da planilha num cartão. Tudo nos tokens do
 * template; a cor de cada situação vem dos status do template (sucesso, aviso, informação) e do destrutivo. */
.hg-import {
    --hg-import-tone: var(--hg-primary);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hg-import-steps {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
    color: var(--hg-muted-foreground);
}

.hg-import-step {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.hg-import-step:last-child {
    flex: 0 0 auto;
}

/* A linha que liga uma etapa à próxima: laranja quando a etapa já foi feita. */
.hg-import-step:not(:last-child)::after {
    content: '';
    flex: 1 1 auto;
    height: 2px;
    margin: 0 0.75rem;
    border-radius: 9999px;
    background: var(--hg-border);
}

.hg-import-step.is-done:not(:last-child)::after {
    background: var(--hg-primary);
}

.hg-import-step-label {
    white-space: nowrap;
}

.hg-import-step-number {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    border: 1.5px solid var(--hg-border);
    background: var(--hg-card);
    font-size: 0.75rem;
    font-weight: 600;
}

.hg-import-step-check {
    width: 0.875rem;
    height: 0.875rem;
}

.hg-import-step.is-done {
    color: var(--hg-foreground);
}

.hg-import-step.is-done .hg-import-step-number {
    border-color: var(--hg-primary);
    background: color-mix(in oklch, var(--hg-primary) 10%, transparent);
    color: var(--hg-primary);
}

.hg-import-step.is-current {
    color: var(--hg-foreground);
    font-weight: 600;
}

.hg-import-step.is-current .hg-import-step-number {
    border-color: var(--hg-primary);
    background: var(--hg-primary);
    color: var(--hg-primary-foreground);
    box-shadow: 0 0 0 4px color-mix(in oklch, var(--hg-primary) 18%, transparent);
}

/* Cartão da situação. */
.hg-import-status {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    border-left: 4px solid var(--hg-import-tone);
}

.hg-import-status--info {
    --hg-import-tone: var(--hg-status-confirmado);
}

.hg-import-status--success {
    --hg-import-tone: var(--hg-status-compareceu);
}

.hg-import-status--warning {
    --hg-import-tone: var(--hg-status-agendado);
}

.hg-import-status--danger {
    --hg-import-tone: var(--hg-destructive);
}

.hg-import-status-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}

.hg-import-status-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--hg-radius-md);
    background: color-mix(in oklch, var(--hg-import-tone) 12%, transparent);
    color: var(--hg-import-tone);
}

.hg-import-status-icon-svg {
    width: 1.5rem;
    height: 1.5rem;
}

.hg-import-spin {
    animation: hg-import-spin 1s linear infinite;
}

@keyframes hg-import-spin {
    to {
        transform: rotate(360deg);
    }
}

.hg-import-status-text {
    flex: 1 1 20rem;
    min-width: 0;
}

.hg-import-status-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--hg-foreground);
}

.hg-import-status-description {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: var(--hg-muted-foreground);
}

.hg-import-status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
}

/* "Ao vivo": o andamento chega pelo Soketi. */
.hg-import-live {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: color-mix(in oklch, var(--hg-import-tone) 12%, transparent);
    color: var(--hg-import-tone);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hg-import-live::before {
    content: '';
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 9999px;
    background: currentColor;
    animation: hg-import-pulse 1.4s ease-in-out infinite;
}

@keyframes hg-import-pulse {
    50% {
        opacity: 0.3;
    }
}

.hg-import-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hg-import-progress .hg-progress-bar {
    transition: width 0.4s ease;
}

/* Totais numa faixa: cada número separado por uma linha fina, e quebra em telas estreitas. */
.hg-import-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    margin: 0;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius-md);
    overflow: hidden;
}

.hg-import-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
    box-shadow: -1px 0 0 var(--hg-border);
}

.hg-import-stat dt {
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

.hg-import-stat dd {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--hg-foreground);
    font-variant-numeric: tabular-nums;
}

.hg-import-stat--primary dd {
    color: var(--hg-primary);
}

.hg-import-stat--danger dd {
    color: var(--hg-destructive);
}

.hg-import-seats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--hg-muted-foreground);
}

.hg-import-seats.is-exceeded {
    color: var(--hg-destructive);
    font-weight: 500;
}

.hg-import-seats-icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

/* Linhas da planilha num cartão, com a contagem em cada aba do filtro. */
.hg-import-rows {
    overflow: hidden;
}

.hg-import-rows .hg-list-toolbar {
    padding: 1rem 1.25rem;
}

.hg-import-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    margin-left: 0.375rem;
    padding: 0 0.375rem;
    border-radius: 9999px;
    background: color-mix(in oklch, var(--hg-muted-foreground) 14%, transparent);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.375rem;
}

.hg-tab.is-active .hg-import-tab-count {
    background: color-mix(in oklch, var(--hg-primary) 14%, transparent);
    color: var(--hg-primary);
}

.hg-import-row-number {
    width: 5rem;
    color: var(--hg-muted-foreground);
}

.hg-import-rows-limited {
    margin: 0;
    padding: 0.75rem 1.25rem;
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

@media (max-width: 640px) {
    .hg-import-step-label {
        display: none;
    }

    .hg-import-step.is-current .hg-import-step-label {
        display: inline;
    }
}

/* Passo a passo numerado dentro do Callout do slideover de envio da planilha. */
.hg-import-howto {
    margin: 0.25rem 0 0;
    padding-left: 1.25rem;
    list-style: decimal;
}

.hg-import-howto li + li {
    margin-top: 0.25rem;
}

/* Regra global: toda linha de tabela (hg-table) ganha o laranja leve da marca no hover, no lugar do cinza do template.
 * A que abre o detalhe ao clicar (empresas, lojas) leva também o cursor de mão. */
.hg-table tbody tr:hover,
.hg-table tbody tr.hg-table-row--clickable:hover {
    background: color-mix(in oklch, var(--hg-primary) 5%, transparent);
}

.hg-table tr.hg-table-row--clickable {
    cursor: pointer;
}

/* Ícone antes do texto nos botões de ação (lápis do Editar, importar, testar). */
.hg-btn .hg-btn-leading-icon {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

/* Editar na linha da tabela: texto, contorno e lápis no laranja da marca. */
.hg-btn.hg-btn--brand {
    color: var(--hg-primary);
    border-color: color-mix(in oklch, var(--hg-primary) 45%, transparent);
}

.hg-btn.hg-btn--brand:hover {
    background: color-mix(in oklch, var(--hg-primary) 8%, transparent);
}

/* "Mais ações": laranja claro de fundo, para se distinguir do Editar sem disputar com o "+ Novo". */
.hg-btn.hg-row-actions-more {
    color: var(--hg-primary);
    border-color: transparent;
    background: color-mix(in oklch, var(--hg-primary) 12%, transparent);
}

.hg-btn.hg-row-actions-more {
    transition: none;
}

.hg-btn.hg-row-actions-more:hover,
.hg-btn.hg-row-actions-more[aria-expanded="true"] {
    background: color-mix(in oklch, var(--hg-primary) 20%, transparent);
}

/* Menu "Mais ações" (hg-dropdown do template): posição fixa vinda do botão, alinhado pela direita dele; com .is-up,
 * abre para cima. Itens em linha, só texto, com a cor da ação. */
.hg-dropdown-menu.hg-row-actions-menu {
    animation: none;
    transition: none;
    position: fixed;
    right: auto;
    min-width: 14rem;
    z-index: 60;
    transform: translateX(-100%);
}

.hg-dropdown-menu.hg-row-actions-menu.is-up {
    transform: translate(-100%, -100%);
}

.hg-row-actions-menu .hg-dropdown-item {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    font-size: 0.8125rem;
    cursor: pointer;
}

/* Hover de item de menu (padrão do Vendas): fundo laranja claro e texto laranja, como as abas de informação. */
.hg-row-actions-menu .hg-dropdown-item:hover {
    background: color-mix(in oklch, var(--hg-primary) 6%, transparent);
    color: var(--hg-primary);
}

.hg-row-actions-menu .hg-dropdown-item--success {
    color: var(--hg-status-compareceu);
}

.hg-row-actions-menu .hg-dropdown-item--warning {
    color: var(--hg-primary);
}

/* Aba Feriados da empresa (ADR-0031): cada feriado do dia numa linha (nome, selo nacional/regional, editar e excluir do
 * regional) e cada loja com o que faz no dia. */
.hg-holiday-name,
.hg-holiday-store {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.hg-holiday-name + .hg-holiday-name,
.hg-holiday-store + .hg-holiday-store {
    margin-top: 0.25rem;
}

.hg-holiday-actions {
    display: inline-flex;
    gap: 0.25rem;
}

/* Resumo do detalhe da empresa: identidade à esquerda, números à direita (quebra para baixo em tela estreita). */
.hg-company-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.hg-company-summary-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.hg-company-summary-logo {
    width: 3.5rem;
    height: 3.5rem;
    flex-shrink: 0;
    border-radius: var(--hg-radius);
    border: 1px solid var(--hg-border);
    object-fit: contain;
    background: var(--hg-card);
}

.hg-company-summary-logo--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hg-primary);
    background: color-mix(in oklch, var(--hg-primary) 8%, transparent);
}

.hg-company-summary-logo--empty svg {
    width: 1.5rem;
    height: 1.5rem;
}

.hg-company-summary-name {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.hg-company-summary-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--hg-foreground);
}

.hg-company-summary-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hg-company-summary-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 8.5rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--hg-radius);
    border: 1px solid var(--hg-border);
}

.hg-company-summary-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--hg-foreground);
}

/* ===== Abas de informação em dois cartões soltos (detalhe da empresa) =====
 * O template transforma toda barra de abas de página no trilho cinza (hg-tabs), o mesmo da navegação das abas do
 * detalhe (Lojas, Usuários…). As abas de informação (`->vertical()->extraAttributes(['class' => 'hg-info-tabs'])`)
 * viram dois cartões soltos, com sombra leve: o menu à esquerda (ícone laranja, a ativa em laranja claro) e o conteúdo
 * da aba à direita, com os campos no formato normal do infolist. Os dois têm sempre a mesma altura (a do maior, em geral
 * o menu, então trocar de aba não faz a tela pular), sem rolagem. Em tela estreita, as abas vão para cima. */
.hg-resource-page .hg-info-tabs.fi-sc-tabs {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 1.25rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.hg-resource-page .hg-info-tabs .fi-tabs {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 15rem;
    max-width: none;
    height: auto;
    gap: 0.125rem;
    padding: 0.5rem;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius);
    background: var(--hg-card);
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.06), 0 1px 2px rgb(15 23 42 / 0.04);
    overflow: visible;
}

.hg-resource-page .hg-info-tabs .fi-tabs-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: calc(var(--hg-radius) - 4px);
    background: transparent;
    box-shadow: none;
}

.hg-resource-page .hg-info-tabs .fi-tabs-item .fi-icon {
    display: inline-flex;
    width: 1rem;
    height: 1rem;
}

.hg-resource-page .hg-info-tabs .fi-tabs-item:hover {
    background: color-mix(in oklch, var(--hg-primary) 6%, transparent);
}

.hg-resource-page .hg-info-tabs .fi-tabs-item:hover .fi-tabs-item-label {
    color: var(--hg-primary);
}

.hg-resource-page .hg-info-tabs .fi-tabs-item.fi-active {
    background: color-mix(in oklch, var(--hg-primary) 12%, transparent);
    box-shadow: none;
}

.hg-resource-page .hg-info-tabs .fi-tabs-item.fi-active .fi-tabs-item-label {
    color: var(--hg-primary);
    font-weight: 600;
}

/* O conteúdo da aba: um cartão só, solto ao lado do menu, com os campos no formato normal do infolist. */
.hg-resource-page .hg-info-tabs .fi-sc-tabs-tab,
.hg-resource-page .hg-info-tabs .fi-sc-tabs-tab.fi-active {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius);
    background: var(--hg-card);
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.06), 0 1px 2px rgb(15 23 42 / 0.04);
    overflow: visible;
}

@media (max-width: 767px) {
    .hg-resource-page .hg-info-tabs.fi-sc-tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .hg-resource-page .hg-info-tabs .fi-tabs {
        flex-direction: row;
        width: 100%;
        overflow: auto hidden;
    }

    .hg-resource-page .hg-info-tabs .fi-tabs-item {
        width: auto;
        white-space: nowrap;
    }

    .hg-resource-page .hg-info-tabs .fi-sc-tabs-tab,
    .hg-resource-page .hg-info-tabs .fi-sc-tabs-tab.fi-active {
        min-height: 0;
    }
}

/* Contagem numa coluna de tabela (<x-hg.count>): coluna centralizada e o número num badge laranja com largura mínima,
 * para 2 e 120 ficarem do mesmo tamanho visual. */
.hg-table th.hg-table-cell-count,
.hg-table td.hg-table-cell-count {
    text-align: center;
}

.hg-badge.hg-count-badge {
    justify-content: center;
    min-width: 2.25rem;
    font-variant-numeric: tabular-nums;
}

/* ===== Abas do detalhe da empresa (ViewCompany, filament/admin/companies/sections) =====
 * Cartão centralizado no visual das abas de informação (hg-info-tabs): ícone laranja, hover em laranja claro e a aba
 * ativa com fundo laranja claro, texto laranja e negrito. No fim, o "Mais opções" (exceções, auditoria, acessos do
 * suporte), ativo quando uma das abas dele está aberta (o nome do botão não muda). O menu abre embaixo, alinhado à
 * esquerda do botão, sem animação, e cada item traz o ícone e a explicação da aba embaixo do nome. */
.hg-company-sections {
    display: flex;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.hg-company-sections-tabs.hg-tabs {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.125rem;
    max-width: 100%;
    padding: 0.375rem;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius);
    background: var(--hg-card);
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.06), 0 1px 2px rgb(15 23 42 / 0.04);
}

.hg-company-sections-tabs .hg-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: calc(var(--hg-radius) - 4px);
    background: transparent;
    box-shadow: none;
    color: var(--hg-muted-foreground);
    font-weight: 500;
}

.hg-company-sections-tabs .hg-tab:hover {
    background: color-mix(in oklch, var(--hg-primary) 6%, transparent);
    color: var(--hg-primary);
}

.hg-company-sections-tabs .hg-tab.is-active {
    background: color-mix(in oklch, var(--hg-primary) 12%, transparent);
    box-shadow: none;
    color: var(--hg-primary);
    font-weight: 600;
}

.hg-company-sections-tabs .hg-tab:disabled {
    cursor: wait;
}

/* Ícone de cada aba, em laranja (regra do projeto para ícone de aba), também no menu. */
.hg-company-sections .hg-company-sections-icon,
.hg-company-sections .hg-company-sections-more-icon {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    color: var(--hg-primary);
}

.hg-dropdown-menu.hg-company-sections-menu {
    left: 0;
    right: auto;
    top: calc(100% + 6px);
    width: 22rem;
    max-width: calc(100vw - 2rem);
    z-index: 30;
    animation: none;
    transition: none;
}

.hg-company-sections-menu .hg-dropdown-item {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.125rem;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.hg-company-sections-menu-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* Explicação alinhada com o nome, depois do ícone. */
.hg-company-sections-menu .hg-company-sections-menu-hint {
    padding-left: 1.5rem;
}

.hg-company-sections-menu .hg-dropdown-item small {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--hg-muted-foreground);
}

.hg-company-sections-menu .hg-dropdown-item:hover,
.hg-company-sections-menu .hg-dropdown-item.is-active {
    background: color-mix(in oklch, var(--hg-primary) 6%, transparent);
    color: var(--hg-primary);
}

/* Faixa de filtros das listas (toolbar com `filters: true`): o formulário de filtros do próprio Filament, ao vivo, logo
 * abaixo da busca, no mesmo fundo da toolbar, com o "Limpar filtros" à direita quando há filtro ligado. */
.hg-list-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1rem 1rem;
    background: color-mix(in oklch, var(--hg-muted) 35%, transparent);
    border-bottom: 1px solid var(--hg-border);
}

.hg-list-filters-form {
    flex: 1 1 40rem;
    min-width: 0;
}

.hg-list-filters-form .fi-fo-field-label-content {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hg-muted-foreground);
}

.hg-list-filters-reset {
    flex-shrink: 0;
}

/* Papéis da empresa (aba Papéis): quantas permissões do catálogo o papel tem, com a barra na cor da marca. */
.hg-role-permissions {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 10rem;
    max-width: 16rem;
}

.hg-role-permissions-count {
    font-size: 0.8125rem;
    color: var(--hg-foreground);
}

.hg-role-permissions-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--hg-primary), color-mix(in oklch, var(--hg-primary) 55%, white));
}

/* ===== Editor de papéis (RolePermissionsFields + RoleSummary, ADR-0017/ADR-0041) =====
 * Resumo do papel no topo; barra com busca, contador e marcar/limpar; uma lista por assunto (cartão com ícone, contador e
 * liga/desliga do grupo); cada permissão é um item clicável com o que libera, laranja quando ligado. Só tokens. */
.hg-role-summary {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border: 1px solid color-mix(in oklch, var(--hg-primary) 25%, var(--hg-border));
    border-radius: var(--hg-radius);
    background: linear-gradient(135deg, color-mix(in oklch, var(--hg-primary) 7%, var(--hg-card)), var(--hg-card) 70%);
}

.hg-role-summary-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--hg-radius-md);
    background: linear-gradient(135deg, var(--hg-primary), var(--hg-primary-hover));
    color: var(--hg-primary-foreground);
    box-shadow: 0 8px 16px -8px color-mix(in oklch, var(--hg-primary) 80%, transparent);
}

.hg-role-summary-svg {
    width: 1.25rem;
    height: 1.25rem;
    color: inherit;
}

.hg-role-summary-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.hg-role-summary-text strong {
    font-size: 1rem;
    color: var(--hg-foreground);
}

.hg-role-summary-text span {
    font-size: 0.8125rem;
    color: var(--hg-muted-foreground);
}

.hg-perm {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.hg-perm-toolbar {
    position: sticky;
    top: -1.5rem;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    background: var(--hg-card);
}

.hg-perm-search {
    flex: 1 1 14rem;
}

.hg-perm-total {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--hg-primary);
    white-space: nowrap;
}

.hg-perm-bulk {
    display: flex;
    gap: 0.5rem;
}

.hg-perm-groups {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hg-perm-group {
    overflow: hidden;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius);
    background: var(--hg-card);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    animation: hg-stat-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    animation-delay: calc(var(--hg-perm-index, 0) * 40ms);
}

.hg-perm-group.is-full,
.hg-perm-group.is-partial {
    border-color: color-mix(in oklch, var(--hg-primary) 35%, var(--hg-border));
}

.hg-perm-group-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--hg-border);
    background: color-mix(in oklch, var(--hg-muted) 35%, transparent);
}

.hg-perm-group-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--hg-radius-md);
    background: color-mix(in oklch, var(--hg-primary) 12%, transparent);
    color: var(--hg-primary);
}

.hg-perm-group-svg {
    width: 1.125rem;
    height: 1.125rem;
    color: inherit;
}

.hg-perm-group-title {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.hg-perm-group-title strong {
    font-size: 0.875rem;
    color: var(--hg-foreground);
}

.hg-perm-group-title span {
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

/* Liga/desliga do grupo: cheio = todas, meio = algumas. */
.hg-perm-group-switch {
    position: relative;
    flex-shrink: 0;
    width: 2.5rem;
    height: 1.375rem;
    border: 0;
    border-radius: 9999px;
    background: var(--hg-muted);
    cursor: pointer;
    transition: background 0.2s ease;
}

.hg-perm-group-switch.is-partial {
    /* Em srgb: em oklch a mistura com o cinza gira o tom e o laranja sai rosado. */
    background: color-mix(in srgb, var(--hg-primary) 45%, white);
}

.hg-perm-group-switch.is-on {
    background: var(--hg-primary);
}

.hg-perm-group-switch-knob {
    position: absolute;
    top: 0.1875rem;
    left: 0.1875rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
    transition: transform 0.2s ease;
}

.hg-perm-group-switch.is-partial .hg-perm-group-switch-knob {
    transform: translateX(0.5625rem);
}

.hg-perm-group-switch.is-on .hg-perm-group-switch-knob {
    transform: translateX(1.125rem);
}

.hg-perm-items {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
}

@media (min-width: 768px) {
    .hg-perm-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.hg-perm-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius-md);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.hg-perm-item:hover:not(.is-blocked):not(.is-readonly) {
    border-color: color-mix(in oklch, var(--hg-primary) 45%, var(--hg-border));
    transform: translateY(-1px);
}

.hg-perm-item.is-on {
    border-color: color-mix(in oklch, var(--hg-primary) 55%, var(--hg-border));
    background: color-mix(in oklch, var(--hg-primary) 7%, transparent);
}

.hg-perm-item.is-blocked {
    cursor: not-allowed;
    opacity: 0.6;
}

.hg-perm-item.is-readonly {
    cursor: default;
}

.hg-perm-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.hg-perm-input:focus-visible + .hg-perm-check {
    outline: 2px solid var(--hg-ring);
    outline-offset: 2px;
}

.hg-perm-check {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.0625rem;
    border: 1.5px solid var(--hg-border);
    border-radius: 0.3rem;
    background: var(--hg-card);
    color: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.hg-perm-item.is-on .hg-perm-check {
    border-color: var(--hg-primary);
    background: var(--hg-primary);
    color: var(--hg-primary-foreground);
}

.hg-perm-check-svg {
    width: 0.8rem;
    height: 0.8rem;
    color: inherit;
}

.hg-perm-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.hg-perm-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--hg-foreground);
}

.hg-perm-description {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--hg-muted-foreground);
}

.hg-perm-description--blocked {
    color: var(--hg-destructive);
}

.hg-perm-empty {
    margin: 0;
    padding: 1rem;
    font-size: 0.8125rem;
    text-align: center;
    color: var(--hg-muted-foreground);
}

/* ===== Indicadores (widgets): <x-hg.stat-card> e companhia (.ai/rules/widgets.md) =====
 * Cartão branco do template com o laranja da marca no que chama o olho: o bloco do ícone em degradê, o filete do topo
 * que se estende no hover, o brilho no canto e o gráfico na base (curva, anel ou barras). Tudo entra em sequência ao
 * abrir (cartão, número, gráfico); com "reduzir movimento", aparece pronto. Só tokens do template. */
.hg-stat-widget {
    margin-bottom: 0.25rem;
}

.hg-stat-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .hg-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .hg-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.hg-stat-card {
    --hg-stat-glow: color-mix(in oklch, var(--hg-primary) 14%, transparent);
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    overflow: hidden;
    padding: 1rem 1.125rem 0;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius);
    background: var(--hg-card);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
    transition:
        transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.3s ease,
        border-color 0.3s ease;
    animation: hg-stat-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    animation-delay: calc(var(--hg-stat-index, 0) * 80ms);
}

/* Brilho laranja no canto de baixo, por trás do gráfico. */
.hg-stat-card::before {
    content: '';
    position: absolute;
    right: -25%;
    bottom: -55%;
    z-index: -1;
    width: 75%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--hg-stat-glow), transparent);
    opacity: 0.7;
    transition:
        transform 0.5s ease,
        opacity 0.5s ease;
}

/* Filete da marca no topo: um quarto parado, a largura toda no hover. */
.hg-stat-card::after {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--hg-primary), color-mix(in oklch, var(--hg-primary) 25%, transparent));
    transform: scaleX(0.25);
    transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hg-stat-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in oklch, var(--hg-primary) 35%, var(--hg-border));
    box-shadow: 0 16px 32px -16px color-mix(in oklch, var(--hg-primary) 45%, transparent);
}

.hg-stat-card:hover::before {
    transform: scale(1.2);
    opacity: 1;
}

.hg-stat-card:hover::after {
    transform: scaleX(1);
}

.hg-stat-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hg-stat-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--hg-radius-md);
    background: linear-gradient(135deg, var(--hg-primary), var(--hg-primary-hover));
    color: var(--hg-primary-foreground);
    box-shadow:
        0 8px 16px -8px color-mix(in oklch, var(--hg-primary) 80%, transparent),
        inset 0 1px 0 rgb(255 255 255 / 0.3);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hg-stat-card:hover .hg-stat-icon {
    transform: rotate(-6deg) scale(1.06);
}

.hg-stat-icon-svg {
    width: 1.25rem;
    height: 1.25rem;
    color: inherit;
}

.hg-stat-label {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hg-muted-foreground);
}

.hg-stat-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.hg-stat-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 0.625rem;
    min-width: 0;
}

.hg-stat-value {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
    color: var(--hg-foreground);
}

.hg-stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem 0.125rem 0.375rem;
    border-radius: 999px;
    background: var(--hg-muted);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hg-muted-foreground);
    white-space: nowrap;
}

.hg-stat-delta--up {
    background: var(--hg-status-compareceu-bg);
    color: var(--hg-status-compareceu);
}

.hg-stat-delta-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.hg-stat-foot {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--hg-muted-foreground);
}

/* O gráfico fica colado na base, ocupando a largura toda do cartão. */
.hg-stat-visual {
    margin: auto -1.125rem 0;
}

/* Curva de tendência */
.hg-stat-spark {
    position: relative;
    height: 2.75rem;
}

/* A curva e a área aparecem da esquerda para a direita (recorte animado). Tracejado não serve aqui: com o traço sem
   escala (non-scaling-stroke), o comprimento do caminho é medido na tela e a linha sai quebrada. */
.hg-stat-spark svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    clip-path: inset(-10% 0 -10% 0);
    animation: hg-stat-reveal 1.3s cubic-bezier(0.65, 0, 0.35, 1) both;
    animation-delay: calc(var(--hg-stat-index, 0) * 80ms + 0.25s);
}

.hg-stat-spark-stop-top {
    stop-color: var(--hg-primary);
    stop-opacity: 0.32;
}

.hg-stat-spark-stop-bottom {
    stop-color: var(--hg-primary);
    stop-opacity: 0;
}

.hg-stat-spark-area {
    animation: hg-stat-fade 1.2s ease both;
    animation-delay: calc(var(--hg-stat-index, 0) * 80ms + 0.4s);
}

.hg-stat-spark-line {
    fill: none;
    stroke: var(--hg-primary);
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hg-stat-spark-dot {
    position: absolute;
    width: 0.5rem;
    height: 0.5rem;
    border: 2px solid var(--hg-card);
    border-radius: 50%;
    background: var(--hg-primary);
    box-sizing: content-box;
    transform: translate(-50%, -50%) scale(0);
    animation: hg-stat-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--hg-stat-index, 0) * 80ms + 1.4s);
}

.hg-stat-spark-dot::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: var(--hg-primary);
    animation: hg-stat-pulse 2.2s ease-out infinite;
    animation-delay: calc(var(--hg-stat-index, 0) * 80ms + 1.8s);
    opacity: 0;
}

/* O anel fica no canto de cima, ao lado do título e do número, sem aumentar a altura do cartão. */
.hg-stat-aside {
    position: absolute;
    top: 1rem;
    right: 1.125rem;
}

.hg-stat-card:has(.hg-stat-aside) .hg-stat-head,
.hg-stat-card:has(.hg-stat-aside) .hg-stat-foot {
    padding-right: 4.5rem;
}

/* Anel de proporção */
.hg-stat-ring {
    position: relative;
    flex-shrink: 0;
    width: 3.75rem;
    height: 3.75rem;
}

.hg-stat-ring svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    transform: rotate(-90deg);
    /* A sombra vai no SVG inteiro, que segue o formato do anel. No <circle> ela ganhava uma região retangular e o
       navegador desenhava um quadrado atrás do anel. */
    filter: drop-shadow(0 2px 4px color-mix(in oklch, var(--hg-primary) 30%, transparent));
}

.hg-stat-ring circle {
    fill: none;
    stroke-width: 3.5;
}

.hg-stat-ring-track {
    stroke: var(--hg-muted);
}

.hg-stat-ring-fill {
    stroke: var(--hg-primary);
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: var(--hg-ring-offset);
    animation: hg-stat-ring 1.4s cubic-bezier(0.65, 0, 0.35, 1) both;
    animation-delay: calc(var(--hg-stat-index, 0) * 80ms + 0.3s);
}

.hg-stat-ring--empty .hg-stat-ring-fill {
    visibility: hidden;
}

.hg-stat-ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--hg-foreground);
}

.hg-stat-ring-value small {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--hg-muted-foreground);
}

/* Barras por período */
.hg-stat-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.375rem;
    height: 2.75rem;
    padding: 0 1.125rem 0.5rem;
}

.hg-stat-bar {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
}

.hg-stat-bar-track {
    display: flex;
    flex: 1;
    align-items: flex-end;
    width: 100%;
}

.hg-stat-bar-fill {
    display: block;
    width: 100%;
    border-radius: 4px 4px 2px 2px;
    background: color-mix(in oklch, var(--hg-primary) 30%, transparent);
    transform-origin: bottom;
    transition: background 0.2s ease;
    animation: hg-stat-grow 0.7s cubic-bezier(0.34, 1.3, 0.64, 1) both;
    animation-delay: calc(var(--hg-stat-index, 0) * 80ms + 0.4s + var(--hg-bar-index, 0) * 60ms);
}

.hg-stat-bar:hover .hg-stat-bar-fill {
    background: color-mix(in oklch, var(--hg-primary) 60%, transparent);
}

.hg-stat-bar--current .hg-stat-bar-fill,
.hg-stat-bar--current:hover .hg-stat-bar-fill {
    background: linear-gradient(180deg, var(--hg-primary), var(--hg-primary-hover));
    box-shadow: 0 4px 10px -4px color-mix(in oklch, var(--hg-primary) 70%, transparent);
}

.hg-stat-bar-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    text-transform: lowercase;
    color: var(--hg-muted-foreground);
}

.hg-stat-bar--current .hg-stat-bar-label {
    font-weight: 700;
    color: var(--hg-primary);
}

@keyframes hg-stat-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
}

@keyframes hg-stat-fade {
    from {
        opacity: 0;
    }
}

@keyframes hg-stat-reveal {
    from {
        clip-path: inset(-10% 100% -10% 0);
    }
}

@keyframes hg-stat-pop {
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes hg-stat-pulse {
    0% {
        opacity: 0.55;
        transform: scale(1);
    }

    80%,
    100% {
        opacity: 0;
        transform: scale(3);
    }
}

@keyframes hg-stat-ring {
    from {
        stroke-dashoffset: 100;
    }
}

@keyframes hg-stat-grow {
    from {
        transform: scaleY(0);
    }
}

/* Ranking no cartão de indicador (<x-hg.stat-ranking>): posição, ícone ou iniciais na cor do item (`--hg-rank-color`,
 * uma das cores de gráfico do template), nome, barra proporcional ao primeiro e o total. Dois rankings lado a lado
 * abaixo da linha de cartões. As barras crescem em sequência ao abrir. */
.hg-rank-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 1024px) {
    .hg-rank-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.hg-rank-card {
    padding-bottom: 1rem;
}

.hg-rank-empty {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.8125rem;
    color: var(--hg-muted-foreground);
}

.hg-rank-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.25rem 0 0;
    padding: 0;
    list-style: none;
}

.hg-rank-row {
    display: grid;
    grid-template-columns: 1.5rem 2rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--hg-radius-md);
    transition: background 0.2s ease;
    animation: hg-stat-fade 0.5s ease both;
    animation-delay: calc(300ms + var(--hg-rank-index, 0) * 60ms);
}

.hg-rank-row:hover {
    background: color-mix(in oklch, var(--hg-rank-color) 8%, transparent);
}

.hg-rank-position {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    color: var(--hg-muted-foreground);
}

.hg-rank-position--top {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hg-primary), var(--hg-primary-hover));
    color: var(--hg-primary-foreground);
    box-shadow: 0 4px 10px -4px color-mix(in oklch, var(--hg-primary) 80%, transparent);
}

.hg-rank-badge {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--hg-radius-md);
    background: color-mix(in oklch, var(--hg-rank-color) 16%, transparent);
    color: color-mix(in oklch, var(--hg-rank-color) 75%, var(--hg-foreground));
}

.hg-rank-badge--initials {
    border-radius: 50%;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hg-rank-badge-icon {
    width: 1.125rem;
    height: 1.125rem;
    color: inherit;
}

.hg-rank-main {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.hg-rank-name {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
}

.hg-rank-label {
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--hg-foreground);
}

.hg-rank-sub {
    overflow: hidden;
    font-size: 0.6875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--hg-muted-foreground);
}

.hg-rank-track {
    height: 0.375rem;
    overflow: hidden;
    border-radius: 9999px;
    background: var(--hg-muted);
}

.hg-rank-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--hg-rank-color), color-mix(in oklch, var(--hg-rank-color) 60%, white));
    transform-origin: left;
    animation: hg-rank-grow 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    animation-delay: calc(350ms + var(--hg-rank-index, 0) * 60ms);
}

.hg-rank-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--hg-foreground);
}

.hg-rank-value small {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--hg-muted-foreground);
}

@keyframes hg-rank-grow {
    from {
        transform: scaleX(0);
    }
}

/* Tabelas do histórico de navegação (ADR-0039): iniciais da pessoa e ícone do módulo na cor dele (`--hg-nav-color`,
 * a mesma do ranking), data e hora em duas linhas. */
.hg-nav-when {
    white-space: nowrap;
}

.hg-nav-person,
.hg-nav-module {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.hg-nav-avatar {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: color-mix(in oklch, var(--hg-nav-color) 16%, transparent);
    color: color-mix(in oklch, var(--hg-nav-color) 75%, var(--hg-foreground));
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hg-nav-module {
    font-weight: 500;
}

.hg-nav-module-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--hg-radius-sm);
    background: color-mix(in oklch, var(--hg-nav-color) 16%, transparent);
    color: color-mix(in oklch, var(--hg-nav-color) 75%, var(--hg-foreground));
}

.hg-nav-module-svg {
    width: 1rem;
    height: 1rem;
    color: inherit;
}

.hg-nav-section {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--hg-foreground);
}

.hg-nav-section-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--hg-muted-foreground);
}

.hg-nav-support {
    margin-top: 0.375rem;
    margin-left: 2.625rem;
}

@media (prefers-reduced-motion: reduce) {
    .hg-perm-group,
    .hg-rank-row,
    .hg-rank-fill,
    .hg-stat-card,
    .hg-stat-card::before,
    .hg-stat-card::after,
    .hg-stat-icon,
    .hg-stat-spark svg,
    .hg-stat-spark-area,
    .hg-stat-spark-dot,
    .hg-stat-spark-dot::after,
    .hg-stat-ring-fill,
    .hg-stat-bar-fill {
        animation: none;
        transition: none;
    }

    .hg-stat-spark-dot {
        transform: translate(-50%, -50%);
    }
}

/* Aviso de vencimento da senha (ADR-0011): callout laranja do template no topo do conteúdo, com o atalho para trocar. */
.hg-password-expiry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.hg-password-expiry-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.hg-password-expiry-text span {
    color: var(--hg-muted-foreground);
}

.hg-password-expiry .hg-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ===== Skeleton de carregamento: tabelas, relation managers e indicadores (.ai/rules/views-css.md) =====
 * Barras cinza com um brilho que passa da esquerda para a direita, linha a linha, no desenho da peça que vai chegar
 * (hg-table com toolbar, cartão de indicador), para a página não pular quando o conteúdo entra. Quatro momentos:
 * - placeholder do widget lazy (<x-hg.skeleton.stats>) e do relation manager lazy (<x-hg.skeleton.table card toolbar>);
 * - primeira carga de tabela adiada (render hook do UsesHyperGestorLook): o skeleton entra no lugar do spinner;
 * - recarga de qualquer hg-table (busca, filtro, ordem, página): o Filament põe `fi-ta-content-loading` no contêiner
 *   (`loadingSkeleton()`, ligado para todas no AppServiceProvider) e as células viram barras, sem mudar a altura;
 * - troca de aba no detalhe da empresa (`is-switching` em filament/admin/companies/sections). */
.hg-skeleton {
    --hg-skeleton-base: color-mix(in oklch, var(--hg-border) 75%, var(--hg-card));
    --hg-skeleton-shine: color-mix(in oklch, var(--hg-primary) 7%, var(--hg-card));
}

.hg-skeleton-bar,
.fi-ta-content-loading .hg-table tbody td::after,
.fi-ta-content-loading .hg-table tbody td.hg-table-cell-name::before {
    display: block;
    height: 0.75rem;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        var(--hg-skeleton-base, color-mix(in oklch, var(--hg-border) 75%, var(--hg-card))) 30%,
        var(--hg-skeleton-shine, color-mix(in oklch, var(--hg-primary) 7%, var(--hg-card))) 50%,
        var(--hg-skeleton-base, color-mix(in oklch, var(--hg-border) 75%, var(--hg-card))) 70%
    );
    background-size: 300% 100%;
    animation: hg-skeleton-shine 1.6s ease-in-out infinite;
    animation-delay: calc(var(--hg-skeleton-row, 0) * 90ms);
}

@keyframes hg-skeleton-shine {
    from {
        background-position: 100% 0;
    }

    to {
        background-position: 0 0;
    }
}

/* Cartão da listagem, igual ao contêiner da tabela do Filament nas nossas páginas. */
.hg-skeleton-card {
    overflow: hidden;
    border: 1px solid var(--hg-border);
    border-radius: calc(var(--hg-radius) + 4px);
    background: var(--hg-card);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

/* Toolbar: título, busca, filtro segmentado, contador e o botão de criar. */
.hg-skeleton .hg-skeleton-heading {
    width: 7rem;
    height: 1rem;
}

.hg-skeleton .hg-skeleton-search {
    width: min(16rem, 100%);
    height: 2.25rem;
    border-radius: var(--hg-radius-md);
}

.hg-skeleton .hg-skeleton-tabs {
    width: 13rem;
    height: 2.25rem;
    border-radius: var(--hg-radius-md);
}

.hg-skeleton .hg-skeleton-count {
    width: 4.5rem;
}

.hg-skeleton .hg-skeleton-button {
    width: 6rem;
    height: 2rem;
    border-radius: var(--hg-radius-md);
}

/* Linhas: o nome com a sub-linha, as outras colunas com uma barra e o botão da linha à direita. */
.hg-skeleton-table .hg-table th .hg-skeleton-th {
    height: 0.5rem;
}

.hg-skeleton-table .hg-table td {
    height: 3.25rem;
}

.hg-skeleton-table .hg-skeleton-sub {
    height: 0.5rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.hg-skeleton-table .hg-table-cell-actions .hg-skeleton-button {
    width: 4.5rem;
    height: 1.75rem;
    margin-left: auto;
}

.hg-skeleton-table .hg-table tbody tr:hover {
    background: transparent;
}

/* Primeira carga adiada: o skeleton fica no lugar do spinner do Filament. */
.hg-skeleton-table + .fi-ta-content-ctn {
    display: none;
}

/* Recarga: as células ficam com a mesma altura e o conteúdo dá lugar a uma barra (o nome, a duas). */
.fi-ta-content-loading .hg-table tbody {
    pointer-events: none;
}

.fi-ta-content-loading .hg-table tbody tr:hover {
    background: transparent;
}

.fi-ta-content-loading .hg-table tbody td {
    position: relative;
    color: transparent;
}

.fi-ta-content-loading .hg-table tbody td > * {
    visibility: hidden;
}

.fi-ta-content-loading .hg-table tbody td::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0.5rem;
    width: min(60%, 9rem);
    translate: 0 -50%;
}

.fi-ta-content-loading .hg-table tbody td.hg-table-cell-name::after {
    top: calc(50% - 0.5rem);
    width: min(70%, 14rem);
}

.fi-ta-content-loading .hg-table tbody td.hg-table-cell-name::before {
    content: '';
    position: absolute;
    top: calc(50% + 0.5rem);
    left: 0.5rem;
    width: min(45%, 9rem);
    height: 0.5rem;
    translate: 0 -50%;
    opacity: 0.7;
}

.fi-ta-content-loading .hg-table tbody td.hg-table-cell-count::after {
    left: 50%;
    width: 2rem;
    translate: -50% -50%;
}

.fi-ta-content-loading .hg-table tbody td.hg-table-cell-actions::after {
    right: 0.5rem;
    left: auto;
    width: 4.5rem;
    height: 1.75rem;
    border-radius: var(--hg-radius-md);
}

/* Troca de aba no detalhe da empresa: a aba que estava aberta some e o skeleton fica no lugar até a nova chegar. */
.hg-company-sections-loading {
    display: none;
    margin-top: 1.5rem;
}

.hg-company-sections-wrap.is-switching .hg-company-sections-loading {
    display: block;
}

.fi-page:has(.hg-company-sections-wrap.is-switching) .fi-resource-relation-manager {
    display: none;
}

/* Cartão de indicador: mesma anatomia e altura do <x-hg.stat-card>, com o gráfico colado na base. */
.hg-skeleton-stat {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
    padding: 1rem 1.125rem 0;
    border: 1px solid var(--hg-border);
    border-radius: var(--hg-radius);
    background: var(--hg-card);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

.hg-skeleton-stat .hg-skeleton-stat-icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--hg-radius-md);
}

.hg-skeleton-stat .hg-skeleton-stat-label {
    width: 45%;
    height: 0.625rem;
}

.hg-skeleton-stat .hg-skeleton-stat-value {
    width: 4.5rem;
    height: 2rem;
    border-radius: var(--hg-radius-sm);
}

.hg-skeleton-stat .hg-skeleton-stat-delta {
    width: 7.5rem;
    height: 1.25rem;
}

.hg-skeleton-stat .hg-skeleton-stat-foot {
    width: 65%;
    height: 0.625rem;
}

.hg-skeleton-stat .hg-skeleton-stat-visual {
    height: 2.75rem;
    margin: auto -1.125rem 0;
    border-radius: 0;
    opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
    .hg-skeleton-bar,
    .fi-ta-content-loading .hg-table tbody td::after,
    .fi-ta-content-loading .hg-table tbody td.hg-table-cell-name::before {
        animation: none;
    }
}

/* ===== Seletor de loja na barra do topo do app (StoreSwitcher, CurrentStore) =====
   Botão com o ícone em bloco laranja, "Loja" em cima e a loja em foco embaixo; o painel abre para a esquerda, com a
   opção "todas" primeiro, a lotação indicada e a loja atual marcada em laranja claro. */
.hg-topbar-start {
    display: flex;
    align-items: center;
    min-width: 0;
}

.hg-store-switcher {
    min-width: 0;
}

.hg-store-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    max-width: 22rem;
    padding: 0.3125rem 0.625rem 0.3125rem 0.3125rem;
    border: 1px solid var(--hg-border);
    border-radius: 0.625rem;
    background: var(--hg-card);
    color: var(--hg-foreground);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.hg-store-switcher-btn:hover,
.hg-store-switcher-btn[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--hg-primary) 45%, var(--hg-border));
    background: color-mix(in srgb, var(--hg-primary) 4%, var(--hg-card));
}

.hg-store-switcher-btn[aria-expanded="true"] {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hg-primary) 14%, transparent);
}

.hg-store-switcher-icon,
.hg-store-switcher-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: var(--hg-primary);
    color: #fff;
}

.hg-store-switcher-svg {
    width: 1.125rem;
    height: 1.125rem;
}

.hg-store-switcher-text,
.hg-store-switcher-item-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.hg-store-switcher-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hg-muted-foreground);
}

.hg-store-switcher-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hg-store-switcher-chevron {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-left: 0.25rem;
    color: var(--hg-muted-foreground);
}

.hg-store-switcher-panel {
    left: 0;
    right: auto;
    width: min(22rem, calc(100vw - 2rem));
    padding: 0.625rem;
}

/* Trocando de loja: o painel já fechou; o botão mostra o giro até a tela recarregar. */
.hg-store-switcher-btn.is-busy {
    cursor: progress;
}

.hg-store-switcher-btn.is-busy .hg-store-switcher-name {
    color: var(--hg-muted-foreground);
}

.hg-store-switcher-spinner {
    color: var(--hg-primary);
    animation: hg-store-switcher-spin 0.8s linear infinite;
}

@keyframes hg-store-switcher-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hg-store-switcher-spinner {
        animation: none;
    }
}

.hg-store-switcher-panel .hg-topbar-panel-title {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

.hg-store-switcher-search {
    position: relative;
    margin-bottom: 0.5rem;
}

.hg-store-switcher-search-icon {
    position: absolute;
    top: 50%;
    left: 0.625rem;
    width: 1rem;
    height: 1rem;
    transform: translateY(-50%);
    color: var(--hg-primary);
    pointer-events: none;
}

.hg-store-switcher-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid var(--hg-border);
    border-radius: 0.5rem;
    background: var(--hg-muted);
    font-size: 0.8125rem;
    color: var(--hg-foreground);
    outline: none;
}

.hg-store-switcher-search-input:focus {
    border-color: var(--hg-primary);
    background: var(--hg-card);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hg-primary) 14%, transparent);
}

.hg-store-switcher-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-height: 22rem;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hg-store-switcher-list li:first-child {
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--hg-border);
}

.hg-store-switcher-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--hg-foreground);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.hg-store-switcher-item .hg-store-switcher-item-icon {
    width: 1.75rem;
    height: 1.75rem;
    background: color-mix(in srgb, var(--hg-primary) 10%, transparent);
    color: var(--hg-primary);
}

.hg-store-switcher-item .hg-store-switcher-svg {
    width: 1rem;
    height: 1rem;
}

.hg-store-switcher-item:hover {
    background: color-mix(in oklch, var(--hg-primary) 6%, transparent);
    color: var(--hg-primary);
}

.hg-store-switcher-item.is-current {
    background: color-mix(in oklch, var(--hg-primary) 12%, transparent);
}

.hg-store-switcher-item.is-current .hg-store-switcher-item-title {
    color: var(--hg-primary);
}

.hg-store-switcher-item-main {
    flex: 1;
    gap: 0.125rem;
}

.hg-store-switcher-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hg-store-switcher-item-sub {
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

.hg-store-switcher-check {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    color: var(--hg-primary);
}

@media (max-width: 640px) {
    .hg-store-switcher-label {
        display: none;
    }

    .hg-store-switcher-btn {
        max-width: 11rem;
    }
}

/* ===== Estoque de veículos no app (Pages/Inventory, ADR-0043) =====
   Avisos da leitura do HUB (loja sem token, HUB ou DMS fora), a linha do "lido do DMS em" e as linhas da hg-table:
   ícone do carro em laranja claro, modelo com o selo novo/usado, preço em destaque e dias em estoque (laranja depois
   de 90 dias). */
.hg-inventory-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.hg-inventory-notice--warning {
    border-color: color-mix(in srgb, var(--hg-destructive) 35%, transparent);
    background: color-mix(in srgb, var(--hg-destructive) 6%, transparent);
}

.hg-inventory-notice--warning .hg-inventory-notice-icon {
    color: var(--hg-destructive);
}

.hg-inventory-notice--blocked {
    padding: 1.25rem 1.25rem;
}

.hg-inventory-notice-icon {
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 0.0625rem;
    color: var(--hg-primary);
}

.hg-inventory-notice-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.hg-inventory-notice-text span {
    color: var(--hg-muted-foreground);
}

.hg-inventory-updated {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.375rem;
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

.hg-inventory-updated-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--hg-primary);
}

.hg-inventory-vehicle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Sem foto: o carro no mesmo tamanho da capa, para as linhas ficarem iguais. */
.hg-inventory-vehicle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 4.25rem;
    height: 3rem;
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--hg-primary) 10%, transparent);
    color: var(--hg-primary);
}

.hg-inventory-vehicle-svg {
    width: 1.625rem;
    height: 1.625rem;
}

.hg-inventory-model {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-weight: 600;
}

.hg-inventory-condition {
    font-size: 0.6875rem;
}

.hg-inventory-vehicles .hg-table-cell-number {
    text-align: right;
    white-space: nowrap;
}

.hg-inventory-price {
    font-weight: 600;
    white-space: nowrap;
}

.hg-inventory-days {
    font-weight: 500;
    white-space: nowrap;
}

.hg-inventory-days.is-aged {
    color: var(--hg-primary);
    font-weight: 600;
}

/* ===== Detalhe do veículo (ViewVehicleAction, ADR-0043) =====
   Topo em laranja claro com os selos, o preço em destaque e três fatos (placa no desenho da placa Mercosul, km, tempo
   de estoque); embaixo, cartões brancos com listas de rótulo e valor, e a origem da leitura no rodapé. */
.hg-vehicle-detail {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hg-vehicle-hero {
    display: grid;
    gap: 0.875rem;
    padding: 1.125rem 1.25rem;
    border: 1px solid color-mix(in srgb, var(--hg-primary) 25%, var(--hg-border));
    border-radius: calc(var(--hg-radius) + 4px);
    background: linear-gradient(135deg, color-mix(in srgb, var(--hg-primary) 9%, var(--hg-card)), var(--hg-card) 70%);
}

.hg-vehicle-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.hg-vehicle-hero-price {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.hg-vehicle-hero-label,
.hg-vehicle-fact-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hg-muted-foreground);
}

.hg-vehicle-hero-price strong {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--hg-foreground);
}

.hg-vehicle-hero-bonus {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--hg-primary);
}

.hg-vehicle-hero-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.625rem;
}

.hg-vehicle-fact {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.5rem;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--hg-border);
    border-radius: 0.625rem;
    background: var(--hg-card);
}

.hg-vehicle-fact-icon {
    grid-row: span 2;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--hg-primary);
}

.hg-vehicle-fact-value {
    font-size: 0.9375rem;
    font-weight: 600;
}

.hg-vehicle-fact-value.is-aged {
    color: var(--hg-primary);
}

.hg-vehicle-plate {
    justify-self: start;
    padding: 0.0625rem 0.5rem;
    border: 2px solid var(--hg-foreground);
    border-top-width: 5px;
    border-top-color: var(--hg-chart-5);
    border-radius: 0.3125rem;
    background: var(--hg-card);
    font-family: var(--hg-font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.hg-vehicle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.hg-vehicle-card {
    padding: 0.875rem 1rem;
    border: 1px solid var(--hg-border);
    border-radius: calc(var(--hg-radius) + 2px);
    background: var(--hg-card);
}

.hg-vehicle-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.625rem;
    font-size: 0.8125rem;
    font-weight: 700;
}

.hg-vehicle-card-icon {
    width: 1rem;
    height: 1rem;
    color: var(--hg-primary);
}

.hg-vehicle-list {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.hg-vehicle-list > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.4375rem 0;
    border-bottom: 1px dashed var(--hg-border);
    font-size: 0.8125rem;
}

.hg-vehicle-list > div:last-child {
    border-bottom: none;
}

.hg-vehicle-list dt {
    flex-shrink: 0;
    color: var(--hg-muted-foreground);
}

.hg-vehicle-list dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.hg-vehicle-code {
    display: inline-block;
    margin-left: 0.375rem;
    padding: 0 0.375rem;
    border-radius: 0.3125rem;
    background: var(--hg-muted);
    font-family: var(--hg-font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--hg-muted-foreground);
}

.hg-vehicle-code--block {
    display: block;
    width: fit-content;
    margin: 0.25rem 0 0 auto;
    overflow-wrap: normal;
}

.hg-vehicle-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.hg-vehicle-copy-btn {
    display: inline-flex;
    padding: 0.1875rem;
    border: none;
    border-radius: 0.375rem;
    background: color-mix(in srgb, var(--hg-primary) 10%, transparent);
    color: var(--hg-primary);
    cursor: pointer;
}

.hg-vehicle-copy-btn:hover {
    background: color-mix(in srgb, var(--hg-primary) 18%, transparent);
}

.hg-vehicle-copy-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.hg-vehicle-source {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    background: var(--hg-muted);
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

.hg-vehicle-source-icon {
    flex-shrink: 0;
    width: 0.9375rem;
    height: 0.9375rem;
    color: var(--hg-primary);
}

@media (max-width: 768px) {
    .hg-vehicle-grid,
    .hg-vehicle-hero-facts {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ===== Galeria de fotos do veículo (VehicleGallery, ADR-0044) e a capa na lista do estoque =====
   Foto em destaque 16:9 com contador e setas, miniaturas em grade (a capa com selo laranja, a atual com borda
   laranja), ações na miniatura (capa, apagar com confirmação), área de envio tracejada e a tela cheia escura. */
.hg-inventory-vehicle-photo {
    position: relative;
    flex-shrink: 0;
    width: 4.25rem;
    height: 3rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--hg-muted);
}

.hg-inventory-vehicle-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hg-inventory-vehicle-photo-count {
    position: absolute;
    right: 0.1875rem;
    bottom: 0.1875rem;
    padding: 0 0.3125rem;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.6);
    font-size: 0.625rem;
    font-weight: 700;
    color: #fff;
}

.hg-gallery {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.hg-gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1.5rem 1rem;
    border: 1px dashed var(--hg-border);
    border-radius: calc(var(--hg-radius) + 4px);
    background: var(--hg-muted);
    font-size: 0.875rem;
    text-align: center;
    color: var(--hg-muted-foreground);
}

.hg-gallery-empty strong {
    color: var(--hg-foreground);
}

.hg-gallery-empty-icon {
    width: 2rem;
    height: 2rem;
    color: var(--hg-primary);
}

.hg-gallery-main {
    position: relative;
}

.hg-gallery-main-image {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: none;
    border-radius: calc(var(--hg-radius) + 4px);
    overflow: hidden;
    background: rgb(0 0 0 / 0.9);
    cursor: zoom-in;
}

.hg-gallery-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hg-gallery-counter,
.hg-gallery-viewer-counter {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.hg-gallery-zoom {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    display: inline-flex;
    padding: 0.375rem;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.6);
    color: #fff;
    opacity: 0;
    transition: opacity 0.15s;
}

.hg-gallery-main-image:hover .hg-gallery-zoom {
    opacity: 1;
}

.hg-gallery-zoom-icon {
    width: 1rem;
    height: 1rem;
}

.hg-gallery-arrow {
    position: absolute;
    top: 50%;
    display: inline-flex;
    padding: 0.5rem;
    border: none;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.9);
    color: var(--hg-foreground);
    box-shadow: 0 2px 10px rgb(0 0 0 / 0.2);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background 0.15s, color 0.15s;
}

.hg-gallery-arrow:hover {
    background: #fff;
    color: var(--hg-primary);
}

.hg-gallery-arrow--prev {
    left: 0.75rem;
}

.hg-gallery-arrow--next {
    right: 0.75rem;
}

.hg-gallery-arrow-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.hg-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hg-gallery-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border: 2px solid transparent;
    border-radius: 0.625rem;
    overflow: hidden;
    background: var(--hg-muted);
    transition: border-color 0.15s;
}

.hg-gallery-thumb.is-current {
    border-color: var(--hg-primary);
}

.hg-gallery-thumb-image {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.hg-gallery-thumb-image[x-sortable-handle] {
    cursor: grab;
}

.hg-gallery-thumb-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hg-gallery-cover {
    position: absolute;
    left: 0.25rem;
    top: 0.25rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background: var(--hg-primary);
    font-size: 0.625rem;
    font-weight: 700;
    color: #fff;
    pointer-events: none;
}

.hg-gallery-thumb-actions {
    position: absolute;
    right: 0.25rem;
    top: 0.25rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.hg-gallery-thumb:hover .hg-gallery-thumb-actions,
.hg-gallery-thumb:focus-within .hg-gallery-thumb-actions {
    opacity: 1;
}

.hg-gallery-thumb-actions button {
    display: inline-flex;
    padding: 0.25rem;
    border: none;
    border-radius: 0.375rem;
    background: rgb(255 255 255 / 0.92);
    color: var(--hg-primary);
    cursor: pointer;
}

.hg-gallery-thumb-actions button.is-danger,
.hg-gallery-confirm button.is-danger {
    color: var(--hg-destructive);
}

.hg-gallery-thumb-action-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.hg-gallery-confirm {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    background: rgb(0 0 0 / 0.7);
    font-size: 0.6875rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
}

.hg-gallery-confirm div {
    display: flex;
    gap: 0.25rem;
}

.hg-gallery-confirm button {
    padding: 0.125rem 0.5rem;
    border: none;
    border-radius: 0.375rem;
    background: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--hg-foreground);
    cursor: pointer;
}

.hg-gallery-drop {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1.5px dashed color-mix(in srgb, var(--hg-primary) 45%, var(--hg-border));
    border-radius: calc(var(--hg-radius) + 2px);
    background: color-mix(in srgb, var(--hg-primary) 4%, var(--hg-card));
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.hg-gallery-drop:hover,
.hg-gallery-drop.is-dragging {
    border-color: var(--hg-primary);
    background: color-mix(in srgb, var(--hg-primary) 9%, var(--hg-card));
}

.hg-gallery-drop.is-uploading {
    cursor: progress;
}

.hg-gallery-drop-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.hg-gallery-drop-icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--hg-primary);
}

.hg-gallery-drop-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

.hg-gallery-drop-text strong {
    font-size: 0.875rem;
    color: var(--hg-foreground);
}

.hg-gallery-progress {
    display: block;
    height: 0.375rem;
    border-radius: 999px;
    background: var(--hg-muted);
    overflow: hidden;
}

.hg-gallery-progress span {
    display: block;
    height: 100%;
    background: var(--hg-primary);
    transition: width 0.2s;
}

.hg-gallery-processing {
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--hg-muted-foreground);
}

.hg-gallery-processing-icon {
    width: 1rem;
    height: 1rem;
    color: var(--hg-primary);
    animation: hg-store-switcher-spin 0.8s linear infinite;
}

.hg-gallery-error {
    margin: 0;
    font-size: 0.75rem;
    color: var(--hg-destructive);
}

.hg-gallery-viewer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 4.5rem;
    background: rgb(0 0 0 / 0.92);
}

.hg-gallery-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
}

.hg-gallery-viewer-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    display: inline-flex;
    padding: 0.5rem;
    border: none;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.12);
    color: #fff;
    cursor: pointer;
}

.hg-gallery-viewer-close:hover {
    background: rgb(255 255 255 / 0.22);
}

.hg-gallery-viewer-counter {
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
}

.hg-gallery-arrow--viewer.hg-gallery-arrow--prev {
    left: 1rem;
}

.hg-gallery-arrow--viewer.hg-gallery-arrow--next {
    right: 1rem;
}

@media (prefers-reduced-motion: reduce) {
    .hg-gallery-processing-icon {
        animation: none;
    }
}

/* Abas do detalhe do veículo ("Informações" e "Fotos"): o trilho do template, em largura total. */
.hg-vehicle-tabs-wrap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hg-vehicle-tabs {
    display: flex;
    width: 100%;
}

.hg-vehicle-tabs .hg-tab {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-weight: 600;
}

.hg-vehicle-tab-icon {
    width: 1rem;
    height: 1rem;
    color: var(--hg-primary);
}

.hg-vehicle-tab-count {
    min-width: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--hg-primary) 14%, transparent);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--hg-primary);
}

/* ===== Contraste AA (axe color-contrast, walkthrough da Fase 4) =====
 * O cinza de apoio (#6b727e) dava 4,3:1 nos fundos cinza (abas, botões de ferramenta, contadores) e o vermelho
 * (#ee3533) 4,0:1 no branco: todo número negativo da DRE reprovava, o que o legado não fazia. Aqui os dois escurecem
 * até AA, e o texto em laranja usa o tom de texto da marca do legado (#a95000, 5,5:1); o laranja de preenchimento
 * (botão primário, FAB) é o do template e não muda aqui. */
:root {
    --hg-muted-foreground: #626977;
    --hg-destructive: #c5372c;
    --bi-accent-text: #a95000;
}

/* Texto em laranja do template (valores da planilha de ajustes, avisos de sucesso): o tom de texto, não o de preenchimento. */
.hg-app .hg-text-primary {
    color: var(--bi-accent-text);
}

/* ===== Gavetas e painéis do BI por cima da topbar =====
 * Eles nascem dentro do .hg-main-content (z-index 1), então o z-index deles não passa da topbar (20): a topbar cobria o
 * título e o "×" da gaveta do Comparativo, da Ponte, do detalhe do KPI e da matriz, e o copiloto (walkthrough da Fase 4).
 * Mesma saída do template para os modais do Filament (hypergestor-hub.css): aberto, o conteúdo sobe e a topbar desce. */
.hg-app:has(.sc-sheet, .vb-drawer, .bi-drawer, .cp-panel, .bi-matrix.is-full) .hg-topbar {
    z-index: 0;
}

.hg-app:has(.sc-sheet, .vb-drawer, .bi-drawer, .cp-panel, .bi-matrix.is-full) .hg-main-content {
    z-index: 40;
}

/* ===== Shell em tela estreita (até 767px) =====
 * O template não tem layout de celular: a sidebar aberta (17rem) comia 70% de uma tela de 390px e empurrava o
 * conteúdo para fora (walkthrough da Fase 4). Aqui ela abre recolhida (o x-data do shell) e, quando a pessoa a
 * expande, flutua por cima do conteúdo em vez de espremê-lo. */
@media (max-width: 767px) {
    .hg-sidebar:not(.is-collapsed) {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.35);
    }

    .hg-topbar-start {
        min-width: 0;
    }

    .hg-store-switcher-btn {
        max-width: 100%;
    }
}

/* O template esconde nome e e-mail do botão da conta no celular com display: none, e o botão fica sem nome acessível
 * (axe button-name). Escondido só da tela, o texto continua sendo o nome do botão. */
@media (max-width: 640px) {
    .hg-topbar-user-text {
        display: block;
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}
