/* Inter self-hosted (fonte com leitura mais confortavel e métricas estáveis,
   sem dependencia de CDN em runtime — o CSP so libera font-src 'self'). */
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/Inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/Inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/Inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/Inter-700.woff2') format('woff2');
}

:root {
  --font-sans: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #565e6b;
  --border: #e3e6ea;
  --primary: #2563eb;
  --error: #b42318;
  --ok: #067647;
  --radius: 10px;

  /* Estados de superficie: derivados do texto para funcionar nos dois temas
     sem precisar de um par de cores fixo para cada um. */
  --hover: color-mix(in srgb, var(--text) 6%, transparent);
  --active: color-mix(in srgb, var(--primary) 12%, transparent);
  --shadow: 0 8px 24px -8px rgb(16 18 21 / 18%), 0 2px 6px -2px rgb(16 18 21 / 10%);

  /* Respiro lateral unico: navbar e conteudo alinham pela mesma margem. */
  --gutter: clamp(1rem, 3.5vw, 2.75rem);

  /* Anel de foco unico (issue #25): usado por inputs, botoes, selects e links.
     Cor primaria + halo translucido para contraste AA nos dois temas. */
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);
  --focus-outline: 2px solid var(--primary);

  /* Duracao do auto-hide dos toasts/alertas (issue #31) e do fade-out. */
  --toast-duracao: 6000ms;
  --toast-fade: 320ms;

  /* Aviso/atencao (barra de progresso >= 80%). */
  --warn: #b45309;

  /* ===== Tokens de contraste (issue #7) =========================
     Fundos dos alertas/tags e a borda dos campos precisam de par
     PROPRIO por tema: antes o fundo era hex claro fixo e o texto vinha
     de --error/--ok, que clareiam no escuro — o par resultante caia
     para 1.9:1. Agora fundo e texto viajam juntos.
     --border-input: borda de controle interativo pede 3:1 (WCAG
     1.4.11). A --border de 1.25:1 serve para divisoria, nao para
     delimitar campo. */
  --border-input: #767e8b;
  --alert-error-bg: #fdeceb;
  --alert-ok-bg: #e6f6ee;
  --tag-warn-bg: #fdf0d5;
  --tag-warn-text: #92400e;
  --tag-ok-bg: #e6f6ee;
  --tag-ok-text: #067647;
  --tag-carro-text: #1e40af;
  --primary-strong: #1d4ed8;
}

/* Tema escuro: segue a preferencia do SO, a menos que o usuario escolha
   explicitamente (data-theme no <html>, persistido em localStorage pelo
   common.js). O botao de tema no header alterna entre claro/escuro. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1115;
    --surface: #181b20;
    --text: #e8eaed;
    --muted: #a8aeb4;
    --border: #343a42;
    --primary: #5b8dee;
    --error: #f06b5e;
    --ok: #34c98a;
    --shadow: 0 8px 24px -8px rgb(0 0 0 / 60%), 0 2px 6px -2px rgb(0 0 0 / 45%);
    --hover: color-mix(in srgb, var(--text) 9%, transparent);
    --warn: #f59e0b;
    --border-input: #6b7480;
    --alert-error-bg: #2a1614;
    --alert-ok-bg: #10251c;
    --tag-warn-bg: #2b2110;
    --tag-warn-text: #f59e0b;
    --tag-ok-bg: #10251c;
    --tag-ok-text: #34c98a;
    --tag-carro-text: #9db9f5;
    --primary-strong: #9db9f5;
  }
}
:root[data-theme='dark'], :root[data-bs-theme='dark'] {
  --bg: #0f1115;
  --surface: #181b20;
  --text: #e8eaed;
  --muted: #a8aeb4;
  --border: #343a42;
  --primary: #5b8dee;
  --error: #f06b5e;
  --ok: #34c98a;
  --shadow: 0 8px 24px -8px rgb(0 0 0 / 60%), 0 2px 6px -2px rgb(0 0 0 / 45%);
  --hover: color-mix(in srgb, var(--text) 9%, transparent);
  /* Laranja mais claro para manter contraste AA sobre superficie escura. */
  --warn: #f59e0b;
  /* Pares de contraste do tema escuro (issue #7) — ver bloco :root. */
  --border-input: #6b7480;
  --alert-error-bg: #2a1614;
  --alert-ok-bg: #10251c;
  --tag-warn-bg: #2b2110;
  --tag-warn-text: #f59e0b;
  --tag-ok-bg: #10251c;
  --tag-ok-text: #34c98a;
  --tag-carro-text: #9db9f5;
  --primary-strong: #9db9f5;
}

* { box-sizing: border-box; }

/* ===== Foco visivel (issue #25) ==============================
   Todo controle interativo ganha anel de foco contrastante quando o foco vem
   do teclado. Nunca removemos outline sem substituto visivel. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
  border-radius: 6px;
}
/* Navegacao por mouse nao pinta o anel, mas o campo ainda marca o foco. */
input:focus, select:focus, textarea:focus { border-color: var(--primary); }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  /* Layout em coluna: empurra o rodape para o fim da viewport mesmo
     quando o conteudo e curto (ex.: tela de login). */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0 var(--gutter); height: 56px;
}

.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 650; letter-spacing: -0.01em;
  text-decoration: none; color: var(--text); white-space: nowrap;
}
.brand-mark { color: var(--primary); flex: none; }

/* Botao de tema (sol/lua) no header. Fica colado a marca e herda o tom do
   texto; mostra o icone do tema OPOSTO ao atual para indicar a acao. */
