/* =========================================================================
   MMS FINANCEIRO — identidade da aplicação
   Preto, branco e cinzas para a hierarquia; azul como cor funcional.
   Verde e vermelho SOMENTE em estado econômico inequívoco.

   Uma base só para celular e desktop: o que muda entre eles é a media query,
   não o HTML. Mobile-first — o desktop é o acréscimo.
   ========================================================================= */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f4;
  --ink: #101318;
  --muted: #69717b;
  --line: #dfe3e7;

  --nav: #0c0f13;
  --nav-2: #171c23;

  /* Azul institucional / funcional */
  --blue: #245f9e;
  --blue-soft: #edf4fb;

  /* Estados financeiros inequívocos, e só eles */
  --green: #356b55;
  --green-soft: #edf5f1;
  --red: #9a3f43;
  --red-soft: #f9eeee;

  --r: 18px;
  --r-sm: 12px;
  --content: 1220px;
  --toque: 44px; /* alvo mínimo de toque */
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
svg { display: block; }

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

/* Dinheiro sempre em algarismos de largura fixa: colunas de valores
   precisam alinhar, e o olho compara ordem de grandeza pela posição. */
.money { font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; }

/* Verde e vermelho como REFORÇO. O texto ao lado carrega o mesmo significado. */
.good { color: var(--green) !important; }
.bad  { color: var(--red)   !important; }

.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;
}

/* Foco sempre visível — navegação por teclado é requisito, não detalhe. */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.pular {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--nav); color: #fff; padding: 12px 18px; border-radius: 0 0 12px 0;
  font-weight: 700; text-decoration: none;
}
.pular:focus { left: 0; }

/* ============================ casca ============================ */

.app { min-height: 100vh; }
.coluna { min-width: 0; }
.desktop-sidebar { display: none; }

