/*
 * Tema compacto do SIMEP: o Filament mede quase tudo em rem, então reduzir a fonte-base
 * de 16px para 14px diminui proporcionalmente textos, espaçamentos, campos e tabelas.
 */
html {
    font-size: 14px;
}

/* Tabelas: o respiro vertical fica no conteúdo da coluna (texto, ícone, imagem), não na célula */
.fi-ta-text,
.fi-ta-icon,
.fi-ta-image,
.fi-ta-color,
.fi-ta-cell .fi-ta-col > div {
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
}

.fi-ta-header-cell {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.fi-section-content {
    padding: 1rem !important;
}

/* seção sem moldura (ex.: números do topo do painel) não tem recuo: fica alinhada com os cards ao redor */
.fi-section-not-contained .fi-section-content {
    padding: 0 !important;
}

/* Logomarca no cabeçalho e na tela de login */
.simep-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: 100%;
}

.simep-brand-logo {
    height: 2.4rem;
    width: auto;
}

.simep-brand-nome {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    color: #1d4f91;
}

.dark .simep-brand-nome {
    color: #dbeafe;
}

.fi-simple-header .simep-brand-logo {
    height: 4.5rem;
}

/* Relatório "Solicitações por período" (sem Tailwind: o Filament não compila classes novas sem tema próprio) */
.simep-periodo-filtros {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.simep-periodo-campo {
    display: grid;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 11rem;
}

.simep-periodo-cabecalho {
    text-align: center;
    margin-bottom: 0.5rem;
}

.simep-periodo-instituicao {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1d4f91;
}

.dark .simep-periodo-instituicao {
    color: #dbeafe;
}

.simep-periodo-titulo {
    font-weight: 600;
}

.simep-periodo-datas,
.simep-periodo-canceladas,
.simep-periodo-vazio {
    font-size: 0.875rem;
    color: #6b7280;
}

.simep-periodo-bloco {
    margin-top: 1.5rem;
}

.simep-periodo-cliente {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #cbd5e1;
    font-weight: 600;
}

.simep-periodo-tabela {
    width: 100%;
    margin-top: 0.25rem;
    border-collapse: collapse;
    table-layout: fixed; /* mesmas larguras em todos os blocos, colunas alinhadas */
    font-size: 0.875rem;
}

.simep-periodo-tabela th:first-child {
    width: 50%;
}

.simep-periodo-tabela th {
    text-align: left;
    font-weight: 500;
    color: #6b7280;
    padding: 0.3rem 0.5rem 0.3rem 0;
}

.simep-periodo-tabela td {
    padding: 0.3rem 0.5rem 0.3rem 0;
    border-top: 1px solid #eef2f7;
}

.dark .simep-periodo-cliente {
    border-bottom-color: #475569;
}

.dark .simep-periodo-tabela td {
    border-top-color: #1e293b;
}

.simep-periodo-tabela .simep-periodo-numero {
    text-align: right;
    padding-right: 0;
    width: 8rem;
}

.simep-periodo-canceladas {
    margin-top: 0.25rem;
    text-align: right;
}

.simep-periodo-vazio {
    margin-top: 1.5rem;
    text-align: center;
}

.simep-periodo-total {
    margin-top: 1.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #cbd5e1;
    text-align: right;
    font-weight: 700;
}

/* Impressão dos relatórios: só o conteúdo, em fundo branco.
 * Na folha, a largura é menor que a da tela e o Filament passa ao layout estreito: com o menu "aberto",
 * ele desenha uma camada escura (fi-sidebar-close-overlay) por cima da página. Por isso ela é escondida. */
@media print {
    .fi-sidebar,
    .fi-sidebar-close-overlay,
    .fi-topbar,
    .fi-header,
    .fi-no,
    .simep-nao-imprimir {
        display: none !important;
    }

    html,
    body,
    .fi-layout,
    .fi-main-ctn,
    .fi-main,
    .fi-page,
    .fi-section {
        background: #fff !important;
        color: #111 !important;
    }

    .fi-main {
        padding: 0 !important;
        max-width: none !important;
    }

    .fi-section {
        box-shadow: none !important;
        border: 0 !important;
        --tw-ring-shadow: 0 0 #0000 !important;
    }

    /* Mesmo com o painel em modo escuro, a folha sai clara */
    .simep-periodo-instituicao {
        color: #1d4f91 !important;
    }

    .simep-periodo-cliente,
    .simep-periodo-total {
        border-color: #999 !important;
    }

    .simep-periodo-tabela td {
        border-top-color: #ddd !important;
    }

    .simep-periodo-bloco {
        break-inside: avoid;
    }
}

/* Listagens dos relatórios: botões "<=" / ">=" da tela antiga e procedimento cancelado riscado */
.simep-com-botoes {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.simep-filtro-rapido {
    padding: 0 4px;
    border: 1px solid rgb(209 213 219);
    border-radius: 4px;
    font-size: 11px;
    line-height: 16px;
    color: rgb(75 85 99);
    background: white;
}

.simep-filtro-rapido:hover {
    background: rgb(243 244 246);
}

.dark .simep-filtro-rapido {
    border-color: rgb(75 85 99);
    color: rgb(209 213 219);
    background: transparent;
}

.simep-cancelado td {
    text-decoration: line-through;
}

/* Observações com o texto inteiro (as quebras de linha viram <br>) */
.simep-texto-aberto {
    overflow-wrap: anywhere;
}

/* Rankings do painel (maiores clientes, top especialidades) */
.simep-ranking-controles {
    display: flex;
    gap: 8px;
}

.simep-ranking {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.simep-ranking-carregando {
    opacity: .5;
}

.simep-ranking-linha {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1.4fr) minmax(0, 1fr) auto 3.2rem;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

a.simep-ranking-linha:hover {
    background: rgb(243 244 246);
}

.dark a.simep-ranking-linha:hover {
    background: rgb(255 255 255 / .05);
}

.simep-ranking-posicao {
    color: rgb(156 163 175);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.simep-ranking-nome {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 500;
}

.simep-ranking-nome small {
    display: block;
    color: rgb(107 114 128);
    font-size: 11px;
    font-weight: 400;
}

.simep-ranking-barra {
    height: 8px;
    border-radius: 999px;
    background: rgb(229 231 235);
    overflow: hidden;
}

.dark .simep-ranking-barra {
    background: rgb(255 255 255 / .08);
}

.simep-ranking-barra > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.simep-ranking-outros .simep-ranking-nome {
    color: rgb(107 114 128);
    font-weight: 400;
}

.simep-ranking-outros .simep-ranking-barra > span {
    background: rgb(156 163 175);
}

.simep-ranking-valor {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.simep-ranking-percentual {
    color: rgb(107 114 128);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.simep-ranking-vazio {
    padding: 12px 8px;
    color: rgb(107 114 128);
}

@media (max-width: 640px) {
    .simep-ranking-linha {
        grid-template-columns: 1.2rem minmax(0, 1fr) auto;
    }

    .simep-ranking-barra,
    .simep-ranking-percentual {
        display: none;
    }
}

.simep-ranking-sem-percentual .simep-ranking-linha {
    grid-template-columns: 1.5rem minmax(0, 1.4fr) minmax(0, 1.4fr) 8.5rem;
}

.simep-ranking-alerta .simep-ranking-barra > span {
    background: linear-gradient(90deg, #fbbf24, #f97316);
}

@media (max-width: 640px) {
    .simep-ranking-sem-percentual .simep-ranking-linha {
        grid-template-columns: 1.2rem minmax(0, 1fr) auto;
    }
}

/* Mapa de bolhas do painel */
.simep-mapa {
    height: 480px;
    border-radius: 10px;
    overflow: hidden;
    z-index: 0;
}

.simep-mapa-rodape {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: rgb(107 114 128);
    font-size: 12px;
}

.simep-mapa-legenda {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.simep-mapa-bolha {
    display: inline-block;
    border: 1px solid rgb(29 78 216 / .7);
    border-radius: 999px;
    background: rgb(59 130 246 / .35);
}

.simep-mapa-destaques {
    margin-left: auto;
}

@media (max-width: 640px) {
    .simep-mapa {
        height: 360px;
    }

    .simep-mapa-destaques {
        margin-left: 0;
    }
}

/* Login, "esqueci a senha" e portal no celular: card com respiro nas bordas em vez de colado nelas */
@media (max-width: 639px) {
    .fi-simple-main-ctn {
        padding: 1rem;
    }

    .fi-simple-main {
        border-radius: 1rem;
        box-shadow: 0 1px 3px rgb(0 0 0 / .08);
        --tw-ring-shadow: 0 0 0 1px rgb(3 7 18 / .05);
    }
}

/* Pódio "Top 3 responsáveis" */
.simep-podio {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    padding-top: 8px;
}

.simep-podio-lugar {
    color: inherit;
    text-decoration: none;
    border-radius: 12px;
    transition: transform .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 180px;
    text-align: center;
}

.simep-podio-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    border: 3px solid var(--simep-medalha);
    border-radius: 999px;
    background: rgb(239 246 255);
    color: #1d4ed8;
    font-size: 20px;
    font-weight: 700;
}

.simep-podio-ouro .simep-podio-avatar {
    width: 80px;
    height: 80px;
    font-size: 24px;
}

.simep-podio-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    object-fit: cover;
}

.simep-podio-medalha {
    position: absolute;
    right: -6px;
    bottom: -4px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--simep-medalha);
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.simep-podio-nome {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 600;
}

.simep-podio-numero {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.simep-podio-rotulo {
    color: rgb(107 114 128);
    font-size: 12px;
}

.simep-podio-secundario {
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgb(243 244 246);
    color: rgb(75 85 99);
    font-size: 11px;
}

.dark .simep-podio-secundario {
    background: rgb(255 255 255 / .06);
    color: rgb(209 213 219);
}

.simep-podio-degrau {
    width: 100%;
    margin-top: 10px;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, var(--simep-medalha), transparent);
    opacity: .35;
}

a.simep-podio-lugar:hover {
    transform: translateY(-3px);
}

.simep-podio-ouro { --simep-medalha: #eab308; }
.simep-podio-prata { --simep-medalha: #94a3b8; }
.simep-podio-bronze { --simep-medalha: #c2743d; }

.simep-podio-ouro .simep-podio-secundario {
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgb(243 244 246);
    color: rgb(75 85 99);
    font-size: 11px;
}

.dark .simep-podio-secundario {
    background: rgb(255 255 255 / .06);
    color: rgb(209 213 219);
}

.simep-podio-degrau { height: 72px; }
.simep-podio-prata .simep-podio-secundario {
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgb(243 244 246);
    color: rgb(75 85 99);
    font-size: 11px;
}

.dark .simep-podio-secundario {
    background: rgb(255 255 255 / .06);
    color: rgb(209 213 219);
}

.simep-podio-degrau { height: 48px; }
.simep-podio-bronze .simep-podio-secundario {
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgb(243 244 246);
    color: rgb(75 85 99);
    font-size: 11px;
}

.dark .simep-podio-secundario {
    background: rgb(255 255 255 / .06);
    color: rgb(209 213 219);
}

.simep-podio-degrau { height: 32px; }

.dark .simep-podio-avatar {
    background: rgb(255 255 255 / .06);
    color: #93c5fd;
}

@media (max-width: 640px) {
    .simep-podio {
        gap: 8px;
    }

    .simep-podio-lugar {
        width: 33%;
    }
}

/* Celular: nos cards com seletor (período, ordenação), o seletor vai para baixo do título, na largura toda */
@media (max-width: 639px) {
    .fi-section-header:has(.fi-section-header-after-ctn) {
        flex-wrap: wrap;
    }

    .fi-section-header-after-ctn {
        width: 100%;
        margin-inline-start: 0;
    }

    .fi-section-header-after-ctn .fi-input-wrp,
    .simep-ranking-controles {
        width: 100%;
    }

    .simep-ranking-controles > * {
        flex: 1;
        min-width: 0;
    }
}

/* Legenda de cores da lista de peritos (semáforo e situação no CFM) */
.simep-legenda {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: var(--color-white, #fff);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
    outline: 1px solid rgb(3 7 18 / 0.05);
    font-size: 0.8125rem;
    color: var(--gray-600, #4b5563);
}

.dark .simep-legenda {
    background: var(--gray-900, #111827);
    outline-color: rgb(255 255 255 / 0.1);
    color: var(--gray-400, #9ca3af);
}

.simep-legenda-linha {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 1rem;
}

.simep-legenda-titulo {
    min-width: 5rem;
    font-weight: 600;
    color: var(--gray-950, #030712);
}

.dark .simep-legenda-titulo {
    color: var(--color-white, #fff);
}

.simep-legenda-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.simep-legenda-item .fi-badge {
    flex-shrink: 0;
}

.simep-legenda-traco {
    font-weight: 600;
}

.simep-legenda-nota {
    font-style: italic;
    color: var(--gray-400, #9ca3af);
}

/* Nome com badge ao lado (perito com o semáforo na lista e no detalhe do procedimento) */
.simep-nome-com-badge {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

/* Link "Manual" na barra superior: no celular, só o ícone. */
.simep-link-manual {
    margin-inline-end: 0.5rem;
}
@media (max-width: 640px) {
    .simep-link-manual-texto {
        display: none;
    }
}

/* ===== Login do painel da equipe no estilo do site do IMeP (foto, véu azul, chamada e card de vidro) =====
   A foto, o véu e a chamada vêm de resources/views/filament/login-hero.blade.php (gancho no AdminPanelProvider). */
@font-face {
    font-family: "Instrument Serif";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/instrument-serif/instrument-serif-italic-latin.woff2") format("woff2");
}

.fi-panel-admin .fi-simple-layout {
    --simep-navy-950: #010f33;
    --simep-navy-900: #011a52;
    --simep-azul: #0057d2;
    --simep-ceu: #6bc0ff;
    --simep-ease: cubic-bezier(.22, 1, .36, 1);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 4rem;
    padding: 2.5rem clamp(1rem, 4vw, 2.5rem);
    background: var(--simep-navy-900);
}

.simep-hero-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 62% 40%;
    transform: scale(1.06);
    animation: simep-hero-zoom 18s var(--simep-ease) forwards;
}

.simep-hero-veu {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(90deg, rgba(1, 15, 51, .97) 0%, rgba(1, 26, 82, .9) 32%, rgba(2, 40, 121, .5) 58%, rgba(2, 40, 121, .25) 100%),
        linear-gradient(0deg, rgba(1, 15, 51, .95) 0%, rgba(1, 15, 51, 0) 28%);
}

.simep-hero-chamada {
    flex: 0 1 38rem;
    color: #fff;
    font-family: "Inter", system-ui, sans-serif;
}

.simep-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--simep-ceu);
}

.simep-hero-ponto {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--simep-ceu);
    box-shadow: 0 0 0 4px rgba(107, 192, 255, .22);
    animation: simep-hero-pulso 2.4s var(--simep-ease) infinite;
}

.simep-hero-titulo {
    margin-bottom: 20px;
    font-size: clamp(2.2rem, 4vw, 3.6rem);
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -.025em;
}

.simep-hero-serif {
    font-family: "Instrument Serif", Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1.12em;
    color: var(--simep-ceu);
}

.simep-hero-texto {
    max-width: 31rem;
    font-size: 1.1rem;
    font-weight: 350;
    line-height: 1.55;
    color: rgba(255, 255, 255, .74);
}

.fi-panel-admin .fi-simple-main-ctn {
    flex: 0 1 27.5rem;
    width: auto;
}

.fi-panel-admin .fi-simple-main {
    max-width: 27.5rem;
    margin: 0;
    padding: 2.5rem 2.25rem 2rem;
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 18px;
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    box-shadow: 0 30px 80px -24px rgba(1, 15, 51, .7);
    --tw-ring-shadow: 0 0 #0000;
}

.dark .fi-panel-admin .fi-simple-main {
    background: rgba(1, 26, 82, .72);
    border-color: rgba(255, 255, 255, .18);
}

.fi-panel-admin .fi-simple-main .fi-simple-header-heading {
    font-weight: 600;
    color: var(--simep-navy-900);
}

.dark .fi-panel-admin .fi-simple-main .fi-simple-header-heading {
    color: #fff;
}

/* Botão principal com o azul e o brilho do site */
.fi-panel-admin .fi-simple-main .fi-btn.fi-color-primary {
    min-height: 3rem;
    background: var(--simep-azul) !important;
    color: #fff !important;
    box-shadow: 0 10px 30px -12px rgba(0, 87, 210, .8), inset 0 1px 0 rgba(255, 255, 255, .22);
    transition: transform .25s var(--simep-ease), background-color .25s, box-shadow .25s;
}

.fi-panel-admin .fi-simple-main .fi-btn.fi-color-primary:hover {
    background: #0a63e0 !important;
    transform: translateY(-2px);
    box-shadow: 0 16px 36px -12px rgba(0, 87, 210, .9), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.simep-login-rodape {
    margin-top: 1.5rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(71, 94, 117, .15);
    text-align: center;
    font-size: .78rem;
    color: #475e75;
}

.dark .simep-login-rodape {
    border-color: rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .6);
}

@keyframes simep-hero-zoom { to { transform: scale(1); } }
@keyframes simep-hero-pulso { 50% { box-shadow: 0 0 0 8px rgba(107, 192, 255, 0); } }

/* Tela estreita: só o card sobre a foto */
@media (max-width: 1023px) {
    .simep-hero-chamada {
        display: none;
    }
}

@media (max-width: 639px) {
    .fi-panel-admin .fi-simple-layout {
        padding: 1rem;
    }

    .fi-panel-admin .fi-simple-main-ctn {
        padding: 0;
        flex-basis: 100%;
    }

    .fi-panel-admin .fi-simple-main {
        padding: 2rem 1.5rem 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .simep-hero-bg,
    .simep-hero-ponto {
        animation: none;
    }

    .simep-hero-bg {
        transform: none;
    }
}