.theme-toggle {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; margin-left: 0.5rem;
  padding: 0; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { background: var(--hover); border-color: var(--primary); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-toggle .ic-lua { display: none; }
/* No tema escuro, mostra a lua (a acao leva de volta ao claro). */
:root[data-theme='dark'] .theme-toggle .ic-sol,
:root[data-bs-theme='dark'] .theme-toggle .ic-sol { display: none; }
:root[data-theme='dark'] .theme-toggle .ic-lua,
:root[data-bs-theme='dark'] .theme-toggle .ic-lua { display: block; }
/* Sem escolha explicita mas SO escuro: tambem mostra a lua. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .ic-sol { display: none; }
  :root:not([data-theme='light']) .theme-toggle .ic-lua { display: block; }
}

/* Nav ocupa o meio; o menu da conta fica colado a direita. */
.nav-main { display: flex; align-items: center; gap: 0.15rem; flex: 1; min-width: 0; }
.nav-main a {
  padding: 0.45rem 0.7rem; border-radius: 7px;
  color: var(--muted); text-decoration: none;
  font-size: 0.925rem; font-weight: 500; white-space: nowrap;
}
.nav-main a:hover { background: var(--hover); color: var(--text); }
.nav-main a.is-active { color: var(--text); background: var(--active); font-weight: 600; }

.nav-user { margin-left: auto; }
.avatar {
  display: grid; place-items: center; flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 700;
}
.nav-user-name { font-size: 0.9rem; font-weight: 500; }

/* Menu da conta com <details>: sem JS, acessivel por teclado. */
.menu { position: relative; }
.menu summary {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0.5rem; border-radius: 8px; cursor: pointer;
  list-style: none; color: var(--text);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--hover); }
.menu[open] summary { background: var(--active); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 208px; padding: 0.35rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.menu-head {
  padding: 0.45rem 0.6rem 0.5rem; margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis;
}
.menu-pop a, .menu-pop button {
  padding: 0.5rem 0.6rem; border: 0; border-radius: 7px;
  background: none; font: inherit; text-align: left; cursor: pointer;
  color: var(--text); text-decoration: none; font-size: 0.9rem;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--hover); }

/* ---------------------------------------------------------------------------
   Notificacoes: sininho + badge no header, dropdown e itens (issue #60).
   Cores de severidade saem dos tokens do DESIGN.md (--primary/info,
   --warn/warning, --error/danger) — nada de hex improvisado aqui.
   --------------------------------------------------------------------------- */
.notif { margin-left: 0.35rem; }
.notif > summary { position: relative; padding: 0.4rem; }
.notif > summary svg { display: block; }

/* Badge de nao-lidas: cola no canto do sino sem empurrar o layout do header. */
.notif-badge {
  position: absolute; top: 0; right: 0;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 9px; border: 2px solid var(--surface);
  background: var(--error); color: #fff;
  font-size: 0.65rem; font-weight: 700; line-height: 1;
}

.notif-pop { width: min(360px, calc(100vw - 2rem)); padding: 0; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.6rem 0;
}
.notif-title { flex: 1; border-bottom: 0; margin: 0; padding: 0; font-weight: 700; color: var(--text); }
.notif-acao {
  border: 0; background: none; padding: 0.2rem 0.35rem; border-radius: 6px;
  font: inherit; font-size: 0.78rem; color: var(--primary); cursor: pointer;
}
.notif-acao:hover { background: var(--hover); }

.notif-lista {
  display: flex; flex-direction: column;
  max-height: 380px; overflow-y: auto;
  padding: 0.35rem; border-top: 1px solid var(--border); margin-top: 0.5rem;
}
.notif-vazio { padding: 1rem 0.6rem; margin: 0; color: var(--muted); font-size: 0.88rem; text-align: center; }

/* Item: bolinha de severidade + corpo em coluna. Nao lida fica com fundo
   sutil; lida perde o destaque mas continua legivel (contraste do --muted). */
.notif-item {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.55rem 0.6rem; border-radius: 8px;
  color: var(--text); text-decoration: none;
  background: var(--active); cursor: pointer;
}
.notif-item + .notif-item { margin-top: 0.2rem; }
.notif-item:hover { background: var(--hover); }
.notif-item.is-lida { background: none; }
.notif-item.is-lida .notif-item-titulo { font-weight: 500; color: var(--muted); }
.notif-item.is-lida .notif-dot { opacity: 0.35; }

.notif-dot {
  flex: none; width: 8px; height: 8px; margin-top: 6px;
  border-radius: 50%; background: var(--primary);
}
.notif-item.sev-warning .notif-dot { background: var(--warn); }
.notif-item.sev-danger .notif-dot { background: var(--error); }
/* Barra lateral reforca a severidade para quem nao distingue as cores. */
.notif-item.sev-warning { box-shadow: inset 3px 0 0 var(--warn); }
.notif-item.sev-danger { box-shadow: inset 3px 0 0 var(--error); }

.notif-corpo { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.notif-item-titulo { font-size: 0.9rem; font-weight: 650; line-height: 1.3; }
.notif-item-body { font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.notif-item-data { font-size: 0.75rem; color: var(--muted); }

.notif-verall {
  display: block; padding: 0.6rem; border-top: 1px solid var(--border);
  text-align: center; font-size: 0.85rem; text-decoration: none; color: var(--primary);
}
.notif-verall:hover { background: var(--hover); }

/* Pagina /notificacoes: mesma linguagem do dropdown, sem teto de altura.
   A barra NAO usa .row de proposito: o Bootstrap (carregado depois do
   main.css) tem seu proprio `.row > * { width: 100% }`, que empilhava cada
   controle numa linha inteira. Classe propria = imune a essa colisao. */
.notif-barra {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.notif-barra > * { flex: 0 0 auto; width: auto; }
.notif-filtro { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.notif-barra input[type='checkbox'] { flex: none; width: auto; margin: 0; }
.notif-barra #notif-resumo { flex: 1 1 auto; }
.notif-lista-pagina {
  max-height: none; border-top: 1px solid var(--border);
  margin-top: 0.75rem; padding: 0.5rem 0 0;
}
.notif-lista-pagina .notif-item { padding: 0.7rem 0.75rem; }

@media (max-width: 640px) {
  .notif { margin-left: 0; }
  .notif-pop { position: fixed; left: 1rem; right: 1rem; width: auto; }
}

.nav-toggle, .nav-burger { display: none; }

a { color: var(--primary); }

/* Layout se estende ate a largura da janela, com respiro nas laterais.
   O teto alto (1800px) evita linha de texto quilometrica em monitor ultrawide
   sem espremer o conteudo em telas comuns. */
.container {
  width: 100%; max-width: 1800px;
  margin: 1.75rem auto; padding: 0 var(--gutter);
  /* Cresce para empurrar o rodape ao fim da viewport (body em coluna). */
  flex: 1 0 auto;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
}
/* Cards que sao filhos diretos do .container (modulos do painel: Investimentos,
   Veiculos) precisam de espaco do bloco anterior, pois este e um <div class="grid-2">
   (e nao .card), entao o ".card + .card" global nao os alcança e eles colariam
   no topo do modulo anterior. */
.container > .card { margin-top: 1.5rem; }
.container > .card:first-child { margin-top: 0; }
.auth-card { max-width: 420px; margin: 3rem auto; }
.hero { text-align: center; padding: 3rem 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* Campos com altura unificada: input, select e textarea compartilham a
   mesma caixa (2.75rem) para alinhamento perfeito lado a lado. O select
   perde a seta nativa (appearance:none) e ganha uma seta SVG desenhada,
   evitando a diferenca de renderizacao entre navegadores. */
.field { display: block; margin-bottom: 1rem; }
.field span { display: block; font-size: 0.875rem; margin-bottom: 0.25rem; }

input, select, textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  /* Borda de campo usa --border-input (>=3:1, WCAG 1.4.11), nao a
     --border de divisoria (1.25:1) que sumia contra o fundo. */
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}
textarea { min-height: 5rem; resize: vertical; }

/* Seta unica para todos os selects, herda a cor do tema (currentColor). */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.25rem;
  /* Seta em cinza escuro para o tema claro. Custom property NAO resolve
     dentro de url(), entao o tema escuro sobrescreve a regra inteira
     logo abaixo em vez de trocar so a cor. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23565e6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 16px;
}
/* No escuro o #565e6b rendia 2.89:1 contra o campo — a seta sumia.
   #a8aeb4 sobe para 7.7:1 e acompanha o texto do tema. */
:root[data-theme='dark'] select,
:root[data-bs-theme='dark'] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8aeb4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8aeb4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }
}
input:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--primary); color: #fff; border: 0;
  padding: 0.6rem 1.1rem; border-radius: 8px; font: inherit; cursor: pointer;
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: 0; color: var(--primary);
  cursor: pointer; font: inherit; padding: 0 0.25rem;
}
/* Acoes em linha de tabela: botao de contorno discreto, com moldura e
   espacamento, em vez de texto azul solto. Fica alinhado e clicavel. */
.btn-acao {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 32px; padding: 0.25rem 0.7rem; margin: 0.1rem 0.2rem 0.1rem 0;
  font-size: 0.85rem; font-weight: 600; line-height: 1;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: 8px; cursor: pointer; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-acao:hover { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary-strong); }
.btn-acao.danger { color: var(--error); background: color-mix(in srgb, var(--error) 10%, transparent); border-color: color-mix(in srgb, var(--error) 34%, transparent); }
.btn-acao.danger:hover { background: color-mix(in srgb, var(--error) 20%, transparent); }
/* No tema escuro a cor de erro vira mais clara (--error ja ajustado) e a
   borda ganha mais contraste para o botao nao se perder na linha escura. */
:root[data-theme='dark'] .btn-acao.danger,
:root[data-bs-theme='dark'] .btn-acao.danger { color: #ff8a7a; border-color: color-mix(in srgb, var(--error) 55%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .btn-acao.danger { color: #ff8a7a; border-color: color-mix(in srgb, var(--error) 55%, transparent); }
}
.btn-acao:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Em telas de toque o alvo cresce para o minimo confortavel. */
@media (pointer: coarse) {
  .btn-acao { min-height: 40px; padding: 0.5rem 0.9rem; }
}
/* Em telas de toque o "Excluir" das tabelas era um alvo de ~19px de altura —
   metade do minimo confortavel. Cresce so no ponteiro grosseiro para nao
   inchar as linhas da tabela no desktop. */
@media (pointer: coarse) {
  .btn-link {
    min-height: 44px; min-width: 44px;
    padding: 0.5rem 0.6rem;
  }
}

.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: end; }
.row input, .row select { width: auto; flex: 1 1 160px; }
/* Formulario de acao no topo dos cards: respiro antes da lista. */
.card > .row { margin-bottom: 1.25rem; }
/* Filtros no topo das telas (Veiculos, Lancamentos): em telas largas ficam
   lado a lado, sem empilhar. align-items:center alinha os controles de
   alturas diferentes (input de data, select, botao). nowrap evita que o
   grupo quebre em linhas estreitas do card. */
