/* o atributo hidden vale mesmo em elemento com display próprio (.usuario, .avisos) */
[hidden] { display: none !important; }
/* Estilo da ferramenta, vindo do protótipo aprovado (prototipo/dre.html). Sem estilo inline: a CSP proíbe. */
  :root {
    --bg: #f6f7f9; --card: #ffffff; --ink: #1d2433; --muted: #667085; --line: #e4e7ec;
    --accent: #2f6fdf; --accent-soft: #e8f0fd; --pos: #1a7f4b; --neg: #b42318;
    --sub: #f2f4f7; --total: #e8f0fd; --warn: #b54708; --warn-soft: #fef0c7;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #12151c; --card: #1a1f29; --ink: #e6e9ef; --muted: #98a2b3; --line: #2b3240;
      --accent: #6b9cf5; --accent-soft: #1e2a40; --pos: #4cc38a; --neg: #f97066;
      --sub: #212734; --total: #1e2a40; --warn: #fdb022; --warn-soft: #3a2d10;
    }
  }
  * { box-sizing: border-box; }
  body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
  header { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
  header h1 { font-size: 16px; margin: 0; }
  header h1 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
  nav { display: flex; gap: 4px; }
  nav button { border: 0; background: none; padding: 8px 12px; border-radius: 6px; color: var(--muted); font: inherit; cursor: pointer; }
  nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .ficticio { margin-left: auto; font-size: 12px; background: var(--warn-soft); color: var(--warn); padding: 4px 10px; border-radius: 99px; }
  main { padding: 20px 24px 48px; max-width: 1500px; margin: 0 auto; }
  section[hidden] { display: none; }
  .barra { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
  .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
  .seg button { border: 0; background: none; padding: 7px 14px; font: inherit; color: var(--muted); cursor: pointer; }
  .seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
  label.campo { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
  select, input[type=text] { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
  .ajuda { color: var(--muted); font-size: 12px; }
  .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
  .kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
  .kpi .rot { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
  .kpi .val { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
  .kpi .det { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .rolagem { overflow-x: auto; }
  table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
  th, td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
  th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: inherit; z-index: 1; }
  thead th { background: var(--sub); color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; }
  tbody tr { background: var(--card); }
  tr.secao td { font-weight: 600; }
  tr.subtotal { background: var(--sub); }
  tr.subtotal td { font-weight: 700; }
  tr.lucro { background: var(--total); }
  tr.grupo td:first-child { padding-left: 26px; }
  tr.conta td:first-child { padding-left: 46px; color: var(--muted); }
  td.neg { color: var(--neg); }
  td.av { color: var(--muted); font-size: 12px; }
  td.clicavel { cursor: pointer; }
  td.clicavel:hover { background: var(--accent-soft); }
  .seta { display: inline-block; width: 14px; color: var(--muted); cursor: pointer; user-select: none; }
  .col-total { border-left: 2px solid var(--line); }
  .gaveta { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--card); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .2s; z-index: 10; display: flex; flex-direction: column; }
  .gaveta.aberta { transform: none; }
  .gaveta header { padding: 16px; }
  .gaveta .corpo { overflow: auto; padding: 0 0 16px; }
  .gaveta td, .gaveta th { text-align: left; white-space: normal; position: static; }
  .gaveta td.n, .gaveta th.n { text-align: right; }
  .fechar { margin-left: auto; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
  .badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--sub); color: var(--muted); }
  .badge.alta { background: #d1fadf; color: #05603a; }
  .badge.media { background: var(--warn-soft); color: var(--warn); }
  .badge.baixa { background: #fee4e2; color: #b42318; }
  @media (prefers-color-scheme: dark) { .badge.alta { background: #0b3b24; color: #6ce9a6; } .badge.baixa { background: #3d1513; color: #fda29b; } }
  .btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 7px 14px; border-radius: 6px; font: inherit; cursor: pointer; }
  .btn.sec { background: var(--card); color: var(--accent); }
  .btn:disabled { opacity: .5; cursor: default; }
  .grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  @media (max-width: 900px) { .grade2 { grid-template-columns: 1fr; } }
  .card h2 { font-size: 14px; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .drop { border: 2px dashed var(--line); border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); background: var(--card); }
  .drop strong { color: var(--ink); display: block; margin-bottom: 4px; }
  .lista-arq td, .lista-arq th, #tabPend td, #tabPend th { text-align: left; }
  .barra-mini { height: 6px; border-radius: 3px; background: var(--sub); overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; }
  .barra-mini span { display: block; height: 100%; background: var(--accent); }
  .nota { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 14px; margin: 16px 0; color: var(--muted); font-size: 13px; }

  .neg-txt { color: var(--neg); }
  .grade1 { display: grid; grid-template-columns: 1fr; gap: 16px; }
  .mt16 { margin-top: 16px; }
  .valor-dir { text-align: right; }
  .usuario { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
  .usuario button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 6px; padding: 4px 10px; font: inherit; cursor: pointer; }
  .centro { max-width: 520px; margin: 12vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px; text-align: center; }
  .centro h2 { margin: 0 0 8px; font-size: 18px; }
  .centro p { color: var(--muted); }
  .erro { color: var(--neg); }
  .avisos { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
  .avisos[hidden] { display: none; }
  .progresso { color: var(--muted); font-size: 13px; text-align: left; margin: 16px auto 0; display: inline-block; }
  .pad { padding: 0 14px; }
  /* Classificar: largura fixa por coluna (redimensionável), texto quebra em vez de esconder colunas */
  /* abaixo de 1.100 px a tabela rola de lado, em vez de espremer as colunas até quebrar a data */
  #tabPend { table-layout: fixed; min-width: 1100px; }
  #tabPend td.curto { white-space: nowrap; overflow-wrap: normal; }
  #tabPend th, #tabPend td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; position: relative; }
  #tabPend th:first-child, #tabPend td:first-child { position: static; }
  #tabPend td.valor-dir { white-space: nowrap; }
  #tabPend input[type=text], #tabPend select { width: 100%; min-width: 0; box-sizing: border-box; }
  .alca { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 2; }
  .alca:hover, .alca:active { background: var(--accent); opacity: .5; }
  .badge.prefixo { background: var(--accent-soft); color: var(--accent); }
  /* gráfico de saldos: paleta validada (skill dataviz), azul e laranja em ordem fixa, total em tinta neutra */
  :root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; }
  @media (prefers-color-scheme: dark) { :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; } }
  .mb16 { margin-bottom: 16px; }
  .grafico-caixa { position: relative; }
  .svg-grafico { width: 100%; height: auto; display: block; }
  .svg-grafico .grade { stroke: var(--line); stroke-width: 1; }
  .svg-grafico .eixo { fill: var(--muted); font-size: 11px; }
  .svg-grafico .linha { fill: none; stroke-width: 2; stroke-linejoin: round; }
  .svg-grafico .ponto { stroke: var(--card); stroke-width: 2; }
  .svg-grafico .rotulo-serie { fill: var(--ink); font-size: 12px; }
  .svg-grafico .cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
  .svg-grafico .alvo { fill: transparent; }
  .linha.s1 { stroke: var(--s1); } .ponto.s1, .marca.s1 { fill: var(--s1); background: var(--s1); }
  .linha.s2 { stroke: var(--s2); } .ponto.s2, .marca.s2 { fill: var(--s2); background: var(--s2); }
  .linha.s3 { stroke: var(--s3); } .ponto.s3, .marca.s3 { fill: var(--s3); background: var(--s3); }
  .linha.stotal { stroke: var(--ink); stroke-width: 2.5; } .ponto.stotal, .marca.stotal { fill: var(--ink); background: var(--ink); }
  .legenda { display: flex; gap: 16px; font-size: 12px; color: var(--muted); padding: 4px 0 8px; }
  .marca { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
  .tooltip { position: absolute; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.15); pointer-events: none; min-width: 170px; }
  .tooltip b { display: block; margin-bottom: 4px; }
  details summary { cursor: pointer; padding: 6px 0; }
  .mini { width: 90px; height: 22px; } .mini path { fill: none; stroke: var(--accent); stroke-width: 1.5; }
  #tabEvol td, #tabEvol th { font-size: 12px; }
  .subtitulo { font-size: 13px; margin: 12px 0 4px; }
  #conferencia input[type=text] { width: 140px; }
  #conferencia { padding-bottom: 12px; }
  .apagar { border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 6px; border-radius: 4px; }
  .apagar:hover { color: var(--neg); background: var(--sub); }
  td.abre { cursor: pointer; }
  td.abre:hover { color: var(--accent); }
  #tabCruz th.vert { max-width: 90px; white-space: normal; font-size: 11px; vertical-align: bottom; }
  #tabCruz td { text-align: center; } #tabCruz td:first-child { text-align: left; }
  .kpi .val.carregando { font-size: 15px; font-weight: 500; color: var(--muted); }
