:root {
    /* Cores exatas da marca Bitelli: preto esverdeado e verde menta */
    --brand: #041612;
    --brand-dark: #0C2822;
    --brand-soft: #E8FFF6;
    --accent: #00FFA3;
    --accent-forte: #00D488;
    --accent-soft: #D9FFF0;
    --bg: #F4F7F6;
    --surface: #ffffff;
    --surface-soft: #F0F4F2;
    --border: #E3E9E7;
    --border-forte: #C7D3CF;
    --text: #041612;
    --muted: #5E726C;
    --ok: #0F7A55;
    --ok-soft: #E3F7EE;
    --erro: #B42318;
    --erro-soft: #FEF3F2;
    --aviso: #8A5A12;
    --aviso-soft: #FFFAEB;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(4, 22, 18, 0.07);
    --shadow-sm: 0 1px 2px rgba(4, 22, 18, .05), 0 4px 12px rgba(4, 22, 18, .04);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

/* ------------------------------------------------------------
   Topbar
------------------------------------------------------------ */
.topbar {
    background: var(--surface);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-inner {
    max-width: 1360px;
    margin: 0 auto;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    gap: 26px;
    flex-wrap: wrap;
}

.topbar-brand { display: flex; align-items: center; gap: 14px; }

.topbar-logo { height: 34px; width: auto; display: block; }

/* Nome do cliente do ambiente, ao lado da marca da consultoria */
.cliente-pill {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-forte);
    background: var(--surface-soft);
    font-size: 12.5px;
    font-weight: 650;
    color: var(--muted);
    white-space: nowrap;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--accent);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 700;
}

.topbar-title { font-size: 16px; font-weight: 700; line-height: 1.2; }
.topbar-subtitle { font-size: 12px; color: var(--muted); }

.topbar-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }

.nav-link {
    color: #3A4B45;
    padding: 8px 13px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 550;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover { background: var(--surface-soft); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--accent); color: var(--brand); font-weight: 650; }

