:root {
  --navy: #202a35; --navy-2: #09131c; --navy-3: #2d3a48;
  --red: #da251d; --red-esc: #b81e17;
  --bg: #f3f5f7; --card: #ffffff; --line: #d8dde2; --line-2: #e9eef5;
  --text: #17202a; --text-2: #4a5562; --muted: #6b7682;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --good: #0ca30c; --good-txt: #087a08; --warn: #fab219; --serious: #ec835a; --crit: #d03b3b; --crit-txt: #b42f2f;
  --grid: #e6e9ed; --axis: #8a949e;
  --r: 10px; --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text); font-size: 14px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--good-txt); } .neg { color: var(--crit-txt); }
a { color: var(--s1); }

/* ---------- botões e campos ---------- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--axis); }
.btn-primario { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn-primario:hover { background: var(--red-esc); }
.btn-peq { padding: 5px 10px; font-size: 13px; }
.btn-link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 6px 8px; text-align: left; }
.btn-icone { background: none; border: 0; font-size: 20px; cursor: pointer; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--s1); outline-offset: 1px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.erro { color: var(--crit-txt); min-height: 1em; margin: 0; font-size: 13px; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.badge:empty { display: none; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy-2), var(--navy)); padding: 20px; }
.login-card { background: #fff; border-radius: 14px; padding: 32px; width: min(380px, 100%); display: grid; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.login-logo { width: 100%; max-width: 280px; justify-self: center; }
.login-card h1 { text-align: center; color: var(--navy); }
.login-card p { margin: 0; text-align: center; }

/* ---------- estrutura ---------- */
#app { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: 60px 1fr; min-height: 100vh; }
.topo { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.topo-logo { height: 34px; }
.topo-titulo { display: flex; flex-direction: column; border-left: 3px solid var(--red); padding-left: 12px; }
.topo-titulo strong { font-size: 15px; color: var(--navy); }
.topo-titulo span { font-size: 12px; color: var(--muted); }
.topo-info { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.topo-user { position: relative; }
.menu-user { position: absolute; right: 0; top: 38px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--sombra); display: grid; min-width: 160px; padding: 4px; }
.menu-mobile { display: none; }
.lateral { background: var(--navy); color: #c9d2dc; padding: 14px 10px 30px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; }
.lateral a { color: #dbe2ea; text-decoration: none; padding: 8px 12px; border-radius: 7px; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; }
.lateral a:hover { background: var(--navy-3); }
.lateral a.ativo { background: #fff; color: var(--navy); font-weight: 600; box-shadow: inset 3px 0 0 var(--red); }
.lat-grupo { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8fa0b2; padding: 14px 12px 4px; }
.lat-futuro { color: #6f8195; font-size: 13px; padding: 6px 12px; }
.lat-futuro::after { content: " · em breve"; font-size: 11px; }
.conteudo { padding: 18px 24px 60px; min-width: 0; }
.barra-controles { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 14px; font: inherit; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.ativo { background: var(--navy); color: #fff; font-weight: 600; }
.saldo-box { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 4px 6px 4px 12px; }
.btn-comentar { margin-left: auto; }

/* ---------- página ---------- */
.cab-pagina { display: grid; gap: 6px; margin-bottom: 16px; }
.cab-pagina p { margin: 0; color: var(--text-2); max-width: 980px; }
.manchete { font-size: 16px; color: var(--text); background: #fff; border-left: 4px solid var(--navy); padding: 12px 16px; border-radius: 0 var(--r) var(--r) 0; box-shadow: var(--sombra); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--sombra); min-width: 0; }
.card > h2 { font-size: 15px; margin-bottom: 2px; }
.card > .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.card { position: relative; }
.card-acoes { display: flex; gap: 6px; position: absolute; top: 12px; right: 14px; }
.kpi { display: grid; gap: 2px; }
.kpi .rot { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .det { font-size: 12.5px; color: var(--text-2); }
.kpi.destaque { border-top: 3px solid var(--navy); }
.kpi.alerta { border-top: 3px solid var(--crit); }
.kpi.ok { border-top: 3px solid var(--good); }
.secao-titulo { margin: 22px 0 10px; font-size: 15px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.secao-titulo::before { content: ""; width: 4px; height: 16px; background: var(--red); border-radius: 2px; }

/* ---------- alertas ---------- */
.alertas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alertas li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 10px 12px; border-radius: 8px; background: #fafbfc; border: 1px solid var(--line-2); }
.alertas .ic { font-size: 15px; line-height: 1.3; }
.alertas li.crit { border-left: 4px solid var(--crit); }
.alertas li.warn { border-left: 4px solid var(--warn); }
.alertas li.good { border-left: 4px solid var(--good); }
.alertas li.info { border-left: 4px solid var(--s1); }
.alertas strong { display: block; }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #fafbfc; position: sticky; top: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
tr.grupo td { background: #f6f8fa; font-weight: 600; color: var(--navy); }
tr.neg-row td { background: #fff5f5; }
tbody tr:hover td { background: #f4f8fd; }
.tabela-peq table { font-size: 12.5px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--line-2); color: var(--text-2); }
.tag.A { background: #dce9fb; color: #184f95; } .tag.B { background: #fde6dc; color: #9a3d14; } .tag.C { background: #eceef1; color: #4a5562; }
.tag.crit { background: #fde3e3; color: var(--crit-txt); } .tag.warn { background: #fff3d6; color: #7a5200; } .tag.good { background: #dff3df; color: var(--good-txt); }
.score { display: inline-block; width: 34px; text-align: center; border-radius: 6px; font-weight: 700; font-size: 12px; padding: 1px 0; }

/* ---------- gráficos ---------- */
.grafico { width: 100%; position: relative; }
.grafico svg { display: block; width: 100%; overflow: visible; }
.grafico text { font-family: inherit; }
.eixo text { fill: var(--muted); font-size: 11px; }
.eixo path, .eixo line { stroke: var(--axis); }
.eixo .domain { display: none; }
.grade line { stroke: var(--grid); }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin: 0 0 8px; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legenda i.linha { height: 3px; border-radius: 2px; }
.legenda i.tracejado { height: 0; border-top: 2px dashed; background: none !important; }
.tooltip { position: fixed; z-index: 100; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.14); padding: 8px 10px; font-size: 12.5px; min-width: 160px; }
.tooltip .tt-tit { font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-l { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .tt-l span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .tt-l b { font-variant-numeric: tabular-nums; }
.tooltip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.ver-tabela { font-size: 12px; }

/* ---------- simulador ---------- */
.sim { display: grid; grid-template-columns: 340px 1fr; gap: 14px; align-items: start; }
.sim-ctl { display: grid; gap: 14px; position: sticky; top: 76px; }
.slider { display: grid; gap: 2px; }
.slider .topo-s { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.slider .topo-s b { color: var(--text); font-variant-numeric: tabular-nums; }
.slider input[type=range] { padding: 0; border: 0; accent-color: var(--navy); }
.slider small { color: var(--muted); font-size: 11.5px; }

/* ---------- solicitações ---------- */
.solic { display: grid; gap: 10px; }
.solic-item { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 6px; }
.solic-item header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.solic-item .texto { white-space: pre-wrap; }
.solic-item .resp { background: #f4f8fd; border-left: 3px solid var(--s1); padding: 8px 10px; border-radius: 0 6px 6px 0; white-space: pre-wrap; font-size: 13px; }
.st-aberto { background: #fff3d6; color: #7a5200; } .st-em_andamento { background: #dce9fb; color: #184f95; }
.st-feito { background: #dff3df; color: var(--good-txt); } .st-descartado { background: #eceef1; color: #4a5562; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- inovação ---------- */
.inov { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.inov .card h3 { font-size: 15px; margin-bottom: 6px; color: var(--navy); }
.inov .card p { margin: 6px 0; color: var(--text-2); }
.inov .meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- diálogos ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, 94vw); box-shadow: 0 24px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(9, 19, 28, .55); }
dialog form { padding: 22px; display: grid; gap: 12px; }
dialog p { margin: 0; }
.dlg-acoes { display: flex; justify-content: flex-end; gap: 8px; }
.linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-tipo { padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg-tipo label { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; padding: 4px 8px; font-size: 13px; color: var(--text); }
.seg-tipo input { width: auto; }
#coment-lista { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 9px; z-index: 200; box-shadow: var(--sombra); }
.carregando { padding: 60px; text-align: center; color: var(--muted); }

@media (max-width: 1200px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  #app { grid-template-columns: 1fr; }
  .lateral { position: fixed; left: 0; top: 60px; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .lateral.aberta { transform: none; }
  .menu-mobile { display: block; }
  .topo-logo { height: 26px; } .topo-info { display: none; }
  .g2, .g3, .g4, .g5, .sim { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .sim-ctl { position: static; }
  .conteudo { padding: 14px; }
}
@media print {
  .lateral, .topo, .barra-controles, .card-acoes, .btn { display: none !important; }
  #app { display: block; } .card { break-inside: avoid; box-shadow: none; }
}
