/* =====================================================================
   oBEERcevando · Sistema de design
   Paleta tirada da marca: verde de barril, ouro de rótulo, lúpulo, madeira.
   Fundo claro em tom de papel esverdeado (não creme) para não competir
   com o ouro, que é a cor de ação do sistema.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bitter:ital,wght@0,400;0,600;0,700;1,400&family=Archivo:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* --- marca --- */
  --barril:        #10301F;   /* verde escuro do brasão */
  --barril-fundo:  #0B2417;
  --barril-claro:  #1D4B31;
  --ouro:          #B87309;   /* cor de ação */
  --ouro-claro:    #E3A93B;
  --ouro-fraco:    #F7EDD8;   /* fundo de item selecionado */
  --lupulo:        #5C8A2C;   /* positivo */
  --madeira:       #7A4A22;
  --rubi:          #A83A28;   /* negativo */
  --ambar:         #D9A441;

  /* --- superfícies (tema claro) --- */
  --bg:            #F1F4F0;
  --surface:       #FFFFFF;
  --surface-2:     #F7F9F6;
  --surface-3:     #EBEFE9;
  --border:        #DCE3DA;
  --border-forte:  #C3CDBF;

  /* --- texto --- */
  --texto:         #16201A;
  --texto-2:       #4C5A50;
  --texto-3:       #78877C;
  --texto-inverso: #F2F6F0;

  /* --- semântica --- */
  --ok:            #3F7A2E;
  --ok-bg:         #E8F2E2;
  --alerta:        #96650A;
  --alerta-bg:     #FBF0D8;
  --erro:          #A83A28;
  --erro-bg:       #FAE7E3;
  --info:          #235A54;
  --info-bg:       #E1EFEC;

  /* --- gráfico --- */
  --serie-1:       #1D4B31;
  --serie-2:       #C99230;
  --grade:         #E3E9E0;

  /* --- forma --- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --sombra-1: 0 1px 2px rgba(16, 48, 31, .06);
  --sombra-2: 0 4px 16px rgba(16, 48, 31, .09);
  --sombra-3: 0 12px 40px rgba(11, 36, 23, .18);

  /* --- tipografia --- */
  --fonte-display: 'Bitter', Georgia, serif;
  --fonte-ui:      'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fonte-dado:    'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --sidebar-w: 248px;
  --sidebar-w-min: 68px;
  --topo-h: 60px;
}

[data-tema="escuro"] {
  --bg:            #0D1410;
  --surface:       #141C17;
  --surface-2:     #1A241D;
  --surface-3:     #212D24;
  --border:        #2A382E;
  --border-forte:  #3C4E41;

  --texto:         #E7EDE6;
  --texto-2:       #A9B7AC;
  --texto-3:       #7C8B80;

  --ouro:          #D9A441;
  --ouro-claro:    #EFC46B;
  --ouro-fraco:    #2A2312;

  --ok:            #7DB35C;
  --ok-bg:         #1B2C18;
  --alerta:        #D9A441;
  --alerta-bg:     #2E2611;
  --erro:          #E2705C;
  --erro-bg:       #331A16;
  --info:          #6FB3A8;
  --info-bg:       #122926;

  --serie-1:       #6FA47C;
  --serie-2:       #D9A441;
  --grade:         #253028;

  --sombra-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sombra-2: 0 4px 16px rgba(0, 0, 0, .45);
  --sombra-3: 0 12px 40px rgba(0, 0, 0, .6);
}

/* ------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font: 400 15px/1.55 var(--fonte-ui);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--fonte-display);
  font-weight: 600;
  letter-spacing: -.012em;
  margin: 0;
  color: var(--texto);
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

/* Todo ícone nasce com dimensão. Um SVG com viewBox e sem width/height
   se estica até a largura do container — nunca deixar isso ao acaso.
   As regras contextuais abaixo (.btn svg, .nav__item svg, .vazio svg)
   têm especificidade maior e continuam mandando onde existem. */
.ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -3px;
}
.ico--g { width: 22px; height: 22px; }
.ico--p { width: 14px; height: 14px; vertical-align: -2px; }

:focus-visible {
  outline: 2px solid var(--ouro);
  outline-offset: 2px;
  border-radius: 3px;
}

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--fonte-dado); font-size: .86em; letter-spacing: -.02em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================================================ ENTRADA */

.entrada {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}

