:root {
  --fundo: #f3f5f4; --texto: #1c2422; --suave: #56645e; --borda: #e0e7e4;
  --verde: #1d6b4f; --verde-escuro: #134a36; --vermelho: #9b2a17; --escuro: #10291f;
  --titulo: "Space Grotesk", Inter, system-ui, sans-serif;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fundo); color: var(--texto); font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums; }
h1, h2 { font-family: var(--titulo); font-weight: 600; margin: 0; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 18px; }
a { color: var(--verde); }
:focus-visible { outline: 3px solid var(--verde); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sprite { position: absolute; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- estrutura ---------- */
.app { display: flex; flex-wrap: wrap; align-items: flex-start; }
.lateral { flex: 0 0 232px; width: 232px; height: 100vh; position: sticky; top: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 20px 14px; background: var(--escuro); color: #dce7e2; }
.lateral :focus-visible { outline-color: #5bd3a2; }
.conteudo { flex: 999 1 560px; min-width: 0; max-width: 1240px; padding: 28px 32px; }
.marca { display: flex; align-items: center; gap: 10px; padding: 0 6px; font: 600 18px var(--titulo); color: #fff; }
.marca-icone { width: 32px; height: 32px; border-radius: 8px; background: #2e9e74; display: grid; place-items: center; }
.sel-empresa { margin: 0; padding: 0 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; color: #a9c0b6; }
.sel-empresa select { width: 100%; margin-top: 6px; background: #1a3a2e; color: #fff; border-color: #2c5244; font-size: 14px; font-weight: 400; letter-spacing: 0; }
.lateral nav { display: flex; flex-direction: column; gap: 4px; }
.lateral nav a, .lateral-rodape a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: #dce7e2; text-decoration: none; }
.lateral nav a:hover, .lateral-rodape a:hover { background: #1a3a2e; }
.lateral nav a[aria-current] { background: #1d4a39; color: #fff; font-weight: 600; }
.lateral-rodape { margin-top: auto; border-top: 1px solid #2c5244; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#usuario { padding-left: 12px; overflow-wrap: anywhere; }

.cartao { background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 20px; }
.cartao.escuro { background: var(--escuro); border-color: var(--escuro); color: #fff; }
.centro { text-align: center; max-width: 520px; margin: 40px auto; padding: 40px; }
.rolagem-x { overflow-x: auto; position: relative; }
.curta { max-height: 300px; overflow-y: auto; }
.dica { color: var(--suave); font-size: 13px; }
.erro { color: var(--vermelho); }

/* ---------- controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid #c3cfca; border-radius: 8px; background: #fff; color: var(--texto); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--verde); }
.btn.primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.primario:hover { background: var(--verde-escuro); border-color: var(--verde-escuro); }
.btn:disabled { opacity: .6; cursor: wait; }
.link { border: 0; background: none; min-height: 44px; padding: 0 6px; color: var(--verde); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.link:hover { color: var(--verde-escuro); }
select, input, textarea { font: inherit; min-height: 44px; padding: 8px 12px; border: 1px solid #8a9993; border-radius: 8px; background: #fff; color: var(--texto); }
::placeholder { color: #5f6b67; opacity: 1; }
label { display: block; margin: 10px 0; color: var(--suave); }
label input:not([type=checkbox]), label textarea { display: block; width: 100%; margin-top: 4px; }
label.check { display: flex; gap: 10px; align-items: center; min-height: 44px; color: var(--texto); }
label.check input { min-height: 0; width: 20px; height: 20px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cabeçalho ---------- */
.cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.cab-texto { flex: 1 1 320px; min-width: 0; }
.cab h1 { overflow-wrap: anywhere; }
.cab-sub { margin: 4px 0 0; color: var(--suave); }
label select { display: block; margin-top: 4px; }
.cab label { margin: 0; } .cab label select { display: block; margin-top: 4px; }
.selos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.selo { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: #e9eeec; color: #3d4a45; }
.selo.ok { background: #e2f1ea; color: #145238; }
.selo.ruim { background: #fce8e4; color: #9b2a17; }
.selo.alerta { background: #fff1dc; color: #7a4a00; }
.giro { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .giro { animation-duration: 4s; } }
.drop { position: relative; }
.drop-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: min(320px, 86vw); padding: 6px; background: #fff; border: 1px solid var(--borda); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 41, 31, .18); }
.drop-menu a { display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; color: var(--texto); text-decoration: none; }
.drop-menu a:hover, .drop-menu a:focus { background: #e8f3ee; }
.drop-menu b { font-weight: 600; } .drop-menu small { color: var(--suave); font-size: 12.5px; }

/* ---------- indicadores ---------- */
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.ind { position: relative; min-width: 0; }
.ind h2 { font: 500 13px Inter, system-ui, sans-serif; color: var(--suave); display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.ind .valor { font: 600 26px/1.25 var(--titulo); margin: 6px 0; overflow-wrap: anywhere; }
.ind p { margin: 0; font-size: 13px; color: var(--suave); }
.sobe { color: #145238; font-weight: 600; } .desce { color: #9a4b00; font-weight: 600; }
.escuro h2, .escuro p { color: #c5d6ce; }
.progresso { height: 8px; border-radius: 99px; background: #2c5244; overflow: hidden; margin: 8px 0; }
.progresso span { display: block; height: 100%; border-radius: 99px; background: #5bd3a2; }
.info { flex: none; width: 44px; height: 44px; margin: -10px -12px -10px 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: #c5d6ce; cursor: help; }
.escuro :focus-visible { outline-color: #5bd3a2; }
.dica-flutuante { display: none; position: absolute; right: 8px; top: 52px; z-index: 4; width: min(300px, calc(100% - 16px)); min-width: 200px; padding: 10px 12px; border-radius: 8px; background: #fff; color: var(--texto); border: 1px solid var(--borda); font-size: 12.5px; box-shadow: 0 12px 32px rgba(0, 0, 0, .3); }
.info:hover + .dica-flutuante, .info:focus + .dica-flutuante { display: block; }

/* ---------- gráfico e competências ---------- */
.duas-colunas { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.col-grafico { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; }
.col-comp { flex: 1 1 280px; min-width: 0; }
.col-grafico .rolagem-x { flex: 1; display: flex; padding: 4px; }
.grafico { flex: 1; display: flex; gap: 4px; align-items: stretch; min-height: 260px; margin-top: 12px; }
.barra { flex: 1 0 44px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 2px; border: 0; border-radius: 8px; background: none; color: var(--suave); font: inherit; font-size: 12px; cursor: pointer; }
.barra:hover { background: #f3f5f4; }
.barra .area { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.barra .col { width: 70%; max-width: 40px; min-height: 2px; border-radius: 5px 5px 0 0; background: #9ccbb6; }
.barra.atual .col { background: #c9d3cf; }
.barra.sel .col { background: var(--verde); }
.barra.sel { color: var(--texto); font-weight: 600; }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--suave); border-bottom: 1px solid var(--borda); padding: 10px 8px; white-space: nowrap; }
.tabela td { padding: 8px; border-bottom: 1px solid #edf1ef; vertical-align: middle; }
.tabela .num { text-align: right; white-space: nowrap; }
.compacta { margin-top: 8px; }
.compacta td { padding: 0 8px; height: 44px; }
.compacta tbody tr { cursor: pointer; }
.compacta tbody tr:hover { background: #f3f5f4; }
.compacta tbody tr.sel { background: #e8f3ee; }
.mes { min-height: 44px; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.sel .mes { font-weight: 600; }
.andamento { display: inline-block; padding: 1px 8px; border-radius: 99px; background: #e9eeec; color: #3d4a45; font: 500 11.5px Inter, system-ui, sans-serif; white-space: nowrap; }

/* ---------- notas ---------- */
.notas-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.notas-filtros { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 1 auto; }
.notas-filtros label { margin: 0; } .notas-filtros select { margin: 0; }
.busca { flex: 1 1 260px; } .busca input { margin: 0 !important; width: 330px !important; max-width: 100%; }
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--borda); margin: 12px 0 0; overflow-x: auto; }
.abas button { min-height: 44px; border: 0; background: none; padding: 0 14px; cursor: pointer; font: inherit; color: var(--suave); border-bottom: 3px solid transparent; white-space: nowrap; }
.abas button:focus-visible, .barra:focus-visible, .tabela button:focus-visible { outline-offset: -3px; }
.abas button[aria-pressed=true] { color: var(--verde); border-color: var(--verde); font-weight: 600; }
.abas span { margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: #e9eeec; color: #3d4a45; font-size: 12px; }
th[data-ordem] { padding: 0; }
th[data-ordem] button { min-height: 44px; width: 100%; padding: 0 8px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: inherit; }
th[data-ordem] button:hover { color: var(--texto); }
.seta { display: inline-block; width: 1em; margin-left: 4px; text-align: center; }
th[aria-sort] { color: var(--verde); }
th[aria-sort=ascending] .seta::after { content: "▲"; } th[aria-sort=descending] .seta::after { content: "▼"; }
.tabela small { color: var(--suave); font-size: 12.5px; white-space: nowrap; }
.nome { min-width: 200px; }
.cancelada td, .cancelada small { color: #66726d; }
.cancelada .risco { text-decoration: line-through; }
.xml { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; font-weight: 600; }
tfoot td { font-weight: 600; border-bottom: 0; border-top: 2px solid var(--borda); padding: 14px 8px; }
.fina { width: 120px; height: 6px; border-radius: 99px; background: #e0e7e4; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.fina span { display: block; height: 100%; background: var(--verde); }
.cliente { display: block; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; font: inherit; color: var(--verde); text-align: left; cursor: pointer; }
.cliente:hover b { text-decoration: underline; } .cliente b { font-weight: 600; } .cliente small { display: block; }

/* ---------- grupo, empresas e configurações ---------- */
.total-grupo { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 16px; }
.total-grupo p { margin: 0; } .total-grupo .valor { font: 600 26px/1.3 var(--titulo); color: #fff; }
.escuro .sobe { color: #5bd3a2; } .escuro .desce { color: #ffc27a; }
.cards-empresas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.card-empresa { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.card-empresa:hover { border-color: var(--verde); }
.card-empresa b { font: 600 17px var(--titulo); } .card-empresa .valor { font: 600 24px var(--titulo); }
.card-empresa span { font-size: 13px; }
.escolha { display: flex; gap: 8px; flex-wrap: wrap; }
.config { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; align-items: start; }
.config .larga { grid-column: 1 / -1; }
.config > :first-child { grid-row: span 4; }
.config form { margin-top: 12px; }
.campos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 10px; margin-bottom: 8px; }
.campos label { margin: 6px 0; min-width: 0; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } form.inline label { margin: 0; } form.inline input { width: 120px !important; margin: 0 !important; }
dialog { border: 0; border-radius: 12px; padding: 0; width: min(640px, 94vw); color: var(--texto); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog form { padding: 20px; }
dialog::backdrop { background: rgba(16, 41, 31, .5); }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
#aviso { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 9; max-width: 90vw; background: var(--texto); color: #fff; padding: 12px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#aviso.on { opacity: 1; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; min-height: 100vh; }
.login h1 span { color: var(--verde); }
.login-box { width: 340px; }
.login-box .btn { width: 100%; margin-top: 8px; }
.sub { color: var(--suave); margin-top: 0; }

@media (max-width: 900px) {
  .lateral { flex: 1 0 100%; width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 16px; }
  .sel-empresa { flex: 1 1 220px; }
  .lateral nav { flex: 1 1 100%; order: 3; flex-direction: row; flex-wrap: wrap; }
  .lateral-rodape { margin: 0; border: 0; padding: 0; }
  .conteudo { flex-basis: 100%; padding: 20px 16px; }
  .col-grafico, .col-comp { flex-basis: 100%; }
}
@media (max-width: 560px) {
  .drop-menu { right: auto; left: 0; }
  .campos label { grid-column: 1 / -1 !important; }
  .notas-filtros, .busca { flex: 1 1 100%; } .busca input { width: 100% !important; }
}