.toolbar.row, .filtros.row {
  flex-wrap: wrap; align-items: center; gap: 0.6rem;
}
.toolbar.row > *, .filtros.row > * { flex: 0 1 auto; min-width: 0; }
/* Selects de filtro recebem largura confortavel e nao encolhem a ponto de
   cortar o texto. */
.toolbar select, .filtros select { flex: 1 1 170px; min-width: 150px; }
.filtros input[type='search'] { flex: 1 1 200px; min-width: 160px; }
/* Inputs de data do filtro precisam de largura minima senao o flex encolhe
   a zero e o campo some (bug de "filtros bugados"). */
.filtros input[type='date'] { flex: 1 1 150px; min-width: 145px; }
/* Filtro com rotulo visivel ("De"/"Ate"/"Buscar"): o <label class=field>
   envolve o input, entao o flex passa a valer para o label e o input dentro
   dele ocupa a largura toda. align-items:end mantem os controles alinhados
   pela base, com os rotulos acima. */
.filtros.row { align-items: end; }
.filtros .field-filtro { margin-bottom: 0; }
.filtros .field-filtro > span { white-space: nowrap; }
.filtros .field-filtro > input { width: 100%; }
.filtros label.field-filtro:has(input[type='date']) { flex: 1 1 150px; min-width: 145px; }
.filtros label.field-filtro:has(input[type='search']) { flex: 1 1 200px; min-width: 160px; }
/* Filtros avancados do extrato (issue #14): conta e multi-selecao de categoria. */
.filtros label.field-filtro:has(select[multiple]) { flex: 1 1 220px; min-width: 190px; }
.filtros select[multiple] { width: 100%; padding: 0.25rem; }
.filtros .field-filtro > small { font-size: 0.75rem; margin-top: 0.25rem; }

/* Rodape do extrato: contador + "Carregar mais" (issue #22). */
.extrato-rodape { justify-content: space-between; align-items: center; margin-top: 0.75rem; }
.extrato-rodape p { margin: 0; }

/* O botao Limpar/Acao fica colado ao grupo, sem ocupar a linha toda. */
.filtros .btn-outline, .toolbar .btn-outline { flex: 0 0 auto; }

/* Grupo de acoes (Imprimir, Exportar PDF/CSV, Verificar alertas) da toolbar:
   encostado a DIREITA, separado dos filtros, com o mesmo gap (0.6rem) usado
   pela propria .toolbar.row.
   A toolbar de Veiculos agrupa os filtros em .toolbar-filtros e as acoes em
   .toolbar-actions: sao DOIS blocos flex. Em desktop ficam na mesma linha
   (filtros a esquerda, acoes a direita); quando nao cabem, o wrap quebra o
   bloco INTEIRO de acoes para a linha de baixo, em vez de deixar um botao
   orfao no meio dos selects. */
.toolbar.row > .toolbar-filtros {
  display: flex;
  gap: 0.6rem;
  align-items: end;
  flex-wrap: wrap;
  flex: 1 1 320px;
  min-width: 0;
}
.toolbar-filtros .field-filtro { margin-bottom: 0; flex: 1 1 170px; min-width: 150px; }
.toolbar-filtros .field-filtro > span { white-space: nowrap; }
.toolbar-filtros select { width: 100%; }

.toolbar-actions {
  margin-left: auto;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
}

/* Faixa intermediaria (tablet / janela estreita no desktop): as acoes ainda
   nao cabem ao lado dos filtros, mas a tela e larga o bastante para os botoes
   dividirem uma linha propria em vez de virarem uma pilha vertical. */
@media (max-width: 1100px) {
  .toolbar.row > .toolbar-filtros { flex: 1 1 100%; }
  .toolbar-actions { flex: 1 1 100%; margin-left: 0; justify-content: flex-start; }
  /* Sem o teto de largura os dois selects esticavam para ~465px cada quando
     a linha de filtros passa a ocupar a largura toda — campo de filtro nao
     precisa (nem fica bem) com meio ecra de largura. */
  .toolbar-filtros .field-filtro { max-width: 320px; }
}

/* Em telas estreitas (celular) os filtros voltam a empilhar para caber. */
@media (max-width: 640px) {
  .toolbar.row, .filtros.row { flex-wrap: wrap; }
  .toolbar select, .filtros select, .filtros input[type='search'] { flex: 1 1 100%; }
  .filtros label.field-filtro { flex: 1 1 100%; }
  /* Os inputs de data e o botao tambem ocupam a linha inteira; com
     flex 1 1 150px dois deles cabiam lado a lado em 320px e o texto do
     datepicker era cortado. */
  .filtros input[type='date'],
  .filtros label.field-filtro:has(input[type='date']),
  .filtros label.field-filtro:has(select[multiple]) { flex: 1 1 100%; min-width: 0; }
  .filtros .btn-outline, .toolbar .btn-outline,
  .filtros .btn-primary, .toolbar .btn-primary { flex: 1 1 100%; }
  /* O grupo de acoes ocupa a linha inteira e distribui os botoes nela,
     em vez de ficar espremido a direita dos filtros empilhados. */
  .toolbar-actions { flex: 1 1 100%; margin-left: 0; }
  /* 4 botoes (Imprimir, PDF, CSV, Alertas) empilhados 1 por linha viravam
     uma coluna de 200px de altura. Grid 2x2: os botoes tem paddings
     diferentes (.btn-outline vs .btn-acao), entao com flex-wrap eles
     quebravam em larguras desiguais (167/167/343/340). O grid da colunas
     iguais e alinhamento previsivel. */
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
  .toolbar-actions > .btn-outline,
  .toolbar-actions > .btn-primary,
  .toolbar-actions > .btn-acao { width: 100%; margin: 0; }
  .toolbar-filtros .field-filtro { flex: 1 1 100%; min-width: 0; max-width: none; }
  /* Alvo de toque de 44px (WCAG 2.5.8) nos controles das telas
     estreitas — o @media (pointer: coarse) nao alcanca o desktop
     redimensionado nem tablets com mouse. */
  .btn-primary, .btn-outline, .btn-acao { min-height: 44px; }
  input, select, textarea { min-height: 44px; }
  .filtros select[multiple] { min-height: 88px; }
}

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; word-break: break-word; }
.alert-error { background: var(--alert-error-bg); color: var(--error); }
.alert-ok { background: var(--alert-ok-bg); color: var(--ok); }

/* ===== Toast/alerta com auto-hide (issue #31) =================
   O feedback fica ~6s visivel e sai com fade suave. Pausa no hover/foco fica
   a cargo do JS (toast.js), que so remove a classe de saida. */