.entrada__marca {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px;
  background:
    radial-gradient(120% 90% at 15% 0%, #1D4B31 0%, #10301F 45%, #081A11 100%);
  color: var(--texto-inverso);
  overflow: hidden;
}

/* Textura de cevada: linhas finas em ângulo, quase imperceptíveis. */
.entrada__marca::after {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    62deg, rgba(217, 164, 65, .07) 0 1px, transparent 1px 13px);
  pointer-events: none;
}

.entrada__logo { max-width: 320px; height: auto; position: relative; z-index: 1; }

.entrada__frase {
  position: relative; z-index: 1;
  max-width: 30ch;
}
.entrada__frase h1 {
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.12;
  color: #FFF;
}
.entrada__frase p {
  margin: 14px 0 0;
  color: rgba(242, 246, 240, .72);
  font-size: 15px;
}

.entrada__cadeia {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(227, 169, 59, .85);
}
.entrada__cadeia span::after { content: ' ·'; color: rgba(242,246,240,.3); }
.entrada__cadeia span:last-child::after { content: ''; }

.entrada__painel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 32px;
}
.entrada__form { width: 100%; max-width: 380px; }
.entrada__form h2 { font-size: 26px; margin-bottom: 6px; }
.entrada__form > p { color: var(--texto-2); margin: 0 0 26px; font-size: 14px; }

@media (max-width: 900px) {
  .entrada { grid-template-columns: 1fr; }
  .entrada__marca { padding: 28px; gap: 22px; }
  .entrada__logo { max-width: 210px; }
  .entrada__frase h1 { font-size: 26px; }
  .entrada__cadeia { display: none; }
}

/* ============================================================ ESTRUTURA */

.app { min-height: 100vh; }

.lateral {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--barril-fundo);
  color: rgba(242, 246, 240, .82);
  display: flex; flex-direction: column;
  z-index: 40;
  transition: width .18s ease, transform .22s ease;
}

.lateral__topo {
  height: var(--topo-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(242, 246, 240, .09);
  flex-shrink: 0;
}
.lateral__logo { height: 34px; width: auto; flex-shrink: 0; }
.lateral__nome {
  font-family: var(--fonte-display);
  font-weight: 700; font-size: 16px; color: #FFF;
  white-space: nowrap; overflow: hidden;
}
.lateral__nome small {
  display: block; font-family: var(--fonte-ui); font-weight: 400;
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(227, 169, 59, .8);
}

.lateral__nav {
  flex: 1; overflow-y: auto; padding: 12px 10px 20px;
  scrollbar-width: thin; scrollbar-color: rgba(242,246,240,.18) transparent;
}
.lateral__nav::-webkit-scrollbar { width: 6px; }
.lateral__nav::-webkit-scrollbar-thumb { background: rgba(242,246,240,.16); border-radius: 3px; }

.nav__grupo {
  margin: 16px 0 6px; padding: 0 10px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(242, 246, 240, .4);
}
.nav__grupo:first-child { margin-top: 2px; }

.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 1px;
  border-radius: var(--r-sm);
  font-size: 14px; color: rgba(242, 246, 240, .78);
  transition: background .13s ease, color .13s ease;
  position: relative;
}
.nav__item:hover { background: rgba(242, 246, 240, .07); color: #FFF; }
.nav__item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }

.nav__item.is-ativo {
  background: rgba(184, 115, 9, .17);
  color: #FFF; font-weight: 500;
}
.nav__item.is-ativo::before {
  content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; background: var(--ouro-claro); border-radius: 0 2px 2px 0;
}
.nav__item.is-ativo svg { opacity: 1; color: var(--ouro-claro); }

.nav__contagem {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: rgba(242, 246, 240, .12); color: #FFF;
  padding: 1px 6px; border-radius: 20px;
}

