/* Painel SUS Narrativas — tokens copiados do painel de presidenciáveis (cores validadas p/ daltonismo). */
:root {
  color-scheme: light;
  --surface-0: #eef1f3; --surface-1: #ffffff; --surface-2: #f7f9fa;
  --border: #dde3e7; --border-strong: #c9d3d9; --rule: #9fb0b8;
  --text-1: #0f1a1f; --text-2: #4a5a63; --text-3: #5e6f79;
  --accent: #0d5c63; --accent-soft: #e2eff0; --accent-ink: #084249;
  --pos: #1b9e6f; --neg: #d8453f; --neg-bg: #fbe9e8; --alerta: #d99000;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s8: #e34948; --s-outros: #a09a92;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px; --radius-ctrl: 6px; --h: 30px;
  --shadow: 0 1px 2px rgba(15,26,31,.06), 0 4px 12px rgba(15,26,31,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-0: #101a1d; --surface-1: #162327; --surface-2: #1c2c31;
    --border: #24373d; --border-strong: #33484f; --rule: #5c757d;
    --text-1: #eef3f4; --text-2: #a9bcc3; --text-3: #7f959d;
    --accent: #6ec2c4; --accent-soft: #163234; --accent-ink: #9bd8d9; --neg-bg: #3a1e1d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.28);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--surface-0); color: var(--text-1); font: 400 13px/1.5 var(--font-ui); }
h1 { margin: 0; font-size: 18px; } h2 { margin: 0 0 10px; font-size: 14.5px; font-weight: 600; }
.meta { color: var(--text-3); font-size: 11px; font-weight: 400; }
.sub { color: var(--text-3); font-size: 12px; }
.erro { color: var(--neg); font-size: 12px; margin-top: 4px; }

.topo { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--surface-1); border-bottom: 1px solid var(--border); }
.topo-dir { display: flex; gap: 12px; align-items: center; }

/* Botões: 3 níveis, todos com fundo próprio (antes eram da cor da página e só o texto aparecia).
   padrão   = fundo teal suave + borda teal + texto escuro (ação comum: Limpar, Exportar, paginação...)
   .on      = preenchido com o teal da marca (ação principal: Salvar, Confirmar selecionados)
   .ghost   = fundo cinza-claro da superfície + borda neutra (ação secundária/discreta: abrir ↗, ⋯, cancelar) */
:root { --btn-bg: #e2eff0; --btn-bg-hover: #cfe5e7; --btn-borda: #9cc4c8; --btn-ink: #084249; --btn-pri-ink: #ffffff; --btn-pri-hover: #0a4a50; }
@media (prefers-color-scheme: dark) { :root { --btn-bg: #1d3a3d; --btn-bg-hover: #25494d; --btn-borda: #3b6a6f; --btn-ink: #b6e3e4; --btn-pri-ink: #062326; --btn-pri-hover: #8fd3d4; } }
.btn { height: var(--h); padding: 0 12px; border: 1px solid var(--btn-borda); background: var(--btn-bg); color: var(--btn-ink); border-radius: var(--radius-ctrl); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--btn-bg-hover); } .btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { border-color: var(--border-strong); background: var(--surface-2); color: var(--accent-ink); font-weight: 400; } .btn.ghost:hover { background: var(--accent-soft); border-color: var(--btn-borda); }
.btn.on { background: var(--accent); color: var(--btn-pri-ink); border-color: var(--accent); font-weight: 600; box-shadow: 0 1px 2px rgba(15,26,31,.18); } .btn.on:hover { background: var(--btn-pri-hover); }

.filtros { padding: 12px 20px 8px; background: var(--surface-1); border-bottom: 1px solid var(--border); }
.linha { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 8px; }
.ctl { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-3); }
.ctl > span:first-child { font-weight: 600; letter-spacing: .02em; }
.ctl.grande { flex: 1 1 220px; } .ctl.grande input { width: 100%; box-sizing: border-box; } .ctl.chk { flex-direction: row; align-items: center; gap: 6px; height: var(--h); color: var(--text-2); font-size: 12px; }
.par { display: flex; gap: 6px; align-items: center; }
input[type=date], input.data-br, input[type=search], input[type=number], select, textarea { height: var(--h); padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-ctrl); background: var(--surface-1); color: var(--text-1); font: inherit; }
textarea { height: auto; padding: 6px 8px; width: 100%; font: 12px/1.45 var(--font-mono); resize: vertical; }
.presets { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-end; }

.avancado { padding: 10px; background: var(--surface-2); border-radius: var(--radius); align-items: flex-start; }
.linha.bools { margin-bottom: 8px; }
.ctl.bool { flex: 1 1 100%; min-width: 0; }
.linha.bools .par { flex-wrap: wrap; }
.ctl.multi { flex: 1 1 150px; min-width: 130px; } .multi details { position: relative; }
.multi summary { list-style: none; height: var(--h); display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-ctrl); background: var(--surface-1); color: var(--text-1); font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi summary::-webkit-details-marker { display: none; } .multi summary::after { content: "▾"; color: var(--text-3); }
.multi summary.ativo { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.multi details[open] > .lista { position: absolute; z-index: 12; top: calc(var(--h) + 3px); left: 0; box-shadow: var(--shadow); }
.multi .lista { display: flex; flex-direction: column; max-height: 280px; overflow: auto; min-width: 230px; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-ctrl); background: var(--surface-1); }
.rot-dim { align-self: center; font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); padding-bottom: 4px; }
.linha.dimensoes { padding-top: 2px; }
.matriz td.cel { text-align: right; font-variant-numeric: tabular-nums; cursor: pointer; min-width: 64px; }
.matriz td.cel:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.matriz th.vert { white-space: normal; max-width: 120px; vertical-align: bottom; }
.matriz td.rot { max-width: 260px; }
.matriz td.tot, .matriz th.tot { color: var(--text-3); }
.tag { display: inline-block; background: var(--surface-0); color: var(--text-2); border-radius: 4px; padding: 0 6px; margin: 0 4px 2px 0; font-size: 11px; }
.tag.c { background: var(--accent-soft); color: var(--accent-ink); }
.multi label { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); padding: 1px 0; white-space: nowrap; }
.resumo-filtro { padding-top: 4px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 1px 9px; font-size: 11px; }

