:root {
    /* =========================================================
       VARIÁVEIS DE CORES (PALETA CFM)
    ========================================================= */
    --cfm-green: #008148;
    --cfm-green-light: #008f4c;
    --cfm-green-dark: #006633;
    --cfm-dark: #005c33;

    --cfm-brand: #0a6b4a;
    --cfm-brand-hover: #085239;

    --text-main: #1e293b;
    --text-dark: #111827;
    --text-muted: #6b7280;
    --text-white-soft: rgba(255, 255, 255, 0.75);

    --bg-body: #f4f6f9;
    --bg-light: #f8fafc;
    --bg-gray: #f3f4f6;
    --bg-success-light: #ecfdf5;

    --border-color: #d1d5db;
    --border-light: #e5e7eb;
    --border-soft: #e2e8f0;

    /* =========================================================
       EFEITOS E TRANSIÇÕES
    ========================================================= */
    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-green: 0 10px 20px rgba(0, 129, 72, 0.15);

    --transition: all .2s ease;
    --transition-slow: all .3s ease;

    /* =========================================================
       BORDAS ARREDONDADAS
    ========================================================= */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-pill: 999px;
}

/* =========================================================
   ESTILOS GLOBAIS BASE
========================================================= */
body {
    background: #f4f4f7;
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.bg-brand-gradient,
.bg-cfm-green {
    background: linear-gradient(135deg, var(--cfm-green) 0%, var(--cfm-dark) 100%);
}

/* =========================================================
   COMPONENTE: NAVBAR SUPERIOR (navbar-top)
========================================================= */
.navbar-top {
    background: linear-gradient(135deg, var(--cfm-green) 0%, var(--cfm-green-dark) 100%);
    padding: 1rem 2rem;
    min-height: 80px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
    position: relative;
    z-index: 100;
}

.navbar-top img {
    max-height: 42px;
    object-fit: contain;
}

.header-logo-box {
    width: 50px;
    height: 50px;
}

.navbar-top h1 {
    font-size: 1.1rem;
    letter-spacing: -.2px;
}

.navbar-top small {
    color: var(--text-white-soft);
    font-size: .82rem;
}

.navbar-top a {
    transition: var(--transition);
}

.navbar-top .border-start {
    border-left: 1px solid rgba(255, 255, 255, .2) !important;
}

.navbar-main,
.navbar-main>.min-w-0 {
    min-width: 0;
}

/* =========================================================
   COMPONENTE: SIDEBAR MENU (flat-nav)
========================================================= */
.flat-nav {
    list-style: none;
    margin: 0;
    padding: 1.5rem 1rem;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .04);
}

.nav-category {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0 .75rem;
}

.flat-nav-item {
    margin-bottom: .35rem;
}

.flat-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    border-radius: var(--radius-lg);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.flat-nav-link i {
    font-size: 1rem;
    transition: var(--transition);
}

.flat-nav-link:hover {
    background: var(--bg-success-light);
    color: var(--cfm-green);
    transform: translateX(3px);
}

.flat-nav-link:hover i {
    transform: scale(1.08);
}

.flat-nav-link.active {
    background: linear-gradient(135deg, var(--cfm-green) 0%, var(--cfm-green-dark) 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 129, 72, .18);
}

.flat-nav-link.active i {
    color: #fff;
}
/* =========================================================
   COMPONENTE: PAGINAÇÃO VERDE (pagination-green)
========================================================= */
.pagination-green .page-link {
    color: #0a6b4a;
}

.pagination-green .page-link:hover {
    color: #064d35;
    background-color: #e9f2ef;
    border-color: #dee2e6;
}

.pagination-green .page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: #0a6b4a;
    border-color: #0a6b4a;
}

.pagination-green .page-link:focus {
    box-shadow: 0 0 0 .25rem rgba(10, 107, 74, .25);
}

/* =========================================================
   COMPONENTE: FORMULÁRIO WIZARD (stepper)
========================================================= */
.formulario-wizard-page .stepper-wrapper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    position: relative;
}

.formulario-wizard-page .stepper-wrapper::before {
    content: "";
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.formulario-wizard-page .stepper-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    z-index: 1;
}