.lateral__rodape {
  border-top: 1px solid rgba(242, 246, 240, .09);
  padding: 10px;
  flex-shrink: 0;
}
.usuario {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: var(--r-sm);
  width: 100%; background: none; border: 0; cursor: pointer;
  text-align: left; color: inherit;
}
.usuario:hover { background: rgba(242, 246, 240, .07); }
.usuario__inicial {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--ouro); color: #10301F;
  font-weight: 700; font-size: 12px;
}
.usuario__dados { overflow: hidden; }
.usuario__nome { font-size: 13.5px; color: #FFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario__papel { font-size: 11px; color: rgba(242, 246, 240, .5); }

/* --- conteúdo --- */

.conteudo {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left .18s ease;
}

.topo {
  position: sticky; top: 0; z-index: 30;
  height: var(--topo-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topo__titulo { font-size: 17px; font-weight: 600; }
.topo__acoes { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.migalhas {
  font-size: 12.5px; color: var(--texto-3);
  display: flex; align-items: center; gap: 6px;
}
.migalhas a:hover { color: var(--ouro); }
.migalhas span::after { content: '/'; margin-left: 6px; color: var(--border-forte); }
.migalhas span:last-child::after { content: ''; }

.pagina { padding: 22px; max-width: 1560px; }

.pagina__cabecalho {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.pagina__cabecalho h1 { font-size: 24px; }
.pagina__cabecalho p { margin: 4px 0 0; color: var(--texto-2); font-size: 13.5px; }
.pagina__cabecalho .acoes { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1024px) {
  .lateral { transform: translateX(-100%); box-shadow: var(--sombra-3); }
  .conteudo { margin-left: 0; }
  body.menu-aberto .lateral { transform: translateX(0); }
  body.menu-aberto::after {
    content: ''; position: fixed; inset: 0; z-index: 35;
    background: rgba(8, 26, 17, .5);
  }
}

@media (min-width: 1025px) {
  body.menu-recolhido .lateral { width: var(--sidebar-w-min); }
  body.menu-recolhido .conteudo { margin-left: var(--sidebar-w-min); }
  body.menu-recolhido .lateral__nome,
  body.menu-recolhido .nav__grupo,
  body.menu-recolhido .nav__item span,
  body.menu-recolhido .usuario__dados,
  body.menu-recolhido .nav__contagem { display: none; }
  body.menu-recolhido .nav__item { justify-content: center; padding: 9px; }
  body.menu-recolhido .lateral__topo { justify-content: center; padding: 0; }
}

/* ============================================================ CARTÕES */

.grade { display: grid; gap: 14px; }
.grade--4 { grid-template-columns: repeat(4, 1fr); }
.grade--3 { grid-template-columns: repeat(3, 1fr); }
.grade--2 { grid-template-columns: repeat(2, 1fr); }
.grade--2-1 { grid-template-columns: 2fr 1fr; }

@media (max-width: 1280px) { .grade--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) { .grade--2-1, .grade--3 { grid-template-columns: 1fr; } }
@media (max-width: 720px)  { .grade--4, .grade--2 { grid-template-columns: 1fr; } }

.cartao {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sombra-1);
}
.cartao__topo {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.cartao__topo h2, .cartao__topo h3 { font-size: 15px; font-weight: 600; }
.cartao__topo .acoes { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.cartao__corpo { padding: 16px; }
.cartao__rodape {
  padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--texto-3);
  display: flex; align-items: center; gap: 8px;
}

/* --- indicador (KPI) --- */

.kpi { padding: 15px 16px 14px; }
.kpi__rotulo {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--texto-2); margin-bottom: 8px;
}
.kpi__valor {
  font-family: var(--fonte-display);
  font-size: 27px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.kpi__valor small { font-size: 15px; font-weight: 600; color: var(--texto-2); }
.kpi__nota { margin-top: 7px; font-size: 12.5px; color: var(--texto-3); }
.kpi--destaque { border-left: 3px solid var(--ouro); }
.kpi--ok .kpi__valor    { color: var(--ok); }
.kpi--erro .kpi__valor  { color: var(--erro); }

.variacao {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 20px;
  font-variant-numeric: tabular-nums;
}
.variacao.sobe  { background: var(--ok-bg);    color: var(--ok); }
.variacao.desce { background: var(--erro-bg);  color: var(--erro); }
.variacao.igual { background: var(--surface-3); color: var(--texto-3); }

/* ============================================================ TRILHA
   Elemento-assinatura: a cadeia insumo → margem que o sistema integra.
   Cada elo mostra um número real; sem dado, o elo fica apagado.       */

.trilha {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; padding: 4px 2px 8px;
  scrollbar-width: thin;
}
.trilha__elo {
  flex: 1 0 132px;
  position: relative;
  padding: 12px 14px 12px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 0;
  display: block;
  transition: background .15s ease, transform .15s ease;
}
.trilha__elo:first-child {
  border-left: 1px solid var(--border);
  border-radius: var(--r-md) 0 0 var(--r-md);
  padding-left: 14px;
}
.trilha__elo:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }

/* Chevron entre elos: a seta do fluxo, não decoração. */
.trilha__elo:not(:first-child)::before {
  content: ''; position: absolute; left: -1px; top: 50%;
  width: 9px; height: 9px; margin-top: -5px;
  border-top: 1px solid var(--border); border-right: 1px solid var(--border);
  transform: rotate(45deg) translateX(-2px);
  background: var(--surface-2);
  z-index: 1;
}
.trilha__elo:hover { background: var(--surface-3); }
.trilha__elo:hover::before { background: var(--surface-3); }

.trilha__rotulo {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--texto-3); margin-bottom: 5px;
}
.trilha__valor {
  font-family: var(--fonte-display); font-weight: 600;
  font-size: 16px; font-variant-numeric: tabular-nums;
}
.trilha__elo.vazio .trilha__valor { color: var(--texto-3); font-weight: 400; font-size: 13px; }
.trilha__elo.ativo { background: var(--surface); }
.trilha__elo.ativo::before { background: var(--surface); }
.trilha__elo.ativo .trilha__valor { color: var(--barril-claro); }
[data-tema="escuro"] .trilha__elo.ativo .trilha__valor { color: var(--ouro-claro); }
.trilha__elo.alerta .trilha__valor { color: var(--alerta); }

/* ============================================================ INSIGHTS */

.insight {
  display: flex; gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
}
.insight:last-child { border-bottom: 0; }
.insight__marca {
  width: 4px; border-radius: 3px; flex-shrink: 0;
  background: var(--border-forte);
}
.insight--bom .insight__marca     { background: var(--ok); }
.insight--atencao .insight__marca { background: var(--alerta); }
.insight--critico .insight__marca { background: var(--erro); }
.insight--neutro .insight__marca  { background: var(--info); }
.insight--vazio  { opacity: .62; }

.insight__titulo { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.insight__texto { font-size: 13.5px; color: var(--texto-2); line-height: 1.5; }
.insight__link {
  display: inline-block; margin-top: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--ouro);
}
.insight__link:hover { text-decoration: underline; }

/* ============================================================ TABELAS */

.tabela-caixa {
  overflow-x: auto;
  border-radius: var(--r-md);
}
table.tabela {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
.tabela thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  text-align: left; font-weight: 600; font-size: 12px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--texto-2);
  padding: 9px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.tabela thead th a { display: inline-flex; align-items: center; gap: 4px; }
.tabela thead th a:hover { color: var(--ouro); }
.tabela tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover { background: var(--surface-2); }
.tabela .num, .tabela .direita { text-align: right; font-variant-numeric: tabular-nums; }
.tabela .principal { font-weight: 600; }
.tabela .apoio { font-size: 12px; color: var(--texto-3); }
.tabela .acoes-linha { display: flex; gap: 4px; justify-content: flex-end; }

/* ============================================================ FORMULÁRIOS */

.campo { margin-bottom: 15px; }
.campo > label {
  display: block; margin-bottom: 5px;
  font-size: 13px; font-weight: 500; color: var(--texto-2);
}
.campo .obrigatorio { color: var(--erro); }
.campo .ajuda { font-size: 12px; color: var(--texto-3); margin-top: 4px; display: block; }

.entrada-texto, select.entrada-texto, textarea.entrada-texto {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--border-forte);
  border-radius: var(--r-sm);
  color: var(--texto);
  transition: border-color .13s ease, box-shadow .13s ease;
  font-size: 14px;
}
.entrada-texto::placeholder { color: var(--texto-3); }
.entrada-texto:hover { border-color: var(--texto-3); }
.entrada-texto:focus {
  outline: 0;
  border-color: var(--ouro);
  box-shadow: 0 0 0 3px rgba(184, 115, 9, .16);
}
.entrada-texto:disabled { background: var(--surface-3); color: var(--texto-3); cursor: not-allowed; }
textarea.entrada-texto { min-height: 84px; resize: vertical; }
select.entrada-texto {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2378877C' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.campo.tem-erro .entrada-texto { border-color: var(--erro); }
.field-error { display: block; margin-top: 4px; font-size: 12.5px; color: var(--erro); }

.linha-campos { display: grid; gap: 14px; }
.linha-campos.c2 { grid-template-columns: 1fr 1fr; }
.linha-campos.c3 { grid-template-columns: repeat(3, 1fr); }
.linha-campos.c4 { grid-template-columns: repeat(4, 1fr); }
.linha-campos.cep { grid-template-columns: 160px 1fr 110px; }
@media (max-width: 820px) {
  .linha-campos.c2, .linha-campos.c3, .linha-campos.c4, .linha-campos.cep { grid-template-columns: 1fr; }
}

.grupo-entrada { display: flex; gap: 6px; }
.grupo-entrada .entrada-texto { flex: 1; }

.marcador { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.marcador input { width: 15px; height: 15px; accent-color: var(--ouro); cursor: pointer; }

/* Grupo de escolhas lado a lado (pessoa física / jurídica, por exemplo). */
.opcoes { display: flex; flex-wrap: wrap; gap: 18px; padding: 2px 0; }
.opcoes .marcador { padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--r-md);
                    background: var(--surface-2); transition: border-color .12s, background .12s; }
.opcoes .marcador:hover { border-color: var(--border-forte); }
.opcoes .marcador:has(input:checked) { border-color: var(--ouro); background: var(--ouro-fraco); }

/* ============================================================ BOTÕES */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .13s ease, border-color .13s ease, color .13s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--principal { background: var(--ouro); color: #FFF8EB; }
.btn--principal:hover:not(:disabled) { background: #9C6108; }

.btn--secundario {
  background: var(--surface); color: var(--texto);
  border-color: var(--border-forte);
}
.btn--secundario:hover:not(:disabled) { background: var(--surface-2); border-color: var(--texto-3); }

.btn--sutil { background: transparent; color: var(--texto-2); }
.btn--sutil:hover:not(:disabled) { background: var(--surface-3); color: var(--texto); }

.btn--perigo { background: transparent; color: var(--erro); border-color: var(--border-forte); }
.btn--perigo:hover:not(:disabled) { background: var(--erro-bg); border-color: var(--erro); }

.btn--pequeno { padding: 5px 9px; font-size: 12.5px; }
.btn--icone { padding: 7px; }
.btn--icone svg { width: 16px; height: 16px; }

/* ============================================================ FILTROS */

.filtros {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.filtros .busca { position: relative; flex: 1 1 240px; max-width: 340px; }
.filtros .busca svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--texto-3); pointer-events: none;
}
.filtros .busca .entrada-texto { padding-left: 32px; }
.filtros select.entrada-texto { width: auto; min-width: 130px; }
.filtros .direita { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.periodo {
  display: inline-flex; background: var(--surface-3);
  border-radius: var(--r-sm); padding: 2px;
}
.periodo a {
  padding: 5px 11px; border-radius: 5px;
  font-size: 12.5px; font-weight: 500; color: var(--texto-2);
}
.periodo a:hover { color: var(--texto); }
.periodo a.is-ativo {
  background: var(--surface); color: var(--texto);
  box-shadow: var(--sombra-1); font-weight: 600;
}

/* ============================================================ SITUAÇÃO */

.selo {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.selo::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.selo.is-ok      { background: var(--ok-bg);     color: var(--ok); }
.selo.is-wait    { background: var(--alerta-bg); color: var(--alerta); }
.selo.is-bad     { background: var(--erro-bg);   color: var(--erro); }
.selo.is-off     { background: var(--surface-3); color: var(--texto-3); }
.selo.is-neutral { background: var(--info-bg);   color: var(--info); }

/* ============================================================ AVISOS */

.avisos {
  position: fixed; top: 14px; right: 14px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  width: min(380px, calc(100vw - 28px));
}
.aviso {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--r-sm);
  box-shadow: var(--sombra-2);
  font-size: 13.5px;
  animation: entra .22s ease;
}
.aviso--sucesso { border-left-color: var(--ok); }
.aviso--erro    { border-left-color: var(--erro); }
.aviso--atencao { border-left-color: var(--alerta); }
.aviso__fechar {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--texto-3); font-size: 17px; line-height: 1; padding: 0 2px;
}
@keyframes entra { from { opacity: 0; transform: translateY(-6px); } }

.faixa {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; border-radius: var(--r-md);
  background: var(--info-bg); color: var(--info);
  font-size: 13.5px; margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--info) 22%, transparent);
}
.faixa--atencao { background: var(--alerta-bg); color: var(--alerta); border-color: color-mix(in srgb, var(--alerta) 25%, transparent); }
.faixa strong { display: block; margin-bottom: 2px; }
.faixa a { font-weight: 600; text-decoration: underline; }

/* ============================================================ VAZIO */

.vazio {
  text-align: center; padding: 44px 22px;
  color: var(--texto-2);
}
.vazio svg { width: 34px; height: 34px; color: var(--border-forte); margin-bottom: 10px; }
.vazio h3 { font-size: 15.5px; margin-bottom: 5px; }
.vazio p { margin: 0 auto 16px; max-width: 42ch; font-size: 13.5px; color: var(--texto-3); }

/* ============================================================ ABAS */

.abas {
  display: flex; gap: 2px; overflow-x: auto;
  border-bottom: 1px solid var(--border);
  padding: 0 6px;
}
.abas button {
  background: none; border: 0; cursor: pointer;
  padding: 11px 14px;
  font-size: 13.5px; font-weight: 500; color: var(--texto-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.abas button:hover { color: var(--texto); }
.abas button.is-ativa { color: var(--texto); border-bottom-color: var(--ouro); font-weight: 600; }
.aba-painel { display: none; padding: 18px 16px; }
.aba-painel.is-ativa { display: block; }

/* ============================================================ PAGINAÇÃO */

.paginacao {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 16px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--texto-2);
}
.paginacao .paginas { margin-left: auto; display: flex; gap: 4px; }
.paginacao .paginas a, .paginacao .paginas span {
  min-width: 30px; height: 30px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 13px;
}
.paginacao .paginas a:hover { border-color: var(--ouro); color: var(--ouro); }
.paginacao .paginas .atual { background: var(--barril); color: #FFF; border-color: var(--barril); font-weight: 600; }
[data-tema="escuro"] .paginacao .paginas .atual { background: var(--ouro); color: #10301F; border-color: var(--ouro); }

/* ============================================================ MODAL */

.modal-fundo {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 26, 17, .55);
  display: grid; place-items: center; padding: 18px;
  animation: entra .16s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sombra-3);
  width: min(520px, 100%);
  max-height: 90vh; overflow-y: auto;
}
.modal__topo { padding: 16px 18px 12px; }
.modal__topo h3 { font-size: 17px; }
.modal__corpo { padding: 0 18px 4px; color: var(--texto-2); font-size: 14px; }
.modal__rodape {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 18px;
}

/* ============================================================ GRÁFICO */

.grafico { width: 100%; display: block; }
.grafico .grade-linha { stroke: var(--grade); stroke-width: 1; }
.grafico .eixo-texto { fill: var(--texto-3); font-size: 10.5px; font-family: var(--fonte-ui); }
.grafico .area-receita { fill: var(--serie-1); opacity: .14; }
.grafico .linha-receita { fill: none; stroke: var(--serie-1); stroke-width: 2; stroke-linejoin: round; }
.grafico .linha-custo { fill: none; stroke: var(--serie-2); stroke-width: 1.5; stroke-dasharray: 4 3; }
.grafico .ponto { fill: var(--serie-1); }

.legenda { display: flex; gap: 16px; font-size: 12.5px; color: var(--texto-2); }
.legenda i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }

/* ============================================================ IMPRESSÃO */

@media print {
  .lateral, .topo, .filtros, .acoes, .paginacao, .avisos { display: none !important; }
  .conteudo { margin-left: 0; }
  .pagina { padding: 0; }
  .cartao { border: 1px solid #CCC; box-shadow: none; break-inside: avoid; }
  body { background: #FFF; font-size: 11pt; }

  /* Cabeçalho do relatório: só faz sentido no papel, onde não há barra de menu
     para dizer de que empresa e de que período é aquela folha. */
  .so-impressao {
    display: block !important;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #333;
    font-size: 10pt;
    line-height: 1.5;
  }

  /* Tabela longa repete o cabeçalho em cada página. */
  .tabela thead { display: table-header-group; }
  .tabela tfoot { display: table-footer-group; }
  .tabela tr    { break-inside: avoid; }
  .tabela-caixa { overflow: visible; }

  a[href]::after { content: ""; }   /* não imprimir URLs entre parênteses */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ---------------------------------------------------------------- *
 * Alternância de ícone conforme o tema em vigor
 * ---------------------------------------------------------------- */
/* Escondido na tela; @media print o revela. */
.so-impressao { display: none; }

.so-claro  { display: inline-flex; }
.so-escuro { display: none; }
[data-tema="escuro"] .so-claro  { display: none; }
[data-tema="escuro"] .so-escuro { display: inline-flex; }