.mobile-top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--line);
}
.mobile-top-inner {
  max-width: var(--content); margin: auto; min-height: 64px;
  padding: 10px 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  display: block; height: 34px; width: auto; max-width: 120px;
  object-fit: contain; flex: 0 0 auto; border-radius: 6px;
}
.brand-copy { min-width: 0; }
.brand-name {
  font-weight: 800; font-size: 13px; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

.main { max-width: var(--content); margin: auto; padding: 16px 14px 96px; }

/* ============================ cabeçalho da página ============================ */

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin: 2px 2px 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 24px; margin: 0 0 5px; letter-spacing: -.035em; color: #0d1014; font-weight: 790; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; max-width: 60ch; }

.date-chip {
  border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm);
  padding: 8px 10px; font-size: 11px; color: var(--muted); white-space: nowrap;
}
.exportar-acoes { display: flex; align-items: center; gap: 8px; min-height: var(--toque); font-size: 12px; }
.exportar-acoes span { color: var(--muted); font-weight: 650; }
.exportar-acoes a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--blue);
  font-weight: 720; text-decoration: none; background: #fff;
}
.exportar-acoes a:hover { border-color: #a9bdcf; background: #f4f8fc; }

.voltar {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 700;
  color: var(--blue); text-decoration: none; margin-bottom: 4px; padding: 12px 2px;
  min-height: var(--toque);
}
.voltar:hover { text-decoration: underline; }

/* ============================ data-base e período ============================ */

.periodo {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; margin-bottom: 14px;
}
.periodo fieldset {
  border: 0; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.periodo-campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.periodo-campo label { font-size: 11px; color: var(--muted); font-weight: 650; }
.periodo-campo input {
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px; min-height: var(--toque); background: #fff; color: var(--ink);
  width: 100%;
}
.periodo-ok {
  grid-column: 1 / -1; min-height: var(--toque);
  border: 0; border-radius: var(--r-sm); background: var(--nav); color: #fff;
  font-weight: 720; padding: 12px;
}
.periodo-ok:hover { background: var(--nav-2); }
.periodo-nota { margin: 10px 2px 0; font-size: 11px; color: var(--muted); line-height: 1.45; }

/* ============================ destaque: caixa livre ============================ */

.hero {
  display: block; text-decoration: none; color: #fff;
  background: linear-gradient(145deg, #090b0e 0%, #151a21 72%, #1c2632 100%);
  border-radius: 22px; padding: 20px; position: relative; overflow: hidden;
  box-shadow: 0 16px 34px rgba(10, 13, 17, .16);
}
.hero:after {
  content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%;
  right: -65px; top: -85px; border: 35px solid rgba(36, 95, 158, .30);
}
.hero:hover { background: linear-gradient(145deg, #0d1116 0%, #1a2028 72%, #223040 100%); }

.eyebrow {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .11em; color: #aeb8c3;
}
.hero-value {
  display: block; font-size: 34px; font-weight: 780;
  letter-spacing: -.055em; margin: 7px 0 5px; color: #fff;
}
/* No fundo escuro, o verde/vermelho da paleta clara não teria contraste. */
.hero-value.good { color: #7fc4a3 !important; }
.hero-value.bad  { color: #e8969a !important; }

.hero-note { display: block; font-size: 12px; color: #c4cbd3; line-height: 1.45; max-width: 46ch; }

.hero-bottom {
  display: flex; gap: 22px; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .12); flex-wrap: wrap;
}
.hero-mini span { display: block; font-size: 10px; color: #9ca8b5; text-transform: uppercase; letter-spacing: .07em; }
.hero-mini b { display: block; margin-top: 4px; font-size: 15px; color: #fff; }
.hero-mini b.good { color: #7fc4a3 !important; }
.hero-mini b.bad  { color: #e8969a !important; }

.hero-ver { display: block; margin-top: 14px; font-size: 11px; color: #9fb0ba; }

/* ============================ KPIs ============================ */

.kpi-grid { display: grid; gap: 10px; margin-top: 10px; }
.kpi-grid-2, .kpi-grid-3 { grid-template-columns: 1fr; }

.kpi {
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px; min-height: 104px;
}
.kpi:hover { border-color: #b9c3c8; background: #fbfcfd; }
.kpi-label { font-size: 11px; color: var(--muted); line-height: 1.35; }
.kpi-value { font-size: 22px; font-weight: 760; letter-spacing: -.04em; margin: 6px 0; color: #11151a; }
.kpi-foot {
  font-size: 11px; color: var(--muted); display: flex;
  justify-content: space-between; gap: 8px; margin-top: auto;
}
.kpi-ver { color: var(--blue); font-weight: 650; }

/* ============================ seções e painéis ============================ */

.section { margin-top: 22px; }
.section-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 12px; margin: 0 2px 10px; flex-wrap: wrap;
}
.section-head h2 { font-size: 16px; margin: 0; letter-spacing: -.02em; }
.section-head p { font-size: 11px; margin: 3px 0 0; color: var(--muted); }

.link-btn {
  border: 0; background: none; color: var(--blue); font-size: 12px;
  font-weight: 700; padding: 12px 4px; text-decoration: none;
  min-height: var(--toque); display: inline-flex; align-items: center;
}
.link-btn:hover { text-decoration: underline; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
.panel-pad { padding: 15px; }

.vazio {
  margin: 0; padding: 22px 4px; text-align: center;
  color: var(--muted); font-size: 13px;
}

/* ============================ faixas de atraso ============================ */

.aging-bars { display: flex; align-items: flex-end; gap: 10px; padding-top: 8px; }
.aging-col { flex: 1; min-width: 0; text-align: center; }
.aging-val { font-size: 10px; font-weight: 750; margin-bottom: 6px; }
.aging-stick { height: 110px; display: flex; align-items: flex-end; justify-content: center; }
.aging-stick i {
  display: block; width: 70%; min-width: 26px; min-height: 3px;
  border-radius: 7px 7px 3px 3px; background: #20262e;
}
.aging-lbl { font-size: 9px; color: var(--muted); line-height: 1.2; margin-top: 6px; }
.aging-count { font-size: 9px; color: #9aa4aa; margin-top: 2px; }

.faixa-lista { list-style: none; margin: 16px 0 0; padding: 0; }
.faixa-lista li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--line); font-size: 12px;
}
.faixa-nome { color: var(--muted); }
.faixa-valor { font-weight: 720; }

.total-line {
  border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; font-size: 13px;
}
.total-line b { font-size: 17px; }

/* ============================ composição ============================ */

.breakdown { display: grid; gap: 12px; }
.break-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.break-label { font-size: 12px; color: var(--muted); }
.break-value { font-weight: 740; font-size: 13px; }
.bar { height: 7px; background: #edf0f2; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: #20262e; }
.bar.fraca > i { background: #8b97a5; }

/* ============================ detalhamento ============================ */

.drill-head { margin-bottom: 14px; }
.drill-title { font-size: 17px; margin: 0 0 4px; letter-spacing: -.02em; }
.drill-sub { font-size: 12px; color: var(--muted); margin: 0 0 12px; line-height: 1.45; }

.drill-total {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px;
  font-size: 12px; color: var(--muted);
}
.drill-total b { font-size: 20px; color: var(--ink); font-weight: 780; }

.drill-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 9px; }

.row-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 13px 14px; }
.row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.row-copy { min-width: 0; }
.row-title { font-size: 13px; font-weight: 750; line-height: 1.3; }
.row-sub { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.35; word-break: break-word; }
.row-amount { text-align: right; font-size: 15px; font-weight: 760; }

.row-meta {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 10px 0 0; padding: 0;
}
.pill {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 5px 9px; background: var(--surface-2); font-size: 10px;
  font-weight: 700; color: #56606b;
}
.meta-par {
  display: flex; gap: 5px; align-items: baseline;
  font-size: 11px; background: var(--surface-2);
  border-radius: 8px; padding: 5px 8px;
}
.meta-par dt { color: var(--muted); margin: 0; }
.meta-par dd { margin: 0; font-weight: 680; }

.row-link {
  display: inline-flex; align-items: center; margin-top: 6px; font-size: 12px;
  font-weight: 700; color: var(--blue); text-decoration: none;
  min-height: var(--toque); padding: 12px 0;
}
.row-link:hover { text-decoration: underline; }

.row-origem {
  margin: 9px 0 0; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 10px; color: #9aa4aa; word-break: break-all;
}

/* Reconciliação: a afirmação de que a soma bate. */
.reconciliacao {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--green-soft); border: 1px solid #cfe4d9;
  font-size: 12px; color: #2c5a49; line-height: 1.5;
}
.reconciliacao p { margin: 0; }
.reconciliacao b { font-weight: 780; }
.reconc-marca {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 5px; background: var(--green); color: #fff;
  font-weight: 800; font-size: 11px; margin-right: 4px; vertical-align: -4px;
}
.reconciliacao.quebrada {
  background: var(--red-soft); border-color: #eccfd0; color: #7d2f33;
}
.reconciliacao.quebrada .reconc-marca { background: var(--red); }

.drill-nota {
  margin: 14px 0 0; font-size: 11px; color: var(--muted);
  line-height: 1.5; padding-top: 12px; border-top: 1px solid var(--line);
}

.alerta-reconciliacao {
  margin: 12px 0 0; padding: 11px 12px; border-radius: var(--r-sm);
  background: var(--red-soft); border: 1px solid #eccfd0;
  color: #7d2f33; font-size: 12px;
}

.rodape-nota {
  margin: 26px 2px 0; font-size: 11px; color: var(--muted);
  line-height: 1.5; text-align: center;
}

/* =========================================================================
   MARCO 4B — telas operacionais: filtros, totais, grupos e linhas
   ========================================================================= */

.filtros {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; margin-bottom: 12px;
}
.filtros fieldset {
  border: 0; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.filtro-campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filtro-campo label { font-size: 11px; color: var(--muted); font-weight: 650; }
.filtro-campo select,
.filtro-campo input {
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px; min-height: var(--toque); background: #fff; color: var(--ink);
  width: 100%; max-width: 100%;
}
.filtro-busca { grid-column: 1 / -1; }
.filtro-acoes {
  grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; margin-top: 2px;
}
.filtro-acoes .periodo-ok { grid-column: auto; flex: 1; }
.filtro-limpar {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--toque); padding: 12px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; font-size: 12px; font-weight: 700; background: #fff;
}
.filtro-limpar:hover { border-color: #b9c3c8; color: var(--ink); }

.filtros-ativos {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
  margin: 0 2px 12px; font-size: 11px;
}
.filtros-rotulo { color: var(--muted); font-weight: 650; }
.filtros-contagem { color: var(--muted); margin-left: auto; }

/* ---- totais da lista ---- */
.totais {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 14px;
}
.total-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px;
}
.total-card.destaque { background: var(--nav); border-color: var(--nav); }
.total-card.destaque .total-label { color: #9ca8b5; }
.total-card.destaque .total-valor { color: #fff; }
.total-card.destaque .total-valor.good { color: #7fc4a3 !important; }
.total-card.destaque .total-valor.bad { color: #e8969a !important; }
.total-label { display: block; font-size: 10px; color: var(--muted); line-height: 1.3; }
.total-valor { display: block; margin-top: 5px; font-size: 17px; font-weight: 770; letter-spacing: -.03em; }

/* ---- grupos ---- */
.grupo .section-head { align-items: center; }
.grupo-subtotal { font-size: 16px; font-weight: 770; white-space: nowrap; }

/* ---- quantias dentro da linha ---- */
.valores {
  display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 0; padding: 0;
}
.valor-par {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface-2); border-radius: 9px; padding: 7px 9px; min-width: 92px;
}
.valor-par dt { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0; }
.valor-par dd { margin: 0; font-size: 12px; font-weight: 730; }
.valor-par.destaque { background: #e9eef4; }

.row-selos { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- bloco de detalhes recolhível ---- */
.row-detalhe { margin-top: 10px; }
.row-detalhe > summary {
  cursor: pointer; font-size: 11px; font-weight: 700; color: var(--blue);
  padding: 12px 2px; min-height: var(--toque); display: flex; align-items: center;
  list-style: none;
}
.row-detalhe > summary::-webkit-details-marker { display: none; }
.row-detalhe > summary:before { content: "＋"; margin-right: 6px; font-weight: 800; }
.row-detalhe[open] > summary:before { content: "−"; }
.row-detalhe > summary:hover { text-decoration: underline; }
.row-detalhe .row-meta { margin-top: 4px; }

/* ---- linhas filhas: alocações de um recebimento ---- */
.row-filhas { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.filhas-titulo { margin: 0 0 8px; font-size: 11px; color: var(--muted); font-weight: 650; }
.row-card.row-filha {
  background: var(--surface-2); border-color: #d5dade;
}
.row-card.row-filha .valor-par { background: #fff; }

.lista-solta { margin-top: 0; }

/* ============================ navegação inferior ============================ */

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.nav-btn {
  border: 0; background: none; color: #77838b; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 3px; border-radius: 10px; font-size: 9px;
  min-height: var(--toque); justify-content: center;
}
.nav-btn svg {
  width: 20px; height: 20px; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.nav-btn.active { color: var(--blue); font-weight: 800; }
.nav-btn.active svg { stroke-width: 2.2; }

/* ============================ folha de detalhe ============================ */

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(10, 19, 24, .45); z-index: 60;
  display: flex; align-items: flex-end; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.sheet-backdrop[hidden] { display: none; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  background: #fff; width: 100%; max-height: 86vh; border-radius: 25px 25px 0 0;
  overflow: auto; padding: 10px 15px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .23s;
}
.sheet-backdrop.open .sheet { transform: none; }
.grab { width: 42px; height: 4px; background: #d6dadd; border-radius: 99px; margin: 3px auto 13px; }
.close-sheet {
  width: 100%; margin-top: 14px; border: 0; background: var(--nav); color: #fff;
  border-radius: 13px; padding: 14px; font-weight: 720; min-height: var(--toque);
}
.carregando { padding: 30px 4px; text-align: center; color: var(--muted); font-size: 13px; }

/* ============================ erro ============================ */

.body-erro { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.erro-caixa {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 30px 24px; max-width: 440px; text-align: center;
}
.erro-logo { height: 40px; width: auto; margin: 0 auto 20px; border-radius: 6px; }
.erro-status { font-size: 12px; color: var(--muted); letter-spacing: .12em; margin: 0 0 6px; }
.erro-titulo { font-size: 20px; margin: 0 0 10px; letter-spacing: -.02em; }
.erro-mensagem { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 22px; }
.erro-voltar {
  display: inline-block; background: var(--nav); color: #fff; text-decoration: none;
  border-radius: var(--r-sm); padding: 13px 22px; font-weight: 720; font-size: 13px;
  min-height: var(--toque);
}
.erro-voltar:hover { background: var(--nav-2); }

/* =========================================================================
   TABLET — 720px
   ========================================================================= */
@media (min-width: 720px) {
  .main { padding: 22px 22px 50px; }
  .kpi-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .periodo fieldset { grid-template-columns: repeat(3, 1fr) auto; align-items: end; }
  .periodo-ok { grid-column: auto; }
  .filtros fieldset { grid-template-columns: repeat(3, 1fr); align-items: end; }
  .filtro-busca { grid-column: auto; }
  .filtro-acoes { justify-content: flex-start; }
  .filtro-acoes .periodo-ok { flex: 0 0 auto; min-width: 140px; }
  .totais { grid-template-columns: repeat(3, 1fr); }
  .valor-par { min-width: 104px; }
  .hero { padding: 26px; }
  .hero-value { font-size: 40px; }
  .drill-list { gap: 10px; }
  .sheet { max-width: 560px; margin: auto; border-radius: 25px 25px 0 0; }
}

/* =========================================================================
   DESKTOP — 1020px: sidebar escura, conteúdo central claro
   ========================================================================= */
@media (min-width: 1020px) {
  body { background: #f1f2f4; }

  .app { display: grid; grid-template-columns: 245px minmax(0, 1fr); }
  .mobile-top, .bottom-nav { display: none; }

  .desktop-sidebar {
    display: flex; position: sticky; top: 0; height: 100vh;
    background: #0b0d10; color: #d5d9de; border-right: 1px solid #20252c;
    flex-direction: column; padding: 22px 14px; overflow: auto;
  }
  .desktop-sidebar .brand { flex-direction: column; align-items: flex-start; gap: 10px; }
  .desktop-sidebar .brand-logo { height: 54px; max-width: 180px; }
  .desktop-sidebar .brand-name { color: #fff; }
  .desktop-sidebar .brand-sub { color: #858f9a; }

  .side-nav { margin-top: 6px; }
  .side-section {
    font-size: 9px; text-transform: uppercase; letter-spacing: .13em;
    color: #737d88; margin: 21px 10px 7px;
  }
  .side-btn {
    border: 0; background: none; color: #b9c0c7; border-radius: 10px;
    padding: 11px 10px; width: 100%; display: flex; align-items: center;
    gap: 10px; text-align: left; font-size: 12px; position: relative;
    text-decoration: none; min-height: var(--toque);
  }
  .side-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: 0 0 auto; }
  .side-btn:hover { background: #151a20; color: #fff; }
  .side-btn.active { background: #171d24; color: #fff; }
  .side-btn.active:before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 3px; background: var(--blue);
  }

  .side-foot {
    margin-top: auto; border-top: 1px solid #242a31; padding: 14px 9px 0;
    font-size: 10px; color: #7e8791; line-height: 1.6;
  }

  .main { width: 100%; padding: 28px 30px 60px; }
  .page-head h1 { font-size: 29px; }
  .hero-value { font-size: 44px; }

  /* Há largura para mais colunas de filtro e de total. */
  .filtros fieldset { grid-template-columns: repeat(4, 1fr); }
  .totais { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

  /* A linha operacional ganha as quantias à direita do identificador. */
  .row-card { padding: 15px 16px; }
  .valores { gap: 8px; }

  /* No desktop há largura para as duas colunas de leitura. */
  .drill-list { grid-template-columns: 1fr; }
}

/* Respeita quem pediu menos movimento. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
/* Etapa 5A: tela de acesso sem biblioteca externa. */
.login-page{min-height:100vh;display:grid;place-items:center;background:#111;color:#111;padding:1rem}.login-card{width:min(100%,26rem);background:#fff;border:1px solid #d5d5d5;padding:2rem;border-radius:.75rem}.login-logo{width:4rem;height:4rem}.login-card h1{margin:.25rem 0}.login-card .muted{color:#606060}.login-form{display:grid;gap:1rem;margin-top:1.25rem}.login-form label{display:grid;gap:.35rem;font-weight:600}.login-form input{padding:.7rem;border:1px solid #888;border-radius:.25rem;font:inherit}.login-form button,.logout-form button{background:#0b5cab;color:#fff;border:0;border-radius:.25rem;padding:.65rem .9rem;font:inherit;cursor:pointer}.login-error{background:#fbe9e7;color:#9b1b1b;padding:.7rem;border-left:3px solid #b42318}.logout-form{display:inline}.logout-form button{background:transparent;color:inherit;padding:.2rem 0;text-decoration:underline}
.financial-form{display:grid;gap:1rem;max-width:44rem;background:#fff;border:1px solid #ddd;border-radius:.5rem;padding:1rem}.financial-form label{display:grid;gap:.35rem;font-weight:600}.financial-form input,.financial-form select{min-height:2.7rem;padding:.5rem;border:1px solid #8a8a8a;border-radius:.25rem;font:inherit;background:#fff}.financial-form button{justify-self:start;background:#0b5cab;color:#fff;border:0;border-radius:.25rem;padding:.75rem 1rem;font:inherit;font-weight:700}.financial-form fieldset{display:grid;gap:.65rem;border:1px solid #bbb;padding:.8rem}.allocation-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(7rem,.5fr);gap:.5rem}.form-note{color:#555;margin:0}.check{display:flex!important;align-items:center;gap:.5rem}.check input{min-height:auto!important}
.row-actions{display:flex;gap:.75rem;flex-wrap:wrap;margin:.8rem 0 0}.row-actions .row-link{margin:0}.financial-form legend{font-weight:700}
.list-cards{display:grid;gap:.8rem}.list-card{background:#fff;border:1px solid #ddd;border-radius:.5rem;padding:1rem;display:grid;gap:.75rem}.list-card h2{margin:0;font-size:1.05rem}.list-card p{margin:.25rem 0 0;color:#555}.empty-state{background:#fff;border:1px solid #ddd;border-radius:.5rem;padding:1rem}.empty-state h2{margin-top:0}.financial-form fieldset label{display:flex;align-items:center;gap:.5rem}.financial-form fieldset input{min-height:auto}