.formulario-wizard-page .stepper-item::before {
    content: "";
    position: absolute;
    top: 20px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--cfm-green);
    z-index: -1;
    transition: all 0.4s ease;
    transform: scaleX(0);
    transform-origin: left;
}

.formulario-wizard-page .stepper-item:first-child::before {
    display: none;
}

.formulario-wizard-page .stepper-item.completed::before,
.formulario-wizard-page .stepper-item.active::before {
    transform: scaleX(1);
}

.formulario-wizard-page .step-counter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #fff;
}

.formulario-wizard-page .stepper-item.active .step-counter {
    background: var(--cfm-green);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 118, 58, 0.2);
}

.formulario-wizard-page .stepper-item.completed .step-counter {
    background: var(--cfm-green);
    color: #fff;
}

.formulario-wizard-page .step-name {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    text-align: center;
}

.formulario-wizard-page .stepper-item.active .step-name {
    color: var(--cfm-green);
    font-weight: 700;
}

.formulario-wizard-page .form-step {
    display: none;
    animation: wizardFadeIn 0.4s ease-in-out;
}

.formulario-wizard-page .form-step.active {
    display: block;
}

@keyframes wizardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   COMPONENTE: GRÁFICOS DO DASHBOARD (donut & status-pie)
========================================================= */
.donut-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
}

.donut-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-bg {
    fill: none;
    stroke: #f1f5f9;
    stroke-width: 4;
}

.donut-fill {
    fill: none;
    stroke: #0d6efd;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease-out;
}

.donut-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.status-pie {
    position: relative;
    width: 180px;
    height: 180px;
    flex: 0 0 auto;
    margin-inline: auto;
}

.status-pie__chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(#198754 0 calc(var(--status-approved) * 1%),
            #ffc107 calc(var(--status-approved) * 1%) calc((var(--status-approved) + var(--status-pending)) * 1%),
            #dc3545 calc((var(--status-approved) + var(--status-pending)) * 1%) 100%);
    border: 1px solid #e2e8f0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.status-pie__chart--empty {
    background: #e2e8f0;
}

.status-pie__center {
    position: absolute;
    inset: 50%;
    transform: translate(-50%, -50%);
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.public-hero {
    background: linear-gradient(132deg, var(--cfm-brand) 0%, var(--cfm-dark) 58%, var(--cfm-green-dark) 100%) !important;
    box-shadow: 0 16px 32px rgba(0, 92, 51, 0.25) !important;
}

.public-hero::after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    right: -90px;
    top: -120px;
    pointer-events: none;
}

.public-form-card.is-locked {
    opacity: 0.5;
    filter: grayscale(0.1);
    box-shadow: none !important;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.public-form-card.is-collapsed {
    border-style: dashed !important;
}

.dropdown-item-custom:active,
.dropdown-item-custom.active {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

/* =========================================================
   MEDIA QUERIES RESPONSIVAS
========================================================= */
@media (max-width: 991.98px) {
    .navbar-top {
        padding: 1rem 1.25rem;
    }

    .navbar-top h1 {
        font-size: 1rem;
    }

    .flat-nav {
        margin-bottom: 1.5rem;
    }

    .g-recaptcha {
        transform: scale(.92);
    }
}

@media (max-width: 768px) {
    .formulario-wizard-page .step-name {
        display: none;
    }
}

@media (max-width: 576px) {
    .navbar-top {
        padding: 1rem 1rem 1.15rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start !important;
    }

    .navbar-top>div {
        width: 100%;
    }

    .navbar-meta {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.8rem !important;
    }

    .navbar-user {
        margin-left: auto;
    }

    .header-logo-box {
        width: 46px;
        height: 46px;
    }

    .navbar-top h1 {
        font-size: .95rem;
        line-height: 1.35;
        white-space: normal;
    }

    .navbar-top .border-start {
        border-left: none !important;
        padding-left: 0 !important;
    }

    .g-recaptcha {
        transform: scale(.82);
        transform-origin: center center;
    }
}

.custom-green-switch:checked {
    background-color: #008148 !important;
    border-color: #008148 !important;
}

.custom-green-switch:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 129, 72, 0.25) !important;
    border-color: #008148 !important;
}