.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-info { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------
   Shell e cabecalho de pagina
------------------------------------------------------------ */
.shell {
    max-width: 1360px;
    margin: 0 auto;
    padding: 26px 22px 60px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head h1 { font-size: 26px; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------
   Cards
------------------------------------------------------------ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px 22px;
    margin-bottom: 18px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.card-head h2 { font-size: 17px; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.card-sub { color: var(--muted); font-size: 13px; margin: -8px 0 14px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ------------------------------------------------------------
   KPIs
------------------------------------------------------------ */
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.kpi-rotulo {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 650;
}

.kpi-valor { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.kpi-detalhe { font-size: 12px; color: var(--muted); margin-top: 5px; }
.kpi-var { font-size: 12px; font-weight: 600; margin-top: 5px; }
.kpi-var.up { color: var(--ok); }
.kpi-var.down { color: var(--erro); }

.kpi-positivo { border-left: 4px solid var(--ok); }
.kpi-negativo { border-left: 4px solid var(--erro); }
.kpi-destaque { border-left: 4px solid var(--accent); }
.kpi-neutro { border-left: 4px solid var(--border-forte); }

/* ------------------------------------------------------------
   Botoes
------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }

.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; width: 100%; }

.btn-ghost { background: transparent; border-color: var(--border-forte); color: var(--text); }
.btn-ghost:hover { background: var(--surface-soft); color: var(--text); }

.btn-dark { background: var(--brand-dark); }

.btn-claro { background: var(--surface); color: var(--brand); border-color: var(--border-forte); }
.btn-claro:hover { background: var(--surface-soft); color: var(--brand); }

.btn-accent { background: var(--accent); color: var(--brand); }
.btn-accent:hover { background: var(--accent-forte); color: var(--brand); }

.btn-perigo { background: var(--erro); }
.btn-perigo:hover { background: #93231a; }

/* ------------------------------------------------------------
   Formularios
------------------------------------------------------------ */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-linha-cheia { grid-column: 1 / -1; }

label.campo { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #35443e; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="month"],
select,
textarea {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border-forte);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 84px; }

input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 255, 163, 0.28);
}

.campo-dica { font-size: 12px; color: var(--muted); font-weight: 400; }

.form-acoes {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.check-linha { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; }
.check-linha input { width: 17px; height: 17px; margin: 0; }

/* Filtros */
.filtros {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.filtros label.campo { min-width: 150px; flex: 1; }

/* ------------------------------------------------------------
   Tabelas
------------------------------------------------------------ */
.tabela-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

table.tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.tabela th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-forte);
    white-space: nowrap;
    background: var(--surface-soft);
}

table.tabela td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.tabela tbody tr:hover { background: var(--surface-soft); }
table.tabela tbody tr:last-child td { border-bottom: none; }

.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acoes-col { text-align: right; white-space: nowrap; }
.tabela-vazia { text-align: center; color: var(--muted); padding: 34px 12px; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 650;
    background: var(--surface-soft);
    border: 1px solid var(--border-forte);
    color: var(--muted);
    white-space: nowrap;
}

.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: #b9e3d6; }
.badge-alerta { background: var(--aviso-soft); color: var(--aviso); border-color: #fde9b5; }
.badge-erro { background: var(--erro-soft); color: var(--erro); border-color: #fecdc9; }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: #c9dcd4; }
.badge-accent { background: var(--accent-soft); color: #05614A; border-color: #A9F5D8; }

/* ------------------------------------------------------------
   Alertas
------------------------------------------------------------ */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}

.alert-ok { background: var(--ok-soft); color: #0f5f4a; border-color: #b9e3d6; }
.alert-erro { background: var(--erro-soft); color: var(--erro); border-color: #fecdc9; }
.alert-aviso { background: var(--aviso-soft); color: var(--aviso); border-color: #fde9b5; }
.alert-info { background: var(--brand-soft); color: var(--brand); border-color: #c9dcd4; }

/* ------------------------------------------------------------
   Barras de ranking
------------------------------------------------------------ */
.barra-linha { margin-bottom: 13px; }
.barra-topo { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 5px; }
.barra-rotulo { font-weight: 550; }
.barra-valor { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.barra-comp { color: var(--muted); font-size: 12px; }
.barra-trilho { height: 8px; background: var(--surface-soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.barra-preenchida { height: 100%; background: linear-gradient(90deg, var(--brand) 0%, #14453A 100%); border-radius: 999px; }

/* ------------------------------------------------------------
   DRE
------------------------------------------------------------ */
table.dre { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.dre td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
table.dre td.num { font-variant-numeric: tabular-nums; }

tr.dre-total td { font-weight: 700; background: var(--surface-soft); border-top: 2px solid var(--border-forte); }
tr.dre-resultado td { font-weight: 700; background: var(--brand-soft); color: var(--brand); font-size: 15.5px; }
tr.dre-detalhe td { color: var(--muted); font-size: 13.5px; }
tr.dre-detalhe td:first-child { padding-left: 30px; }
tr.dre-secao td { font-weight: 650; padding-top: 14px; }
.dre-pct { color: var(--muted); font-size: 12.5px; width: 82px; }
.dre-nota { font-size: 12.5px; color: var(--muted); margin-top: 12px; }

/* ------------------------------------------------------------
   Analise da IA
------------------------------------------------------------ */
/* O painel tinha gradiente, sombra, borda de 4px e 22px de padding. Somado
   ao texto corrido que o modelo escrevia, virava um bloco que ninguem lia
   ate o fim. Agora o texto vem em marcadores (regrasDeFormato no ia.php) e
   o painel sai da frente: fundo chapado, borda fina, foco na leitura. */
.ia-painel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px 24px;
}

/* Cada bloco da analise vira uma secao com regua propria. Sem isso os
   quatro titulos flutuavam no meio do texto e o olho nao achava onde
   comecava cada assunto. */
.ia-painel .ia-titulo {
    font-size: 11.5px;
    font-weight: 700;
    margin: 30px 0 12px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.ia-painel .ia-titulo:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* Medida de leitura: linha muito longa cansa antes do fim do paragrafo. */
.ia-painel p { margin: 0 0 11px; line-height: 1.6; max-width: 76ch; }

.ia-lista {
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 9px;
    max-width: 76ch;
}

.ia-lista li {
    position: relative;
    padding-left: 19px;
    line-height: 1.6;
    font-size: 14.5px;
}

/* Marcador proprio, alinhado a primeira linha e discreto - o ponto nao
   compete com o numero em negrito que abre cada frase. */
.ia-lista li::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-forte);
}

.ia-lista li strong { color: var(--brand); }
.ia-meta { font-size: 12px; color: var(--muted); margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }

.ia-vazio { text-align: center; padding: 40px 20px; color: var(--muted); }
.ia-vazio h3 { color: var(--text); margin-bottom: 8px; }

/* ------------------------------------------------------------
   Graficos SVG
------------------------------------------------------------ */
.grafico { width: 100%; height: auto; display: block; }
.grafico-legenda { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legenda-item { display: flex; align-items: center; gap: 6px; }
.legenda-cor { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ------------------------------------------------------------
   Login
------------------------------------------------------------ */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(0,255,163,0.16) 0%, transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(0,255,163,0.10) 0%, transparent 40%),
        var(--brand);
    padding: 24px;
}

.login-logo { height: 46px; width: auto; margin: 0 auto 18px; display: block; }
.login-logo-cliente { height: 38px; width: auto; margin: 14px auto 0; display: block; }

/* Visivel so para leitor de tela */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.login-card {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.22);
    padding: 34px 34px 30px;
    width: 100%;
    max-width: 420px;
}

.login-brand { text-align: center; margin-bottom: 26px; }

.login-brand .brand-mark {
    width: 56px;
    height: 56px;
    font-size: 27px;
    margin: 0 auto 14px;
    border-radius: 16px;
}

.login-brand h1 { font-size: 21px; }
.login-brand p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }

.login-form { display: grid; gap: 16px; }
.login-rodape { text-align: center; margin-top: 22px; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------
   Mercado
------------------------------------------------------------ */
.cnpj-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.cnpj-form label.campo { flex: 1; min-width: 240px; }

.dado-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.dado-item { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; }
.dado-rotulo { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 650; }
.dado-valor { font-size: 14.5px; font-weight: 600; margin-top: 3px; word-break: break-word; }

.fonte-nota { font-size: 12px; color: var(--muted); margin-top: 14px; }

/* ------------------------------------------------------------
   Paginacao
------------------------------------------------------------ */
.paginacao { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

.paginacao a, .paginacao span {
    min-width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid var(--border-forte);
    background: var(--surface);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.paginacao a:hover { background: var(--surface-soft); text-decoration: none; }
.paginacao .atual { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ------------------------------------------------------------
   Rodape
------------------------------------------------------------ */
.rodape {
    max-width: 1360px;
    margin: 0 auto;
    padding: 20px 22px 30px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12.5px;
    border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------
   Responsivo
------------------------------------------------------------ */
@media (max-width: 1100px) {
    .grid-5, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
    .topbar-inner { gap: 12px; }
    .topbar-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 4px; }
    .topbar-user { margin-left: auto; }
    .user-info { display: none; }
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 22px; }
    .shell { padding: 18px 14px 50px; }
    .card { padding: 16px; }
}

@media print {
    .topbar, .rodape, .page-head-actions, .filtros, .btn { display: none !important; }
    .insight { page-break-inside: avoid; break-inside: avoid; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    body { background: #fff; }
}

/* ------------------------------------------------------------
   Caixa de destaques (calculados, sem IA)
------------------------------------------------------------ */
/* Seis destaques em caixas de 12px de padding com borda e respiro viravam
   um bloco alto que ninguem le ate o fim. Aqui o tom vira um marcador e a
   separacao vira um fio: mesma informacao, altura bem menor, leitura de
   lista em vez de leitura de blocos. */
.insights-card { border-left: 3px solid var(--accent); }

.insights-lista {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.insight {
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 12px;
    align-items: start;
    padding: 11px 0;
    border-top: 1px solid var(--border);
}

.insight:first-child { border-top: 0; padding-top: 2px; }
.insight:last-child { padding-bottom: 2px; }

.insight-marca {
    font-size: 12.5px;
    line-height: 1.6;
    text-align: center;
    color: var(--border-forte);
}

.insight-corpo { display: grid; gap: 2px; min-width: 0; }

.insight-titulo {
    font-weight: 650;
    font-size: 14.5px;
    line-height: 1.45;
    color: var(--text);
}

.insight-texto {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

/* A cor fica so no marcador. O fundo inteiro tingido competia com o
   texto e com os cartoes de KPI logo acima. */
.insight-alerta .insight-marca { color: var(--erro); }
.insight-atencao .insight-marca { color: var(--aviso); }
.insight-oportunidade .insight-marca { color: #05614A; }
.insight-positivo .insight-marca { color: var(--ok); }
.insight-neutro .insight-marca { color: var(--border-forte); }

/* Logo do cliente ao lado da marca da consultoria */
.marca-divisor { width: 1px; height: 28px; background: var(--border-forte); display: inline-block; }
.topbar-logo-cliente {
    height: 36px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
    display: block;
}

@media (max-width: 780px) {
    /* Em tela pequena a marca da consultoria basta; a do cliente some para
       nao empurrar o menu para uma terceira linha. */
    .topbar-logo-cliente, .marca-divisor { display: none; }
}

/* ------------------------------------------------------------
   Avaliacoes do Google
------------------------------------------------------------ */
.avaliacao {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 15px 17px;
    background: var(--surface-soft);
}

.avaliacao-melhor { border-left: 3px solid var(--ok); }
.avaliacao-pior { border-left: 3px solid var(--aviso); }

.avaliacao-tag {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.avaliacao-nota { color: #B8860B; font-size: 15px; margin: 6px 0 8px; letter-spacing: 1px; }
.avaliacao-texto { margin: 0 0 10px; font-size: 14px; line-height: 1.55; }
.avaliacao-autor { font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------
   Busca rapida de loja (Concorrentes)
------------------------------------------------------------ */
.busca-rapida { position: relative; }

.busca-rapida-campo {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-forte);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.busca-rapida-campo:focus {
    border-color: var(--accent-forte);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.busca-rapida-campo::placeholder { color: var(--muted); }

.busca-rapida-painel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 380px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-forte);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.busca-rapida-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 11px 16px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.busca-rapida-item:last-child { border-bottom: 0; }

.busca-rapida-item:hover,
.busca-rapida-item.is-ativo { background: var(--brand-soft); }

.busca-rapida-item[disabled] { cursor: default; opacity: .62; }
.busca-rapida-item[disabled]:hover { background: transparent; }

.busca-rapida-nome { font-weight: 650; }

.busca-rapida-meta {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--muted);
}

.busca-rapida-tag {
    float: right;
    margin-left: 10px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
}

.busca-rapida-tag.is-monitorada { background: var(--accent-soft); color: var(--ok); }
.busca-rapida-tag.is-baixada { background: var(--erro-soft); color: var(--erro); }

.busca-rapida-aviso {
    padding: 13px 16px;
    font-size: 13.5px;
    color: var(--muted);
}

.busca-rapida-rodape {
    padding: 9px 16px;
    font-size: 12.5px;
    color: var(--muted);
    background: var(--surface-soft);
    border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------
   Demografia: piramide etaria, renda e contas abertas
------------------------------------------------------------ */
.piramide { display: grid; gap: 3px; }

.piramide-legenda {
    display: flex;
    justify-content: center;
    gap: 22px;
    margin-bottom: 12px;
    font-size: 12.5px;
    color: var(--muted);
}

.piramide-chave {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: -1px;
}

.piramide-chave.lado-h { background: var(--brand-dark); }
.piramide-chave.lado-m { background: var(--accent-forte); }

.piramide-linha {
    display: grid;
    grid-template-columns: 1fr 108px 1fr;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    border-radius: 6px;
}

/* A faixa que faz parte do publico-alvo configurado fica marcada:
   e o recorte que o resto da pagina usa nas contas. */
.piramide-linha.no-alvo { background: var(--brand-soft); }

.piramide-lado { display: flex; align-items: center; gap: 7px; }
.piramide-lado.esquerda { justify-content: flex-end; }
.piramide-lado.direita { justify-content: flex-start; }

.piramide-barra {
    height: 15px;
    border-radius: 3px;
    min-width: 2px;
}

.piramide-barra.lado-h { background: var(--brand-dark); }
.piramide-barra.lado-m { background: var(--accent-forte); }

.piramide-num {
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.piramide-faixa {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #35443e;
    white-space: nowrap;
}

.renda-lista { display: grid; gap: 9px; }

.renda-linha {
    display: grid;
    grid-template-columns: 210px 1fr 118px;
    align-items: center;
    gap: 12px;
}

.renda-rotulo { font-size: 13px; color: #35443e; }

.renda-trilho {
    height: 17px;
    background: var(--surface-soft);
    border-radius: 4px;
    overflow: hidden;
}

.renda-barra {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-dark), var(--accent-forte));
    border-radius: 4px;
    min-width: 2px;
}

.renda-valor {
    text-align: right;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.renda-valor span {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
}

/* Bloco que mostra a conta por extenso. Existe porque estimativa sem a
   conta a vista vira numero de autoridade - e este numero nao e. */
.conta-aberta {
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-forte);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: 16px 18px;
}

.conta-aberta h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 10px;
}

.conta-linha {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 9px;
    font-size: 15px;
    margin-bottom: 10px;
}

.conta-op { color: var(--muted); font-weight: 700; }
.conta-aberta .fonte-nota { margin: 0; }

@media (max-width: 780px) {
    .piramide-linha { grid-template-columns: 1fr 86px 1fr; gap: 4px; }
    .piramide-num { display: none; }
    .piramide-faixa { font-size: 11px; }
    .renda-linha { grid-template-columns: 1fr; gap: 4px; }
    .renda-valor { text-align: left; }
}

/* ------------------------------------------------------------
   Botao de atualizar com a opcao de ignorar o cache
------------------------------------------------------------ */
.acao-com-forcar { display: flex; align-items: center; gap: 9px; }

.forcar {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    cursor: pointer;
}

.forcar input { margin: 0; cursor: pointer; }
.forcar:hover { color: var(--text); }

/* ------------------------------------------------------------
   Retorno da consulta de CNPJ (Configuracoes)
------------------------------------------------------------ */
.cnpj-resultado {
    display: grid;
    gap: 3px;
    margin: 4px 0 16px;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-soft);
    font-size: 13.5px;
    line-height: 1.5;
}

.cnpj-resultado > div:first-child { font-weight: 650; }
.cnpj-ok { background: var(--ok-soft); border-color: #B9E3D6; }
.cnpj-erro { background: var(--erro-soft); border-color: #FECDC9; color: var(--erro); }

/* ------------------------------------------------------------
   Atualizar tudo e importar .sql (Configuracoes)
------------------------------------------------------------ */
.etapas { display: grid; gap: 2px; margin-bottom: 18px; }

.etapa {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 10px;
    align-items: start;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    cursor: pointer;
    font-size: 14.5px;
}

.etapa:first-child { border-top: 0; }
.etapa input { margin: 3px 0 0; cursor: pointer; }
.etapa-descricao { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; }

.relatorio { display: grid; margin-top: 18px; border-top: 1px solid var(--border); }

.relatorio-linha {
    display: grid;
    grid-template-columns: 16px 1fr auto;
    gap: 11px;
    align-items: start;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14.5px;
}

.relatorio-linha:last-child { border-bottom: 0; }
.relatorio-marca { text-align: center; font-size: 12.5px; line-height: 1.6; }
.relatorio-detalhe { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.relatorio-detalhe code { font-size: 11.5px; word-break: break-all; }

.relatorio-tempo {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.relatorio-ok .relatorio-marca { color: var(--ok); }
.relatorio-aviso .relatorio-marca { color: var(--aviso); }
.relatorio-erro .relatorio-marca { color: var(--erro); }
.relatorio-neutro .relatorio-marca { color: var(--border-forte); }

input[type="file"] {
    font-size: 13.5px;
    padding: 9px 0;
}