.alert { opacity: 1; transition: opacity var(--toast-fade) ease, transform var(--toast-fade) ease; }
.alert.alert-saindo { opacity: 0; transform: translateY(-4px); }
/* Quem tem auto-hide ganha o cursor de "leia com calma": passar o mouse pausa. */
.alert[data-auto-hide] { cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .alert { transition: none; }
}

.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); }

.footer { text-align: center; padding: 2rem 1rem; color: var(--muted); }
/* ===== Landing page (padrao empresarial) =====================
   Portado de sistema-academico e generalizado. Paleta propria da
   landing (azul institucional), separada do app autenticado. */
body.lp-page { background: #f6f8fb; color: #0f172a; }
body.lp-light { --lp-accent: #2563eb; --lp-accent-2: #0b5f9e; }

/* Escopado em .lp-page para vencer a .btn-primary generica por
   especificidade — a landing tem identidade visual propria. */
.lp-page .btn-primary { display: inline-block; background: var(--lp-accent); color: #fff; border: none; padding: 0.6rem 1.6rem; border-radius: 10px; cursor: pointer; font-size: 0.95rem; font-weight: 600; text-decoration: none; transition: background 0.15s ease, transform 0.1s ease; }
.lp-page .btn-primary:hover { background: #1d4ed8; }
.btn-outline { display: inline-block; background: #fff; color: #0f172a; border: 1px solid #d7dee8; padding: 0.6rem 1.6rem; border-radius: 10px; cursor: pointer; font-size: 0.95rem; font-weight: 600; text-decoration: none; transition: border-color 0.15s ease; }
.btn-outline:hover { border-color: var(--lp-accent); color: var(--lp-accent); }
.btn-lg { padding: 0.8rem 2rem; font-size: 1.02rem; }
.lp-brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--lp-accent); color: #fff; font-size: 0.82rem; font-weight: 800; }

.lp-hero { max-width: 1160px; margin: 0 auto; padding: 4.5rem 1.5rem 3.5rem; }
.lp-hero-inner { display: grid; grid-template-columns: 1.12fr 0.88fr; gap: 3.5rem; align-items: center; }
.lp-brand-row { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.lp-brand-name { font-weight: 800; font-size: 1.1rem; color: #0f172a; }
.lp-badge { display: inline-block; background: #eaf1fe; color: var(--lp-accent); border: 1px solid #c7dafc; padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.lp-hero h1 { font-size: 3.1rem; line-height: 1.06; letter-spacing: -0.03em; margin: 0 0 1.1rem; font-weight: 800; color: #0f172a; }
.lp-hero h1 strong { color: var(--lp-accent); }
.lp-lead { font-size: 1.15rem; color: #475569; line-height: 1.6; max-width: 540px; margin: 0 0 1.8rem; }
.lp-hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }
/* #64748b sobre o #f6f8fb da landing da 4.47:1 (reprova por pouco). */
.lp-hero-note { margin-top: 1.2rem; font-size: 0.85rem; color: #5b6675; }

.lp-hero-visual { perspective: 1200px; }
.lp-mock {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 18px;
  padding: 1.5rem; box-shadow: 0 24px 60px rgba(15,23,42,0.12);
  transform: rotateY(-6deg) rotateX(2deg); transform-origin: center right;
  transition: transform .5s ease;
}
.lp-mock:hover { transform: rotateY(0) rotateX(0); }
.lp-mock-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.1rem; }
.lp-mock-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.lp-mock-title { font-size: 0.85rem; color: #64748b; font-weight: 700; }
.lp-mock-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 1.1rem; }
.lp-mock-card {
  background: #f8fafc; border: 1px solid #eef2f7; border-radius: 12px;
  padding: 0.7rem 0.6rem; text-align: left;
}
/* #94a3b8 sobre fundo claro rende 2.45:1 — o DESIGN.md proibe. */
.lp-mock-card span { display: block; font-size: 0.68rem; color: #5b6673; margin-bottom: 0.25rem; }
.lp-mock-card strong { font-size: 1.05rem; color: #0f172a; }
.lp-mock-chart { width: 100%; height: 110px; display: block; margin-bottom: 0.9rem; }
.lp-mock-foot { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.lp-mock-pill {
  font-size: 0.72rem; color: var(--lp-accent); background: #eaf1fe;
  border: 1px solid #c7dafc; padding: 0.25rem 0.7rem; border-radius: 999px; font-weight: 600;
}

.lp-stats { border-top: 1px solid #e6ebf2; border-bottom: 1px solid #e6ebf2; background: #fff; }
.lp-stats-inner { max-width: 1160px; margin: 0 auto; padding: 2.2rem 1.5rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; text-align: center; }
.lp-stat strong { display: block; font-size: 2.3rem; font-weight: 800; color: var(--lp-accent); }
.lp-stat span { color: #64748b; font-size: 0.92rem; }

.lp-section { max-width: 1160px; margin: 0 auto; padding: 4.5rem 1.5rem; }
.lp-alt { background: #eef3f9; border-radius: 26px; margin: 2rem auto; max-width: 1200px; }
.lp-section-head { text-align: center; max-width: 640px; margin: 0 auto 2.8rem; }
.lp-eyebrow { display: inline-block; color: var(--lp-accent); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.6rem; }
.lp-section-head h2 { font-size: 2.1rem; letter-spacing: -0.02em; margin: 0 0 0.8rem; font-weight: 800; color: #0f172a; }
.lp-section-head p { color: #475569; font-size: 1.05rem; line-height: 1.5; margin: 0; }
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.lp-feature { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 1.7rem; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.lp-feature:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(15,23,42,0.1); }
.lp-feature-ic { width: 38px; height: 38px; margin-bottom: 0.9rem; color: var(--lp-accent); }
.lp-feature-ic svg { width: 100%; height: 100%; }
.lp-feature h3 { margin: 0 0 0.5rem; font-size: 1.15rem; color: #0f172a; }
.lp-feature p { color: #475569; font-size: 0.95rem; line-height: 1.5; margin: 0; }

.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.lp-step { text-align: center; padding: 1.5rem; }
.lp-step-n { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 1rem; border-radius: 50%; background: var(--lp-accent); color: #fff; font-weight: 800; font-size: 1.1rem; }
.lp-step h3 { margin: 0 0 0.5rem; font-size: 1.2rem; color: #0f172a; }
.lp-step p { color: #475569; font-size: 0.95rem; line-height: 1.5; margin: 0; }

.lp-curso { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 3rem; align-items: center; }
.lp-curso-copy h2 { font-size: 2rem; letter-spacing: -0.02em; margin: 0 0 1rem; font-weight: 800; color: #0f172a; }
.lp-curso-copy p { color: #475569; line-height: 1.6; font-size: 1.05rem; }
.lp-list { list-style: none; padding: 0; margin: 1.2rem 0 0; }
.lp-list li { padding: 0.45rem 0 0.45rem 1.6rem; position: relative; color: #0f172a; }
.lp-list li::before { content: "✓"; position: absolute; left: 0; color: var(--lp-accent); font-weight: 800; }
.lp-curso-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 1.7rem; box-shadow: 0 18px 45px rgba(15,23,42,0.08); }
.lp-curso-row { display: flex; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid #eef2f7; font-size: 0.95rem; }
.lp-curso-row:last-child { border-bottom: none; }
.lp-curso-row span { color: #64748b; }
.lp-curso-row strong { font-weight: 600; color: #0f172a; }

.lp-cta { max-width: 1160px; margin: 2rem auto; padding: 3.8rem 1.5rem; text-align: center; background: linear-gradient(135deg, #2563eb, #0b5f9e); border-radius: 26px; }
.lp-cta h2 { font-size: 2.1rem; margin: 0 0 0.8rem; font-weight: 800; color: #fff; }
/* Sobre o inicio do gradiente (#2563eb) o #d7ecff dava 4.27:1. */
.lp-cta p { color: #edf4ff; font-size: 1.05rem; margin: 0 0 1.8rem; }
.lp-cta .btn-primary { background: #fff; color: var(--lp-accent); }
.lp-cta .btn-primary:hover { background: #eaf1fe; }

/* Rodape profissional (estilo empresa) */
.lp-footer { background: #0f172a; color: #cbd5e1; margin-top: 2rem; }
.lp-footer-inner { max-width: 1160px; margin: 0 auto; padding: 3rem 1.5rem 2rem; }
.lp-footer-top { display: grid; grid-template-columns: 1.2fr 2fr; gap: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid #1e293b; }
.lp-footer-brand { display: flex; gap: 0.7rem; align-items: flex-start; }
.lp-footer-brand .lp-brand-mark { background: var(--lp-accent); }
.lp-footer-brand strong { color: #fff; font-size: 1.1rem; display: block; }
.lp-footer-tag { font-size: 0.88rem; color: #94a3b8; margin: 0.25rem 0 0; }
.lp-footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.lp-footer-col h4 { color: #fff; font-size: 0.92rem; margin: 0 0 0.9rem; letter-spacing: 0.02em; }
.lp-footer-col a { display: block; color: #94a3b8; text-decoration: none; font-size: 0.9rem; padding: 0.28rem 0; transition: color 0.15s ease; }
.lp-footer-col a:hover { color: #fff; }
.lp-footer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 1.5rem; flex-wrap: wrap; gap: 0.5rem; }
.lp-footer-bottom p { margin: 0; font-size: 0.85rem; color: #94a3b8; }
.lp-footer-bottom a { color: #cbd5e1; text-decoration: none; font-weight: 600; }
.lp-footer-bottom a:hover { color: #fff; text-decoration: underline; }
/* Ancora "voltar ao topo": navegacao interna, sem JS (CSP-safe). */
.lp-top-link { color: #94a3b8; font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
.lp-top-link:hover { color: #fff; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

@media (max-width: 860px) {
  .lp-hero-inner, .lp-curso { grid-template-columns: 1fr; gap: 2rem; }
  .lp-stats-inner { grid-template-columns: repeat(2, 1fr); }
  .lp-grid, .lp-steps { grid-template-columns: 1fr; }
  .lp-hero h1 { font-size: 2.3rem; }
  .lp-footer-top { grid-template-columns: 1fr; }
  .lp-footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* Rodape interno (area logada) — mesmo padrao da landing */
.app-footer {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.75rem;
  max-width: 1160px; margin: 3rem auto 0;
  padding: 1.5rem; border-top: 1px solid var(--border);
  font-size: 0.88rem; color: var(--muted);
}
.app-footer a { color: var(--text); text-decoration: none; font-weight: 600; }
.app-footer a:hover { text-decoration: underline; }
/* .app-top-link precisa de especificidade maior que .app-footer a para
   manter o cinza — por isso o seletor composto em vez de !important. */
.app-footer .app-top-link { color: var(--muted); font-weight: 500; white-space: nowrap; }
@media (max-width: 640px) { .app-footer { flex-direction: column; align-items: flex-start; } }

/* --- Refinos apos revisao visual ------------------------------------
   1. Elevacao padronizada: os cards usavam 3 sombras diferentes, o que
      quebrava a sensacao de sistema coeso.
   2. Contraste: #94a3b8 sobre branco reprova em WCAG AA para texto
      pequeno; #64748b passa.
   3. Rodape legivel: 0.85rem era pequeno demais para o copyright. */
.lp-feature,
.lp-curso-card { box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07); }
.lp-feature:hover { box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12); }

.lp-footer-bottom p { font-size: 0.9rem; color: #b6c2d1; }
.lp-top-link { font-size: 0.9rem; }

/* Aproxima o numero do texto no passo a passo (bloco parecia esparso). */
.lp-step { padding: 1rem 1.25rem; }
.lp-step-n { margin-bottom: 0.75rem; }

/* Botao secundario estava se perdendo no fundo claro. */
.btn-outline { border-color: #c3ccd9; }

/* ===== App financeiro ==========================================
   Estilos das telas de dominio. Uma unica elevacao de card (herdada
   de .card) e paleta ligada aos tokens do DESIGN.md. */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.page-head h1 { margin: 0 0 0.15rem; font-size: 1.6rem; letter-spacing: -0.02em; }
.page-head p { margin: 0; }
.input-month, .input-color { width: auto; }

/* Painel de selecao de periodo no cabecalho das telas (dashboard, orcamentos). */
.periodo {
  display: inline-flex; flex-direction: row; align-items: center; gap: 0.6rem;
  flex-wrap: nowrap;
}
.periodo-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.select-mes { width: auto; min-width: 180px; font-weight: 600; }

.kpi-grid {
  display: grid; gap: 1rem; margin-bottom: 1.5rem;
  /* auto-fit: aproveita a largura da tela em vez de travar em 4 colunas. */
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.kpi-grid-4 { margin-bottom: 1rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.kpi-plain { background: transparent; }
.kpi-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi strong { font-size: 1.4rem; letter-spacing: -0.02em; }
.kpi-sub { font-size: 0.78rem; }

/* Em 2 colunas os cards ficam ALINHADOS PELO TOPO (bordas na mesma linha),
   como pede a revisao visual — nao esticados. Cada card tem sua altura
   natural; o espaco que sobra fica abaixo do menor. O margin-top:0 no
   primeiro h2 evita que a margem do titulo "vaze" acima do card e desloque
   o conteudo da coluna direita em relacao a esquerda.
   IMPORTANTE: o seletor global ".card + .card" (espacamento vertical entre
   cards empilhados) nao pode aplicar margin-top aqui, senao o segundo card
   da dupla desce e as duas colunas param de iniciar na mesma altura. */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: stretch; }
.grid-2 > .card { margin-bottom: 0; display: flex; flex-direction: column; }
.grid-2 > .card + .card { margin-top: 0; }
.grid-2 > .card > h2:first-child { margin-top: 0; }
.grid-2 + .grid-2 { margin-top: 1.5rem; }
/* Card ANINHADO (ex.: "Custo mensal" dentro do card Veículos do painel) não é
   irmão de outro .card no mesmo parent, entao o ".card + .card" global nao o
   alcanca — sem isto ele cola no irmao anterior. Da margem vertical. */
.card > .card { margin-top: 1.25rem; }
/* Quando o grid-2 empilha (1 coluna), os cards viram irmãos verticais e
   precisam do espacamento de volta. */
@media (max-width: 820px) {
  .grid-2 > .card + .card { margin-top: 1.25rem; }
  .split > .card + .card { margin-top: 1.25rem; }
}

.card h2 { font-size: 1.05rem; margin: 0 0 0.9rem; }
.card h3 { font-size: 0.9rem; margin: 0 0 0.5rem; color: var(--muted); }

.pos { color: var(--ok); }
.neg { color: var(--error); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.chart { min-height: 180px; max-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.chart svg { width: 100%; max-width: 100%; height: auto; max-height: 240px; }
/* Sensacao de interatividade: o grafico reage ao hover (tooltip nativo do
   <title> + realce de opacidade), mesmo sem JS de tooltip. */
.chart svg [data-slice], .chart svg [data-bar] { transition: opacity 0.15s ease; cursor: pointer; }
.chart svg:hover [data-slice], .chart svg:hover [data-bar] { opacity: 0.82; }
.chart-sm { min-height: 160px; justify-content: flex-start; }
.chart-svg { width: 100%; max-width: 100%; height: auto; }
.chart-donut { max-width: 190px; }
.chart-axis { font-size: 9px; fill: var(--muted); }
.chart-center { font-size: 13px; font-weight: 700; fill: var(--text); }
.chart-baseline { stroke: var(--border); stroke-width: 1; }

.legend { list-style: none; padding: 0; margin: 0.75rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.82rem; }
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
/* Cores fixas da legenda de receitas x despesas. Ficam no CSS (e nao em style
   inline no JS) porque a CSP nao permite 'unsafe-inline' em style-src. */
.legend i.legend-receitas { background: #22c55e; }
.legend i.legend-despesas { background: #ef4444; }

.stat-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.stat-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.stat-list li:last-child { border-bottom: 0; }

.progress-item { margin-bottom: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.progress-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.progress-head { display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; align-items: baseline; }
.bar {
  /* O trilho fica CLARO de proposito: o contraste que importa aqui e o do
     preenchimento contra o trilho (4.0-5.2:1 com --border). Escurecer o
     trilho para --border-input derrubaria esse par para ~1.3:1 — a barra
     ficaria uniforme e o percentual, ilegivel. */
  height: 10px; background: var(--border); border-radius: 999px; overflow: hidden;
}
/* A largura vem de --pct, definido pela classe .bar-pNN aplicada no JS.
   Nada de style="width:..%": a CSP nao permite estilo inline. */
.bar i {
  display: block; height: 100%; border-radius: 999px;
  width: var(--pct, 0%);
  transition: width 0.35s ease;
}
/* Preenchimento vs trilho (--border): ok 4.55:1, warn 4.01:1, danger
   5.25:1 — todos acima do minimo de 3:1 da WCAG 1.4.11. */
.bar-ok { background: var(--ok); }
.bar-warn { background: var(--warn); }
.bar-danger { background: var(--error); }
.progress-pct { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }

/* Larguras da barra em passos de 1% (issue #16). */
.bar-p0 { --pct: 0%; }
.bar-p1 { --pct: 1%; }
.bar-p2 { --pct: 2%; }
.bar-p3 { --pct: 3%; }
.bar-p4 { --pct: 4%; }
.bar-p5 { --pct: 5%; }
.bar-p6 { --pct: 6%; }
.bar-p7 { --pct: 7%; }
.bar-p8 { --pct: 8%; }
.bar-p9 { --pct: 9%; }
.bar-p10 { --pct: 10%; }
.bar-p11 { --pct: 11%; }
.bar-p12 { --pct: 12%; }
.bar-p13 { --pct: 13%; }
.bar-p14 { --pct: 14%; }
.bar-p15 { --pct: 15%; }
.bar-p16 { --pct: 16%; }
.bar-p17 { --pct: 17%; }
.bar-p18 { --pct: 18%; }
.bar-p19 { --pct: 19%; }
.bar-p20 { --pct: 20%; }
.bar-p21 { --pct: 21%; }
.bar-p22 { --pct: 22%; }
.bar-p23 { --pct: 23%; }
.bar-p24 { --pct: 24%; }
.bar-p25 { --pct: 25%; }
.bar-p26 { --pct: 26%; }
.bar-p27 { --pct: 27%; }
.bar-p28 { --pct: 28%; }
.bar-p29 { --pct: 29%; }
.bar-p30 { --pct: 30%; }
.bar-p31 { --pct: 31%; }
.bar-p32 { --pct: 32%; }
.bar-p33 { --pct: 33%; }
.bar-p34 { --pct: 34%; }
.bar-p35 { --pct: 35%; }
.bar-p36 { --pct: 36%; }
.bar-p37 { --pct: 37%; }
.bar-p38 { --pct: 38%; }
.bar-p39 { --pct: 39%; }
.bar-p40 { --pct: 40%; }
.bar-p41 { --pct: 41%; }
.bar-p42 { --pct: 42%; }
.bar-p43 { --pct: 43%; }
.bar-p44 { --pct: 44%; }
.bar-p45 { --pct: 45%; }
.bar-p46 { --pct: 46%; }
.bar-p47 { --pct: 47%; }
.bar-p48 { --pct: 48%; }
.bar-p49 { --pct: 49%; }
.bar-p50 { --pct: 50%; }
.bar-p51 { --pct: 51%; }
.bar-p52 { --pct: 52%; }
.bar-p53 { --pct: 53%; }
.bar-p54 { --pct: 54%; }
.bar-p55 { --pct: 55%; }
.bar-p56 { --pct: 56%; }
.bar-p57 { --pct: 57%; }
.bar-p58 { --pct: 58%; }
.bar-p59 { --pct: 59%; }
.bar-p60 { --pct: 60%; }
.bar-p61 { --pct: 61%; }
.bar-p62 { --pct: 62%; }
.bar-p63 { --pct: 63%; }
.bar-p64 { --pct: 64%; }
.bar-p65 { --pct: 65%; }
.bar-p66 { --pct: 66%; }
.bar-p67 { --pct: 67%; }
.bar-p68 { --pct: 68%; }
.bar-p69 { --pct: 69%; }
.bar-p70 { --pct: 70%; }
.bar-p71 { --pct: 71%; }
.bar-p72 { --pct: 72%; }
.bar-p73 { --pct: 73%; }
.bar-p74 { --pct: 74%; }
.bar-p75 { --pct: 75%; }
.bar-p76 { --pct: 76%; }
.bar-p77 { --pct: 77%; }
.bar-p78 { --pct: 78%; }
.bar-p79 { --pct: 79%; }
.bar-p80 { --pct: 80%; }
.bar-p81 { --pct: 81%; }
.bar-p82 { --pct: 82%; }
.bar-p83 { --pct: 83%; }
.bar-p84 { --pct: 84%; }
.bar-p85 { --pct: 85%; }
.bar-p86 { --pct: 86%; }
.bar-p87 { --pct: 87%; }
.bar-p88 { --pct: 88%; }
.bar-p89 { --pct: 89%; }
.bar-p90 { --pct: 90%; }
.bar-p91 { --pct: 91%; }
.bar-p92 { --pct: 92%; }
.bar-p93 { --pct: 93%; }
.bar-p94 { --pct: 94%; }
.bar-p95 { --pct: 95%; }
.bar-p96 { --pct: 96%; }
.bar-p97 { --pct: 97%; }
.bar-p98 { --pct: 98%; }
.bar-p99 { --pct: 99%; }
.bar-p100 { --pct: 100%; }

/* Espacamento entre secoes de card que se seguem (ex.: Nova operacao / Historico). */
.card h2 + .form-grid, .card h2 + .table, .card h2 + .row { margin-top: 0.25rem; }
.card > h2 + h2 { margin-top: 1.75rem; }

.form-grid {
  display: grid; gap: 0.75rem 1rem; align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.form-grid .field { margin-bottom: 0; }
.form-grid .field-actions { display: flex; align-items: flex-end; }
.filtros { margin-bottom: 0.5rem; }
.row-tight { margin-top: 0.75rem; gap: 0.6rem; align-items: end; flex-wrap: wrap; }
.row-tight input { flex: 1 1 130px; min-width: 120px; }
.row-tight .btn-acao { flex: 0 1 auto; }

.tag { display: inline-block; font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--border); color: var(--muted); vertical-align: middle; }
.tag-warn { background: var(--tag-warn-bg); color: var(--tag-warn-text); }
.tag-ok { background: var(--tag-ok-bg); color: var(--tag-ok-text); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 0.4rem; }

@media (max-width: 900px) {
  .kpi-grid, .form-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid, .form-grid { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
  /* Uma coluna de verdade: .split e .grid-2 ja colapsam em 820px, mas
     o .row de acoes ainda punha dois botoes por linha em 360px. */
  .row > .btn-primary, .row > .btn-outline { flex: 1 1 100%; }
  .card { padding: 1.1rem; }
  .page-head { align-items: flex-start; }
  .periodo { flex-wrap: wrap; }
  .select-mes { min-width: 0; width: 100%; }
}
/* Nenhuma tela pode rolar na horizontal: o estouro vem sempre de um
   filho (tabela, grafico), que ja tem seu proprio scroll. */
@media (max-width: 640px) {
  body { overflow-x: hidden; }
  .container { max-width: 100%; }
  .modal-card { max-width: 100%; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions > * { flex: 1 1 auto; min-height: 44px; }
}

/* .field/.card usam display:block, o que VENCE o atributo hidden (que so
   aplica display:none via UA stylesheet). Sem isto, campos escondidos por
   JS continuam visiveis. */
[hidden] { display: none !important; }

/* ===== Navbar no celular ========================================
   Abaixo de 900px a nav vira uma gaveta controlada pelo checkbox
   #nav-toggle. Sem JS: o menu funciona mesmo se o script falhar. */
@media (max-width: 900px) {
  .nav-burger {
    display: grid; place-items: center;
    width: 40px; height: 40px; margin-left: auto;
    border-radius: 8px; cursor: pointer; color: var(--text);
  }
  .nav-burger:hover { background: var(--hover); }

  .nav-main {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0.15rem;
    padding: 0.5rem var(--gutter) 0.75rem;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav-toggle:checked ~ .nav-main { display: flex; }
  .nav-main a { padding: 0.7rem 0.75rem; font-size: 1rem; }

  /* Com o burger no fluxo, o menu da conta perde o margin-left:auto. */
  .nav-user { margin-left: 0; }
  .nav-user-name { display: none; }
}

/* ===== Cabecalho de pagina ===================================== */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.page-head h1 {
  margin: 0 0 0.15rem; font-size: 1.6rem;
  letter-spacing: -0.02em; line-height: 1.2;
}
.page-head p { margin: 0; color: var(--muted); font-size: 0.925rem; }

/* ===== Tutorial =================================================
   Layout estilo Quartz: barra lateral fixa (indice) + corpo em
   coluna propria, aproveitando a largura disponivel em vez da
   coluna centralizada de 78ch que havia antes. */
.tut-layout {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  gap: var(--gutter);
  align-items: start;
}
.tut-side {
  position: sticky;
  top: calc(56px + 1.5rem);
  align-self: start;
  padding-right: 1.25rem;
  border-right: 1px solid var(--border);
}
.tut-side-title {
  margin: 0 0 0.25rem; font-size: 1.05rem; font-weight: 650;
  letter-spacing: -0.01em;
}
.tut-side-sub { margin: 0 0 1.25rem; font-size: 0.85rem; line-height: 1.45; }

/* Indice vertical: ancora pura em lista, sem JS (CSP-safe). */
.tut-toc { display: flex; flex-direction: column; gap: 0.1rem; }
.tut-toc a {
  padding: 0.4rem 0.65rem; border-radius: 7px;
  font-size: 0.88rem; text-decoration: none; white-space: nowrap;
  color: var(--muted); border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tut-toc a:hover { color: var(--text); background: var(--hover); }
/* is-active e o gancho para scroll-spy em JS (common.js); a secao aberta
   tambem destaca via .tut:target, entao a navegacao funciona sem JS. */
.tut-toc a.is-active {
  color: var(--primary); background: var(--active);
  font-weight: 600; border-left-color: var(--primary);
}

.tut-content { min-width: 0; }

.tut {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.25rem;
  /* scroll-margin: sem isto o cabecalho fixo cobre o titulo ao pular pela ancora. */
  scroll-margin-top: 90px;
}
.tut h2 {
  margin: 0 0 1rem; font-size: 1.25rem; letter-spacing: -0.01em;
  padding-bottom: 0.6rem; border-bottom: 1px solid var(--border);
}
.tut h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.tut p { margin: 0 0 0.85rem; }
.tut > p:last-child { margin-bottom: 0; }

.tut-steps { margin: 0; padding-left: 1.25rem; display: grid; gap: 1rem; }
.tut-steps li::marker { color: var(--primary); font-weight: 700; }
.tut-steps p { margin: 0.25rem 0 0; color: var(--muted); }

.tut-grid {
  display: grid; gap: 0.75rem; margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.tut-card {
  padding: 0.9rem 1rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg);
}
.tut-card p { margin: 0; font-size: 0.875rem; color: var(--muted); }

/* Barra lateral colorida: destaca a dica sem precisar de emoji. */
.tut-tip {
  padding: 0.85rem 1rem; border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0; background: var(--active);
  font-size: 0.9rem;
}
.tut-dl { margin: 0; display: grid; gap: 0.85rem; }
.tut-dl dt { font-weight: 650; }
.tut-dl dd { margin: 0.2rem 0 0; color: var(--muted); }

.tut-end { font-size: 0.9rem; font-style: italic; }

@media (max-width: 820px) {
  .tut-layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .tut-side {
    position: static; border-right: 0; padding-right: 0;
    border-bottom: 1px solid var(--border); padding-bottom: 1rem;
  }
  .tut-toc { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
  .tut-toc a {
    white-space: normal; border-left: 0;
    /* recupera o formato de pill no celular */
    background: var(--hover); border-radius: 999px; padding: 0.35rem 0.7rem;
  }
  .tut-toc a.is-active { border-left: 0; }
  .tut { padding: 1.25rem; }
}
/* ===== Utilitarios de tela ======================================= */
.card-title {
  margin: 0 0 1.1rem; font-size: 1.05rem; letter-spacing: -0.01em;
  padding-bottom: 0.7rem; border-bottom: 1px solid var(--border);
}

/* Cards de formulario + lista lado a lado (sempre 2 blocos nesta tela).
   1fr 1fr fixo evita o auto-fit criar 3 colunas vazias; stretch + height:100%
   fazem os dois cards ficarem com EXATA mesma altura, sem "card flutuante". */
.split {
  display: grid; gap: 1.5rem; margin-bottom: 1.5rem;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}
.split > .card {
  margin-bottom: 0;
  height: 100%;
  display: flex; flex-direction: column;
}
.split > .card > h2:first-child { margin-top: 0; }
/* Igual ao .grid-2: anula o margin-top do seletor global ".card + .card"
   para as duas colunas iniciarem na MESMA altura. */
.split > .card + .card { margin-top: 0; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

/* Tabela larga rola sozinha em vez de estourar o card no celular (issue #21).
   O wrapper nunca passa da largura do card (max-width/min-width:0 impedem o
   grid/flex pai de esticar junto com a tabela). */
.table-wrap, .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
}
.table-wrap { margin: 0 -0.25rem; padding: 0 0.25rem; }
/* Descendente, nao filho direto: o DataTables injeta .dt-container entre o
   wrapper e a <table>, entao `>` nunca casaria na tela de lancamentos. */
@media (max-width: 640px) {
  /* No celular a rolagem e a unica saida: sem isso a tabela se espreme em
     colunas de uma letra por linha em vez de rolar. */
  .table-responsive .table { min-width: max-content; }
  .table-responsive .table th, .table-responsive .table td { white-space: nowrap; }
  /* O DataTables poe width:100% na tabela; no celular quem manda e o conteudo. */
  .table-responsive .table.dataTable { width: auto !important; }
}
/* DataTables pede largura 100% na tabela; via classe, nunca style inline. */
.table-w100 { width: 100%; }
.table th {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 600;
}
.table tbody tr:hover { background: var(--hover); }
/* Numero alinhado a direita com digito de largura fixa: as casas decimais
   ficam em coluna, entao da para comparar valores batendo o olho. */
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Tabela de alertas de manutencao: zebrada, com hover e badge de status.
   Usa tokens do DESIGN.md (alert-error-bg + error) — sem cor nova sem
   contraste. Reaproveita .table-wrap para rolar na horizontal no celular. */
#tabela-alertas tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
#tabela-alertas tbody tr:hover { background: var(--hover); }
#tabela-alertas .alerta-urgente { background: var(--alert-error-bg); color: var(--error); }
tr.alerta-urgente > td:first-child { box-shadow: inset 3px 0 0 var(--error); }
@media (max-width: 640px) {
  .table-wrap #tabela-alertas { min-width: max-content; }
  .table-wrap #tabela-alertas th, .table-wrap #tabela-alertas td { white-space: nowrap; }
}

/* DataTables 2.x (renderer Bootstrap 5): integra wrapper e paginacao ao tema.
   O 2.x renomeou as classes do 1.x -- .dataTables_wrapper virou .dt-container,
   .dataTables_paginate virou .dt-paging e .paginate_button virou
   .dt-paging-button. Com o renderer bootstrap5 a paginacao sai como
   .pagination > .page-item > .page-link. Casamos os tres nomes para nao
   depender de qual renderer esta ativo. */
.dt-container, .dataTables_wrapper { margin-top: 1rem; font-size: 0.92rem; }
/* O DataTables monta seu layout em .row/.col do Bootstrap; nosso .row global
   e' flex e quebraria esse grid. Restauramos o flex do wrapper para alinhar
   length (esquerda) e busca (direita) sem estragar as colunas internas. */
.dt-container .row, .dataTables_wrapper .row {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 0.5rem; margin: 0;
}
.dt-container .col-sm-12, .dataTables_wrapper .col-sm-12 { flex: 1 1 100%; padding: 0; }
.dt-container .col-md-6, .dataTables_wrapper .col-md-6 { flex: 1 1 auto; }
table.dataTable { border-collapse: separate; border-spacing: 0; }
table.dataTable thead th { border-bottom: 2px solid var(--border); }
table.dataTable tbody td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); }
table.dataTable tbody tr:hover { background: var(--hover); }
/* Tema escuro: a borda padrao (#343a42) ja e visivel, mas as linhas da
   tabela pedem um realce extra para nao sumirem no fundo #181b20. */
:root[data-theme='dark'] table.dataTable tbody tr,
:root[data-bs-theme='dark'] table.dataTable tbody tr { background: color-mix(in srgb, var(--surface) 100%, transparent); }
:root[data-theme='dark'] .table-striped tbody tr:nth-child(even),
:root[data-bs-theme='dark'] .table-striped tbody tr:nth-child(even) { background: color-mix(in srgb, var(--text) 4%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) table.dataTable tbody tr { background: color-mix(in srgb, var(--surface) 100%, transparent); }
  :root:not([data-theme='light']) .table-striped tbody tr:nth-child(even) { background: color-mix(in srgb, var(--text) 4%, transparent); }
}
.dt-search input, .dt-length select,
.dataTables_filter input, .dataTables_length select {
  padding: 0.35rem 0.55rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
}
.dt-search input:focus, .dt-length select:focus,
.dataTables_filter input:focus, .dataTables_length select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
/* Paginacao: cobre o DOM do renderer bootstrap5 (.page-link) e o nativo do
   2.x (.dt-paging-button), que e' um <button> e por isso precisa de reset. */
.dt-paging, .dataTables_paginate {
  margin-top: 1rem; display: flex; flex-wrap: wrap; justify-content: flex-end;
  align-items: center; gap: 0.25rem;
}
.dt-paging nav, .dt-paging .pagination {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem;
  margin: 0; padding: 0; list-style: none;
}
.dt-paging .page-item { display: inline-flex; }
.dt-paging .page-link,
.dt-paging .dt-paging-button,
.dataTables_paginate .paginate_button {
  appearance: none; -webkit-appearance: none;
  min-width: 2.1rem; padding: 0.4rem 0.65rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--primary);
  font: inherit; line-height: 1.25; text-align: center; cursor: pointer;
  text-decoration: none; box-shadow: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.dt-paging .page-link:hover,
.dt-paging .dt-paging-button:hover:not(.current):not(.disabled),
.dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
  background: var(--hover); border-color: var(--border); color: var(--primary);
}
.dt-paging .page-link:focus-visible,
.dt-paging .dt-paging-button:focus-visible {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.dt-paging .page-item.active .page-link,
.dt-paging .dt-paging-button.current,
.dataTables_paginate .paginate_button.current {
  background: var(--primary); color: #fff; border-color: var(--primary);
  font-weight: 600; z-index: 1;
}
.dt-paging .page-item.disabled .page-link,
.dt-paging .dt-paging-button.disabled,
.dataTables_paginate .paginate_button.disabled {
  color: var(--muted); opacity: 0.5; cursor: not-allowed; border-color: var(--border);
  background: var(--surface);
}
.dt-info, .dt-length, .dt-search,
.dataTables_info, .dataTables_length, .dataTables_filter { color: var(--muted); padding: 0.4rem 0; }
.nowrap { white-space: nowrap; }

/* Modal generico de edicao (public/js/modal.js): overlay + cartao central. */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(8, 10, 14, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; width: 100%; max-width: 460px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}
.modal-card h3 { margin: 0 0 1rem; font-size: 1.1rem; }
.modal-card .form-grid { margin-bottom: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.25rem; }

/* O azul primario sobre o proprio azul a 16% dava 4.21:1 — reprova AA em
   texto de 0.7rem. O tom forte sobe para 5.5:1 sem mudar a familia de cor. */
.tag-carro { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--tag-carro-text); }
.tag-moto { background: #f3e8ff; color: #6b21a8; }
@media (prefers-color-scheme: dark) {
  .tag-moto { background: #3b1a5c; color: #d8b4fe; }
}

.kpi-sm { font-size: 1rem !important; }
.alert-list { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.4rem; font-size: 0.9rem; }

/* Checkbox alinha com o texto, nao estica na largura do grid. */
.field.check { display: flex; align-items: center; gap: 0.5rem; }
.field.check input { width: auto; flex: none; }
.field.check span { margin: 0; font-size: 0.875rem; }
.field.check em { font-style: normal; }

/* ===== Correcoes de revisao visual =============================== */

/* Excluir e acao destrutiva: na cor primaria ela compete com "Cadastrar"
   e convida ao clique errado. Vermelho so no hover para nao pintar a
   tabela inteira de alerta em repouso. Vale para todas as telas. */
.table .btn-link, .btn-link.btn-danger { color: var(--muted); }
.table .btn-link:hover, .btn-link.btn-danger:hover {
  color: var(--error); text-decoration: underline;
}

/* Os dois valores do card Carro/Moto empilham em vez de brigar numa linha. */
.kpi-par { display: flex; flex-direction: column; gap: 0.15rem; }
.kpi-par span { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; }
.kpi-par small { font-size: 0.72rem; color: var(--muted); font-weight: 400; }

/* Respiro entre os blocos grandes da pagina. */
.card + .card { margin-top: 1.25rem; }

/* Link "voltar ao topo": era cinza pequeno demais para o alvo que e.
   Sem !important: .app-top-link (acima) ja tem especificidade composta
   maior que .app-footer a, e esta regra vem depois para vencer por ordem. */
.app-top-link { color: var(--text); }
.app-top-link:hover { color: var(--primary); }

/* TOC do tutorial: .tut:target marca a secao aberta sem uma linha de JS.
   A transicao de hover foi para a definicao base de .tut-toc a; o
   scroll-margin-top (90px) ja esta no bloco principal do tutorial. */
.tut:target {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

/* Credencial publica logo abaixo do CTA da demo. */
.lp-cta-note {
  margin: 0.9rem 0 0; font-size: 0.85rem; color: rgba(255,255,255,0.82);
  font-variant-numeric: tabular-nums;
}

/* ===== Landing: contraste do eyebrow ==========
   eyebrow #2563eb media 4.63:1 sobre o fundo alternado; o tom mais escuro
   abaixo da 6.7:1 e evita esforco de leitura em texto de 0.8rem. */
.lp-eyebrow { color: #1d4ed8; }

.lp-cta-note { color: rgba(255,255,255,0.9); font-size: 0.88rem; }