.sigilo-nav-tabs .nav-link {
    color: #4b5563 !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    transition: all 0.2s ease-in-out;
}

/* --- ABA TODOS --- */
.sigilo-nav-tabs #tab-todos:hover:not(.active) {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border-color: #94a3b8 !important;
}

.sigilo-nav-tabs #tab-todos.active {
    background-color: #334155 !important;
    color: #ffffff !important;
    border-color: #334155 !important;
    box-shadow: 0 4px 12px rgba(51, 65, 85, 0.2);
}

/* --- ABA VIGENTES --- */
.sigilo-nav-tabs #tab-vigentes:hover:not(.active) {
    background-color: #ecfdf5 !important;
    color: #008148 !important;
    border-color: #a7f3d0 !important;
}

.sigilo-nav-tabs #tab-vigentes.active {
    background-color: #008148 !important;
    color: #ffffff !important;
    border-color: #008148 !important;
    box-shadow: 0 4px 12px rgba(0, 129, 72, 0.2);
}

.sigilo-nav-tabs #tab-vigentes.active .badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

/* --- ABA EXPIRADOS --- */
.sigilo-nav-tabs #tab-expirados:hover:not(.active) {
    background-color: #fef2f2 !important;
    color: #dc3545 !important;
    border-color: #fca5a5 !important;
}

.sigilo-nav-tabs #tab-expirados.active {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    border-color: #dc3545 !important;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.sigilo-nav-tabs #tab-expirados.active .badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

.custom-nav-pills .nav-link:hover:not(.active) {
    background-color: #ecfdf5;
    color: #008148;
}

.nav.nav-pills.custom-nav-pills {
    background-color: #eeeef2;
    padding: 0.35rem;
}

.nav.nav-pills.custom-nav-pills .nav-link {
    color: #4b5563 !important;
    font-weight: 600;
    font-size: 0.92rem;
    background-color: transparent !important;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}

.nav.nav-pills.custom-nav-pills .nav-link i {
    color: inherit !important;
}

.nav.nav-pills.custom-nav-pills .nav-link:hover:not(.active) {
    background-color: #ecfdf5 !important;
    color: var(--cfm-green) !important;
}

.nav.nav-pills.custom-nav-pills .nav-link.active {
    background-color: var(--cfm-green) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 129, 72, 0.2) !important;
}
/* =========================================================
   AJUSTES RESPONSIVOS COMPLEMENTARES
========================================================= */

/* Trava qualquer estouro horizontal residual em telas pequenas */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Quebra palavras longas (e-mails, chaves, razões sociais) em vez de estourar o card */
.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6 {
    overflow-wrap: anywhere;
}

/* Utilitário usado nos formulários (botão ocupa a linha no mobile e encolhe a partir de sm) */
@media (min-width: 576px) {
    .w-sm-auto {
        width: auto !important;
    }
}

