/* BI Grupo Bergton — padrão visual "Dashboard Executivo" (tokens, componentes e telas menores) */
:root {
  --canvas: #f4f4f4; --surface-100: #ffffff; --surface-200: #f4f4f4; --surface-300: #e8e8e8;
  --ink: #2e2e2e; --ink-muted: #626262; --border: #d6d6d6; --border-strong: #8a8a8a;
  --accent: #0e6b66; --on-accent: #ffffff; --accent-subtle: #e3f1ef;
  --success: #1f7a3d; --danger: #b42318; --danger-bg: #fbeceb; --warning: #8a5a00; --warning-bg: #fbf3e2;
  --chart-1: #0e6b66; --chart-2: #c46a17; --chart-3: #3a6bb0; --chart-8: #7a7a7a; --grid: #ececec;
  --bar: #2e2e2e; --on-bar: #ffffff; --on-bar-muted: #c9c9c9;
  --sombra-aba: 0 1px 2px rgba(0,0,0,.12);
  --fonte: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #1a1a1a; --surface-100: #262626; --surface-200: #2e2e2e; --surface-300: #3a3a3a;
    --ink: #f4f4f4; --ink-muted: #a8a8a8; --border: #3d3d3d; --border-strong: #7a7a7a;
    --accent: #4fb3aa; --on-accent: #102624; --accent-subtle: #163a37;
    --success: #5cc27f; --danger: #ff8a7a; --danger-bg: #3d1f1b; --warning: #f0b84a; --warning-bg: #3a2f17;
    --chart-1: #4fb3aa; --chart-2: #f0a050; --chart-3: #7fa8e8; --chart-8: #9a9a9a; --grid: #353535;
    --on-bar-muted: #b5b5b5; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #1a1a1a; --surface-100: #262626; --surface-200: #2e2e2e; --surface-300: #3a3a3a;
  --ink: #f4f4f4; --ink-muted: #a8a8a8; --border: #3d3d3d; --border-strong: #7a7a7a;
  --accent: #4fb3aa; --on-accent: #102624; --accent-subtle: #163a37;
  --success: #5cc27f; --danger: #ff8a7a; --danger-bg: #3d1f1b; --warning: #f0b84a; --warning-bg: #3a2f17;
  --chart-1: #4fb3aa; --chart-2: #f0a050; --chart-3: #7fa8e8; --chart-8: #9a9a9a; --grid: #353535;
  --on-bar-muted: #b5b5b5; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--ink); font: 400 14px/20px var(--fonte); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--ink-muted); }
.pagina { width: 100%; margin: 0; padding: 0 clamp(16px, 2vw, 32px); }

/* ---------------------------------------------------------------- barra superior grafite */
.topo { background: var(--bar); color: var(--on-bar); }
.topo .pagina { display: flex; align-items: center; gap: 14px; min-height: 52px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.marca { display: flex; align-items: center; gap: 14px; min-width: 0; color: inherit; text-decoration: none; }
.marca img { height: 30px; width: auto; aspect-ratio: 1804 / 522; display: block; }
.marca .logo-texto { font-weight: 700; letter-spacing: .08em; font-size: 13px; white-space: nowrap; }
.marca .sep { width: 1px; height: 26px; background: #5a5a5a; }
.marca h1 { font-size: 17px; line-height: 22px; font-weight: 500; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo .acoes { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #3d3d3d; border-radius: 9999px; padding: 3px 10px; font-size: 12px; line-height: 16px; font-weight: 500; }
.pill .ponto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: #7fd6a0; } .pill.carregando { color: #7fd0c8; } .pill.erro { color: #ff9b8c; } .pill.desatualizado { color: #f0c060; }
.topo .info { font-size: 12px; line-height: 16px; color: var(--on-bar-muted); text-align: right; }
.btn-tema { display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--on-bar); border: 1px solid #5a5a5a; border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
.btn-tema svg { width: 16px; height: 16px; }
.btn-barra { background: #0e6b66; color: #fff; border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 500; }
.btn-barra:hover { background: #12807a; }
.btn-barra:disabled { opacity: .7; cursor: default; }
.menu-usuario { position: relative; }
.menu-usuario > button { background: transparent; border: 1px solid #5a5a5a; color: var(--on-bar); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
.menu-usuario .lista { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface-100); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; min-width: 220px; padding: 6px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.menu-usuario .lista a, .menu-usuario .lista button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 4px; color: inherit; text-decoration: none; background: none; border: 0; cursor: pointer; }
.menu-usuario .lista a:hover, .menu-usuario .lista button:hover { background: var(--surface-200); }
.menu-usuario .lista .quem { padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* ---------------------------------------------------------------- botões e campos */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface-100); color: var(--ink); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-200); }
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primario:hover { filter: brightness(1.08); }
.btn.perigo { color: var(--danger); border-color: var(--danger); }
.btn.peq { padding: 4px 10px; font-size: 12px; line-height: 16px; }
.btn.ativo { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; }
.campo { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.campo > span, .rotulo { font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-muted); }
select, input[type=text], input[type=search], input[type=password], textarea {
  border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-100); padding: 6px 10px; min-height: 32px; }
select { appearance: none; padding-right: 28px; background-repeat: no-repeat; background-position: right 9px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8a8a' stroke-width='1.5'/%3E%3C/svg%3E"); }
textarea { resize: vertical; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; background: var(--surface-100); padding: 3px 10px; font-size: 12px; line-height: 16px; cursor: pointer; color: var(--ink-muted); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.ativo { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }
.girando { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: gira .8s linear infinite; vertical-align: -2px; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- barra de filtros e contexto */
/* o sticky fica no contêiner (#filtros-slot), que é filho direto do body: assim a barra acompanha a rolagem */
#filtros-slot { position: sticky; top: 0; z-index: 20; }
.filtros { background: var(--surface-100); border-bottom: 1px solid var(--border); }
.filtros .pagina { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.filtros .campo select { min-width: 110px; max-width: 220px; }
.filtros .botoes { display: flex; gap: 8px; align-items: center; }
.abas { margin-left: auto; display: inline-flex; background: var(--surface-200); border-radius: 8px; padding: 3px; gap: 2px; }
.abas button { border: 0; background: transparent; border-radius: 6px; padding: 5px 12px; cursor: pointer; color: var(--ink-muted); font-weight: 500; white-space: nowrap; }
.abas button.ativa { background: var(--surface-100); color: var(--ink); box-shadow: var(--sombra-aba); }
.contexto { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 10px 0 0; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 9999px; padding: 2px 10px; font-size: 12px; line-height: 16px; font-weight: 500; background: var(--accent-subtle); color: var(--accent); border: 0; }
.chip.sel { background: var(--accent); color: var(--on-accent); cursor: pointer; }
.chip.cinza { background: var(--surface-200); color: var(--ink-muted); }
.contexto .direita { margin-left: auto; }

/* ---------------------------------------------------------------- KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.kpi { background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; position: relative; overflow: hidden; min-width: 0; }
.kpi.principal { border-color: var(--accent); }
.kpi.principal::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi .rotulo { display: block; }
.kpi .valor { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .valor.nome { font-size: 16px; line-height: 21px; }
.kpi .detalhe { font-size: 12px; line-height: 16px; color: var(--ink-muted); margin-top: 2px; min-height: 16px; }
.kpi .detalhe .sobe { color: var(--danger); } .kpi .detalhe .desce { color: var(--success); } .kpi .detalhe .bom { color: var(--success); }
.kpi svg.mini { display: block; width: 100%; height: 30px; margin-top: 6px; }

/* ---------------------------------------------------------------- painéis e grades */
.painel { background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.painel > header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.painel > header h2 { font-size: 14px; line-height: 20px; font-weight: 600; margin: 0; }
.painel > header .dica { margin-left: auto; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.painel > header .ctl { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.legenda { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.legenda i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.legenda i.q { width: 9px; height: 9px; border-radius: 2px; }
.legenda i.tr { background: none !important; border-top: 2px dashed var(--chart-2); height: 0; }
.grade { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.grade .s3 { grid-column: span 3; } .grade .s2 { grid-column: span 2; } .grade .r2 { grid-row: span 2; }
.duas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.grafico { position: relative; min-height: 220px; }
.grafico svg { display: block; width: 100%; }
.grafico.rolagem { max-height: 420px; overflow-y: auto; }
.grafico .vazio, .vazio { color: var(--ink-muted); font-size: 13px; padding: 30px 0; text-align: center; }
.grafico svg text { font-family: var(--fonte); }
.grafico .clicavel { cursor: pointer; }
.tooltip { position: fixed; pointer-events: none; background: var(--surface-200); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 12px; line-height: 16px; z-index: 100; box-shadow: 0 4px 14px rgba(0,0,0,.15); max-width: 280px; }
.tooltip b { display: block; font-weight: 600; margin-bottom: 4px; }
.tooltip .l { display: flex; justify-content: space-between; gap: 16px; }

/* ---------------------------------------------------------------- insights */
.insights { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 560px; }
.insights li { display: grid; grid-template-columns: 8px 1fr; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; line-height: 18px; }
.insights li:first-child { border-top: 0; padding-top: 0; }
.insights .b { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 5px; grid-row: span 2; }
.insights .b.alerta { background: var(--chart-2); }
.insights .t { font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-muted); }

/* ---------------------------------------------------------------- tabelas */
.tabela-caixa { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 4px; }
table.tab { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
table.tab th { position: sticky; top: 0; background: var(--surface-200); font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-muted); text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
table.tab th.ord { cursor: pointer; user-select: none; }
table.tab th .seta { color: var(--accent); margin-left: 3px; }
table.tab td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tab th.num, table.tab td.num { text-align: right; }
table.tab tbody tr.clicavel { cursor: pointer; }
table.tab tbody tr:hover { background: var(--surface-200); }
table.tab tbody tr.sel { background: var(--accent-subtle); }
table.tab tfoot td { font-weight: 600; border-top: 2px solid var(--border-strong); border-bottom: 0; background: var(--surface-100); position: sticky; bottom: 0; }
.barrinha { display: inline-block; width: 70px; height: 6px; background: var(--surface-300); border-radius: 3px; vertical-align: middle; margin-right: 8px; overflow: hidden; }
.barrinha i { display: block; height: 100%; background: var(--chart-1); }

/* ---------------------------------------------------------------- avisos e estados */
.aviso { border-radius: 8px; padding: 10px 14px; border-left: 4px solid var(--warning); background: var(--warning-bg); color: var(--ink); margin: 12px 0 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; line-height: 18px; }
.aviso.erro { border-left-color: var(--danger); background: var(--danger-bg); }
.aviso.ok { border-left-color: var(--success); background: var(--accent-subtle); }
.aviso b { font-weight: 600; }
.carregando-tela { display: grid; place-items: center; min-height: 60vh; text-align: center; color: var(--ink-muted); gap: 10px; }

/* ---------------------------------------------------------------- login e início */
.cartao-login { max-width: 380px; margin: 10vh auto; background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.cartao-login h2 { margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; }
.cartao-login .erro { color: var(--danger); font-size: 13px; }
.inicio h2 { font-size: 17px; font-weight: 600; margin: 20px 0 4px; }
.inicio .area { font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-muted); margin: 18px 0 8px; }
.cartoes-telas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cartao-tela { background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 4px; }
.cartao-tela:hover { border-color: var(--accent); }
.cartao-tela b { font-weight: 600; }
.cartao-tela span { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.cartao-tela em { font-style: normal; font-size: 12px; color: var(--warning); }

/* ---------------------------------------------------------------- painel de acessos */
.adm { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; margin: 12px 0; align-items: start; }
.adm .lista-itens { display: flex; flex-direction: column; gap: 0; max-height: 70vh; overflow-y: auto; margin: 0 -16px; }
.adm .item { display: flex; flex-direction: column; gap: 2px; padding: 9px 16px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.adm .item:hover { background: var(--surface-200); }
.adm .item.sel { background: var(--accent-subtle); }
.adm .item b { font-weight: 600; font-size: 13px; }
.adm .item span { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.adm .item .inativo { color: var(--danger); }
.form-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.form-grade .inteira { grid-column: 1 / -1; }
.secao { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.secao h3 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.secao p.ajuda { margin: 0; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.marcar { display: flex; flex-wrap: wrap; gap: 6px; }
.marcar label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--border-strong); border-radius: 9999px; padding: 3px 10px; font-size: 12px; line-height: 16px; cursor: pointer; background: var(--surface-100); }
.marcar label.on { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); font-weight: 500; }
.marcar label.bloq { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); font-weight: 500; }
.marcar input { position: absolute; opacity: 0; pointer-events: none; }
.escolha { border: 1px solid var(--border); border-radius: 4px; }
.escolha .busca { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-200); align-items: center; }
.escolha .busca input { flex: 1; }
.escolha .opcoes { max-height: 230px; overflow-y: auto; }
.escolha .op { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; padding: 6px 10px; align-items: center; cursor: pointer; font-size: 13px; line-height: 18px; border-bottom: 1px solid var(--border); }
.escolha .op:last-child { border-bottom: 0; }
.escolha .op:hover { background: var(--surface-200); }
.escolha .op.on { background: var(--accent-subtle); }
.escolha .op small { display: block; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.escolha .op .qtd { font-size: 12px; color: var(--ink-muted); }
.resumo-recorte { background: var(--surface-200); border-radius: 4px; padding: 8px 10px; font-size: 13px; line-height: 18px; }
.rodape-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 12px; }
.rodape-form .direita { margin-left: auto; display: flex; gap: 8px; }
.previa { border-left: 4px solid var(--accent); background: var(--accent-subtle); border-radius: 4px; padding: 10px 12px; font-size: 13px; line-height: 18px; }
.previa ul { margin: 4px 0 0; padding-left: 18px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--bar); color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 200; font-size: 13px; }

/* ---------------------------------------------------------------- telas menores */
@media (max-width: 1400px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
  .grade { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade .s3 { grid-column: 1 / -1; }
  .grade .r2 { grid-row: auto; grid-column: 1 / -1; }
  .insights { max-height: none; columns: 2; column-gap: 24px; }
  .insights li { break-inside: avoid; }
  .adm { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade, .duas, .form-grade { grid-template-columns: 1fr; }
  .grade .s3, .grade .s2 { grid-column: auto; }
  .insights { columns: 1; }
  #filtros-slot { position: static; }
  #filtros-slot:has(.trilha) { position: sticky; }   /* no celular só a trilha da análise fica presa (é compacta) */
  .abas { margin-left: 0; max-width: 100%; overflow-x: auto; }
  .marca h1 { font-size: 15px; }
  .topo .info { display: none; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
  .btn-tema .txt { display: none; }
  .marca .logo-texto { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; } }

/* ================================================================ largura total e celular (geral) */
html, body { overflow-x: clip; }   /* clip (e não hidden): hidden quebra a barra presa no topo */
#app { min-width: 0; }
.filtros .campo { flex: 1 1 140px; }
.filtros .campo select { width: 100%; max-width: none; }
@media (max-width: 760px) {
  .topo .pagina { gap: 8px; }
  .marca .sep, .marca .logo-texto { display: none; }
  .topo .acoes { margin-left: auto; gap: 6px; }
  .btn-barra { padding: 6px 10px; font-size: 13px; }
  .pill .txt { display: none; }
  .pill { padding: 5px; }
  .filtros .pagina { gap: 8px; }
  .filtros .campo { flex: 1 1 45%; }
  .filtros .botoes { width: 100%; }
  .filtros .botoes .btn { flex: 1; justify-content: center; }
  .abas { width: 100%; }
  .abas button { flex: 1 0 auto; }
  .contexto .direita { margin-left: 0; width: 100%; }
  .painel { padding: 12px; }
  .painel > header .ctl { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .painel > header .ctl input { flex: 1; min-width: 0; }
  .kpi .valor { font-size: 20px; line-height: 26px; }
  table.tab { font-size: 12px; }
  table.tab td, table.tab th { padding: 6px 8px; }
  .adm .lista-itens { max-height: 40vh; }
}
@media (max-width: 480px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { padding: 10px 12px; } .kpi .valor.nome { font-size: 14px; } }

/* ================================================================ página vertical (Análise em camadas) */
.trilha .pagina { flex-wrap: nowrap; align-items: center; padding-top: 8px; padding-bottom: 8px; }
.migalhas { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.migalhas::-webkit-scrollbar { display: none; }
.migalha { display: inline-flex; flex-direction: column; align-items: flex-start; border: 0; background: none; padding: 4px 8px; border-radius: 8px; cursor: pointer; color: var(--accent); font-weight: 600; white-space: nowrap; line-height: 18px; }
.migalha small { font-size: 10px; line-height: 12px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-muted); }
.migalha:hover { background: var(--surface-200); }
.migalha.atual, .migalhas > .migalha:last-child { color: var(--ink); cursor: default; }
.sep-m { color: var(--ink-muted); }
.ctl-trilha { flex: none; }
#app.vertical { padding-bottom: 40px; }
.camada-sec { margin: 22px 0 0; display: flex; flex-direction: column; gap: 12px; }
.camada-sec.entra { animation: entrar .28s ease-out both; }
.camada-sec.entra:nth-child(2) { animation-delay: .04s; } .camada-sec.entra:nth-child(3) { animation-delay: .08s; }
.camada-sec.entra:nth-child(4) { animation-delay: .12s; } .camada-sec.entra:nth-child(5) { animation-delay: .16s; }
@keyframes entrar { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.sec-cab { display: flex; gap: 12px; align-items: flex-start; }
.sec-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.sec-cab h2 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
.sec-cab p { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.manchete { margin: 0; font-size: 17px; line-height: 27px; max-width: 110ch; }
.manchete b { font-weight: 600; }
.camada-sec .kpis { margin: 0; }
.duas-proj { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 12px; align-items: start; }
.fatos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fatos li { background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 14px; line-height: 20px; }
.fatos li b { font-size: 18px; font-weight: 600; }
.fatos li.pequeno, .pequeno { font-size: 12px; line-height: 16px; background: none; border: 0; padding: 0 2px; }
.selo { display: inline-block; border-radius: 9999px; padding: 1px 8px; font-size: 11px; line-height: 16px; font-weight: 500; white-space: nowrap; vertical-align: 1px; margin-left: 4px; }
.selo.ruim { background: var(--danger-bg); color: var(--danger); }
.selo.bom { background: var(--accent-subtle); color: var(--success); }
.selo.indicio { background: var(--warning-bg); color: var(--warning); }
.selo.neutro { background: var(--surface-200); color: var(--ink-muted); }
.evidencias { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.evid { background: var(--surface-100); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.evid.ruim { border-left-color: var(--danger); }
.evid.bom { border-left-color: var(--success); }
.evid-cab { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.evid p { margin: 0; font-size: 13px; line-height: 19px; }
.evid .link { align-self: flex-start; }
.oportunidades { display: flex; flex-direction: column; gap: 10px; }
.op { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.op-imp { background: var(--accent-subtle); color: var(--accent); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px; }
.op-imp b { font-size: 26px; line-height: 30px; font-weight: 700; }
.op-imp span { font-size: 11px; line-height: 14px; text-transform: uppercase; letter-spacing: .03em; }
.op-txt { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.op-txt h3 { margin: 0; font-size: 15px; line-height: 20px; font-weight: 600; }
.op-txt p { margin: 0; font-size: 13px; line-height: 19px; }
.op-txt small { font-size: 12px; color: var(--ink-muted); }
.filhos { display: flex; flex-direction: column; background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.filho { display: grid; grid-template-columns: minmax(160px, 2.2fr) 1.2fr .9fr 1fr .9fr minmax(80px, 1fr); gap: 10px; align-items: center; padding: 9px 14px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; width: 100%; font-size: 13px; line-height: 18px; }
.filhos.mes .filho { grid-template-columns: minmax(160px, 2.2fr) 1fr 1fr 1fr 1fr; }
.filho.cab { border-top: 0; background: var(--surface-200); font-size: 11px; line-height: 14px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-muted); }
.filho.clicavel { cursor: pointer; }
.filho.clicavel:hover { background: var(--accent-subtle); }
.filho.clicavel .f-nome::after { content: " ›"; color: var(--accent); }
.f-nome { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.f-num em { font-style: normal; font-size: 11px; }
.f-num .barrinha { width: 50px; }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.f-spark svg.mini { margin: 0; height: 24px; }
.mes-nav { display: flex; gap: 8px; }
.pessoas-ctl { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pessoas-ctl .abas { margin-left: 0; }
.pessoas-ctl input { flex: 1; min-width: 200px; }
.lista-pessoas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-top: 10px; }
.pessoa { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.pessoa:hover { border-color: var(--accent); }
.p-nome { font-weight: 600; }
.p-info { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.p-saida { font-size: 12px; line-height: 16px; color: var(--danger); margin-top: 2px; }
.gaveta-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; animation: fade .2s; }
.gaveta { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface-100); border-left: 1px solid var(--border); z-index: 91; display: flex; flex-direction: column; animation: gaveta .22s ease-out; box-shadow: -8px 0 24px rgba(0,0,0,.2); }
@keyframes gaveta { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.gaveta-cab { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.gaveta-corpo { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.gaveta-corpo h2 { margin: 0; font-size: 18px; font-weight: 600; }
.gaveta-corpo h3 { margin: 8px 0 0; font-size: 14px; font-weight: 600; }
.gaveta-corpo p { margin: 0; }
.dados-p { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.dados-p dt { color: var(--ink-muted); }
.dados-p dd { margin: 0; }
.linha-tempo { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--accent-subtle); display: flex; flex-direction: column; gap: 10px; }
.linha-tempo li { position: relative; display: flex; flex-direction: column; font-size: 13px; line-height: 18px; }
.linha-tempo li::before { content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.lt-quando { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-muted); }
/* índice das seções, Ir para, abrir por, simulador */
.ctl-trilha { display: flex; gap: 10px; align-items: center; }
.ir-para { position: relative; }
.ir-para input { width: 280px; }
.ir-lista { position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 280px; background: var(--surface-100); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 60; max-height: 360px; overflow-y: auto; padding: 4px; }
.ir-lista button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; line-height: 18px; }
.ir-lista button small { font-size: 10px; line-height: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-muted); }
.ir-lista button.ativo, .ir-lista button:hover { background: var(--accent-subtle); }
.indice { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.indice::-webkit-scrollbar { display: none; }
.indice a { flex: none; text-decoration: none; color: var(--ink-muted); font-size: 12px; line-height: 16px; font-weight: 500; padding: 5px 10px; border-radius: 9999px; }
.indice a:hover { background: var(--surface-200); }
.indice a.ativo { background: var(--accent-subtle); color: var(--accent); }
.abrir-por { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ver-mais { align-self: center; }
.proj-ctl { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.proj-ctl > div, .simulador { display: flex; flex-direction: column; gap: 4px; }
.simulador { flex: 1; min-width: 240px; max-width: 460px; }
.simulador .rotulo b { color: var(--accent); font-weight: 600; }
.simulador input[type=range] { width: 100%; accent-color: var(--accent); }
.fatos li.cenario { border-color: var(--chart-3); background: color-mix(in srgb, var(--chart-3) 8%, var(--surface-100)); }
.pessoas-ctl select { min-width: 180px; }
@media (max-width: 1000px) { .duas-proj { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .ir-para input { width: 200px; } }
.so-celular { display: none; }
@media (max-width: 760px) {
  .so-celular { display: inline-flex; flex: none; }
  .trilha .pagina:first-child { flex-wrap: wrap; }
  .trilha:not(.aberto) .ctl-trilha { display: none; }
  .ctl-trilha { flex-wrap: wrap; }
  .ir-para, .ir-para input { width: 100%; }
  .proj-ctl { gap: 12px; }
  .proj-ctl > div { width: 100%; }
  .proj-ctl .seg { display: flex; } .proj-ctl .seg button { flex: 1; }
  .pessoas-ctl select, .pessoas-ctl .btn { flex: 1; }
}
@media (max-width: 760px) {
  .trilha .pagina { flex-wrap: wrap; }
  .ctl-trilha { width: 100%; }
  .ctl-trilha .seg { width: 100%; display: flex; }
  .ctl-trilha .seg button { flex: 1; padding: 6px 4px; }
  .manchete { font-size: 15px; line-height: 23px; }
  .op { grid-template-columns: 1fr; }
  .op-imp { flex-direction: row; gap: 8px; justify-content: flex-start; }
  .op-imp b { font-size: 22px; }
  .evidencias { grid-template-columns: 1fr; }
  .filho.cab { display: none; }
  .filho, .filhos.mes .filho { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; padding: 10px 12px; }
  .f-nome { grid-column: 1 / -1; white-space: normal; }
  .f-num[data-r]::before { content: attr(data-r); display: block; font-size: 10px; line-height: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-muted); }
  .f-spark { display: none; }
  .lista-pessoas { grid-template-columns: 1fr; }
  .gaveta { width: 100vw; }
}