.abas { display: flex; gap: 2px; padding: 0 20px; background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.abas button { border: 0; background: none; padding: 10px 14px; font: 600 13px var(--font-ui); color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; }
.abas button.ativa { color: var(--accent-ink); border-bottom-color: var(--accent); }
main { padding: 16px 20px 60px; }   /* sem max-width: o conteúdo ocupa toda a largura ao lado do menu */
input.data-br { width: 108px; text-align: center; font-variant-numeric: tabular-nums; }
input.data-br.invalido { border-color: #c0392b; box-shadow: 0 0 0 1px #c0392b; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.kpi .v { font: 700 27px/1.1 var(--font-ui); } .kpi .r { color: var(--text-3); font-size: 11px; margin-top: 2px; }
.carregando { opacity: .45; transition: opacity .15s; }
.vazio { color: var(--text-3); padding: 18px 0; }

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 11px; color: var(--text-3); font-weight: 600; padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; white-space: nowrap; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.ord { cursor: pointer; } th.ord:hover { color: var(--text-1); }
td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr.clic { cursor: pointer; } tr.clic:hover td { background: var(--surface-2); }

.barra { display: grid; grid-template-columns: 150px 1fr 56px; gap: 8px; align-items: center; padding: 2px 0; font-size: 12px; }
.barra .rot { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra .trilho { height: 14px; } .barra .preench { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 1px; }
.barra .val { text-align: right; font-variant-numeric: tabular-nums; }
.barra:hover .preench { filter: brightness(1.15); }
.mini { display: flex; height: 10px; min-width: 90px; gap: 2px; } .mini i { display: block; height: 100%; } .mini i:first-child { border-radius: 4px 0 0 4px; } .mini i:last-child { border-radius: 0 4px 4px 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.legenda { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
svg text { fill: var(--text-3); font: 10.5px var(--font-ui); }

.post { display: grid; grid-template-columns: 76px minmax(0, 1.5fr) minmax(110px, .7fr) minmax(110px, .7fr) minmax(96px, .5fr) 92px 168px minmax(90px, .5fr); gap: 12px; }
.post-cab { position: sticky; top: 0; z-index: 5; padding: 6px 14px; margin-bottom: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.col-tags { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; font-size: 12px; } .col-tags .tag { white-space: normal; }
.post .txt { white-space: pre-wrap; word-break: break-word; } .post .txt.curto { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post .info { color: var(--text-3); font-size: 11px; margin-top: 3px; } .post .termos { margin-top: 4px; }
.termo { display: inline-block; background: var(--accent-soft); color: var(--accent-ink); border-radius: 4px; padding: 0 6px; margin: 0 4px 2px 0; font-size: 11px; }
.tri { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.tri button { border: 0; background: var(--surface-1); color: var(--text-3); padding: 3px 8px; font: 11px var(--font-ui); cursor: pointer; border-right: 1px solid var(--border); }
.tri button:last-child { border-right: 0; } .tri button:hover { background: var(--surface-2); }
.tri button.on[data-t=nucleo] { background: var(--s3); color: #fff; } .tri button.on[data-t=periferico] { background: var(--s4); color: #000; } .tri button.on[data-t=lixo] { background: var(--s8); color: #fff; }
.pag { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.nota { background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; font-size: 12px; }
pre.q { background: var(--surface-2); border: 1px solid var(--border); padding: 10px; border-radius: var(--radius-ctrl); font: 11.5px/1.45 var(--font-mono); white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }

.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--surface-1); color: var(--text-1); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 12px; max-width: 260px; }
.tip b { font-size: 14px; } .tip .l { color: var(--text-3); }
@media (max-width: 1100px) { .post { grid-template-columns: 70px minmax(0, 1fr) 100px 100px 84px 78px 150px 90px; gap: 8px; } }
@media (max-width: 700px) { .post { grid-template-columns: 1fr; } }

/* ---------- casca: lateral + conteúdo (mesma ideia do painel de presidenciáveis) ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.principal { min-width: 0; }
.lateral { background: var(--surface-1); border-right: 1px solid var(--border); padding: 18px 0; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lateral-marca { padding: 0 18px; }
.lateral-marca .nome { font-weight: 700; font-size: 15px; letter-spacing: -.005em; }
.lateral-marca .sub { font-weight: 600; font-size: 9px; letter-spacing: .14em; color: var(--accent); margin-top: 2px; }
.lateral-grupo > .titulo { font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); padding: 0 20px; margin-bottom: 6px; }
.lateral-item { display: flex; align-items: center; gap: 8px; margin: 1px 10px; padding: 7px 10px; border-radius: var(--radius-ctrl); font: 13.5px var(--font-ui); color: var(--text-2); background: transparent; border: 0; width: calc(100% - 20px); text-align: left; cursor: pointer; }
.lateral-item:hover { background: var(--surface-2); color: var(--text-1); }
.lateral-item.ativa { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.lateral-item .rotulo-item { flex: 1; }
.lateral-item .badge { font-size: 10.5px; font-weight: 700; background: var(--surface-0); color: var(--text-2); padding: 1px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.lateral-item.ativa .badge { background: var(--surface-1); color: var(--accent-ink); }
.titulo-aba { font-size: 16px; font-weight: 700; }
.barra.clic, .kpi.clic { cursor: pointer; }
.kpi.clic:hover { border-color: var(--accent); }
.barra.clic:hover .rot { color: var(--text-1); text-decoration: underline; }
.dica-clique { color: var(--text-3); font-size: 11px; margin: -4px 0 8px; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 8px; gap: 6px; } .lateral-marca, .lateral-grupo > .titulo { display: none; } .lateral-grupo { display: flex; } .lateral-item { width: auto; margin: 0; } }

/* classificação de stakeholders */
.stk-tab td, .stk-tab th { vertical-align: top; padding: 5px 7px; }
.stk-tab .stk-nome { min-width: 260px; max-width: 420px; }
.stk-tab .meta { font-size: 11px; }
a.ent { color: var(--accent-ink); text-decoration: none; font-weight: 600; } a.ent:hover { text-decoration: underline; }
.mini-sel { max-width: 190px; font-size: 12px; height: 26px; }
a.btn.rede { text-decoration: none; display: inline-flex; align-items: center; height: 24px; font-size: 12px; padding: 0 8px; white-space: nowrap; }
.stk-acao { white-space: nowrap; } .stk-acao .btn { height: 24px; padding: 0 8px; margin-left: 4px; }
.tag.st-confirmado, .tag.st-corrigido { background: color-mix(in srgb, var(--s3) 25%, transparent); } .tag.st-rejeitado { background: color-mix(in srgb, var(--s8) 25%, transparent); } .tag.st-pendente { opacity: .8; }
tr.stk-confirmado td, tr.stk-corrigido td { background: color-mix(in srgb, var(--s3) 6%, transparent); }
.lote { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.kpi.ativo { outline: 2px solid var(--accent); }
.stk-dlg { width: min(900px, 94vw); max-height: 88vh; overflow: auto; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-1); color: var(--text-1); padding: 16px 20px; }
.stk-dlg::backdrop { background: rgba(0,0,0,.35); } .stk-dlg h3 { margin: 14px 0 4px; font-size: 14px; }
.alvo-lista { display: flex; flex-direction: column; align-items: flex-start; }

tr.inativo td { opacity: .55; }
body.papel-leitor .tri button, body.papel-leitor .stk-acao .btn, body.papel-leitor .mini-sel, body.papel-leitor .lote { pointer-events: none; opacity: .45; }

/* indicador de carregamento */
#barra-carga { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; opacity: 0; pointer-events: none; overflow: hidden; transition: opacity .15s; }
#barra-carga::before { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); border-radius: 2px; animation: corre 1.1s ease-in-out infinite; }
@keyframes corre { 0% { left: -40%; } 100% { left: 100%; } }
#carga { position: fixed; top: 14px; left: 50%; transform: translateX(-50%) translateY(-8px); z-index: 1001; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-1); color: var(--text-1); box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
#carga .roda { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
body.ocupado #barra-carga { opacity: 1; } body.ocupado #carga { opacity: 1; transform: translateX(-50%) translateY(0); } body.ocupado { cursor: progress; }
@media (prefers-reduced-motion: reduce) { #barra-carga::before, #carga .roda { animation-duration: 3s; } }