/* Wizard do formulário: mantém os 4 passos visíveis mesmo em telas estreitas */
@media (max-width: 575.98px) {
    .formulario-wizard-page .stepper-wrapper {
        gap: 0.5rem;
    }

    .formulario-wizard-page .step-counter {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .public-hero {
        text-align: left;
    }

    .public-hero::after {
        width: 160px;
        height: 160px;
        right: -70px;
        top: -80px;
    }
}

/* =========================================================
   PÁGINAS PÚBLICAS: CARDS DE PASSO A PASSO E HERO
========================================================= */

/* Caixa da imagem dos passos: altura fluida, mesma proporção em todos os cards */
.public-step-media {
    height: clamp(170px, 40vw, 200px);
}

.public-pet-image {
    max-width: 100%;
    max-height: clamp(105px, 26vw, 130px);
    object-fit: contain;
    cursor: pointer;
}

@media (max-width: 575.98px) {
    .public-hero {
        padding: 1.5rem !important;
    }

    .public-hero h1 {
        font-size: 1.6rem;
    }

    .public-hero .lead {
        font-size: 0.95rem !important;
    }

    /* Cartões de contato: e-mail e telefones longos quebram em vez de estourar */
    .public-contact-card {
        width: 100%;
    }
}

/* Permite que filhos de flex encolham e quebrem textos longos */
.min-w-0 {
    min-width: 0;
}


/* Card-link de chamada para acao (ex.: acesso ao SEI no peticionamento) */
.public-cta-card {
    border: 1px dashed rgba(54, 113, 81, 0.45);
    background: linear-gradient(180deg, rgba(54, 113, 81, 0.06), rgba(54, 113, 81, 0.12));
    color: inherit;
    cursor: pointer;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, background .25s ease;
}

.public-cta-card:hover,
.public-cta-card:focus-visible {
    transform: translateY(-4px);
    border-style: solid;
    border-color: #367151;
    background: linear-gradient(180deg, rgba(54, 113, 81, 0.12), rgba(54, 113, 81, 0.2));
    box-shadow: 0 .75rem 1.5rem rgba(54, 113, 81, .25);
    color: inherit;
}

.public-cta-card:focus-visible {
    outline: 3px solid rgba(54, 113, 81, .45);
    outline-offset: 2px;
}

.public-cta-card__icon {
    width: 56px;
    height: 56px;
    background-color: rgba(54, 113, 81, .15);
    color: #367151;
    font-size: 1.5rem;
    transition: transform .25s ease, background-color .25s ease;
}

.public-cta-card:hover .public-cta-card__icon,
.public-cta-card:focus-visible .public-cta-card__icon {
    transform: scale(1.08);
    background-color: rgba(54, 113, 81, .25);
}

.public-cta-card__text {
    color: #6c757d;
}

.public-cta-card__arrow {
    transition: transform .25s ease;
}

.public-cta-card:hover .public-cta-card__arrow,
.public-cta-card:focus-visible .public-cta-card__arrow {
    transform: translateX(4px);
}

.public-cta-card:hover .public-cta-card__action,
.public-cta-card:focus-visible .public-cta-card__action {
    box-shadow: 0 .5rem 1rem rgba(54, 113, 81, .35) !important;
}

@media (prefers-reduced-motion: reduce) {

    .public-cta-card,
    .public-cta-card__icon,
    .public-cta-card__arrow {
        transition: none;
    }

    .public-cta-card:hover,
    .public-cta-card:focus-visible {
        transform: none;
    }
}

/* Icone da area de contato do acompanhamento (peticionamento) */
.public-help-icon {
    width: 56px;
    height: 56px;
    background-color: rgba(54, 113, 81, .15);
    color: #367151;
    font-size: 1.5rem;
}

/* Mensagem de retorno dos botoes "Copiar" */
.public-copiar-feedback {
    animation: publicCopiarFeedback .18s ease-out;
}

@keyframes publicCopiarFeedback {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .public-copiar-feedback {
        animation: none;
    }
}

/* E-mail dentro do campo de copiar: no mobile encolhe e fica sempre em uma linha so */
.public-email-copiar {
    /* acompanha a largura da tela para caber sempre em uma linha so */
    font-size: clamp(0.6rem, 2.75vw, 1rem);
    white-space: nowrap;
}

.public-email-copiar > [data-copiar-alvo] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Abaixo de 360px nao ha largura para uma linha so com texto legivel:
   ali o endereco quebra em vez de aparecer cortado com reticencias. */
@media (max-width: 359.98px) {
    .public-email-copiar {
        white-space: normal;
    }

    .public-email-copiar > [data-copiar-alvo] {
        overflow: visible;
        text-overflow: clip;
        word-break: break-all;
    }
}

@media (min-width: 576px) {
    .public-email-copiar {
        font-size: 1rem;
    }
}

/* Topicos numerados dentro dos cards de passo (peticionamento).
   Uma coluna so, tipografia compacta: o texto de cada topico fica inteiro
   na linha em vez de ser espremido em colunas estreitas. */
.public-passo-topicos {
    font-size: .75rem;
    line-height: 1.35;
}

/* No passo com lista de topicos a lupa fica sobreposta a imagem: o bloco da
   imagem deixa de gastar altura com o botao e o card nao cresce. */
.public-step-media-compacta {
    height: auto;
}

.public-passo-topico-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 50%;
    background-color: rgba(54, 113, 81, .15);
    color: #367151;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1;
}
