/* Venanceiro — design system (paleta verde) · mobile first
   Tokens → componentes. Contraste de texto >= 4.5:1; alvos de toque >= 44px. */

/* Plus Jakarta Sans (SIL Open Font License) hospedada localmente: sem pedir nada ao Google */
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* paleta base (da imagem de referência) */
  --g-50: #e6f4ea;
  --g-100: #cee9d6;
  --g-200: #a8dab5;
  --g-300: #81c995;
  --g-500: #34a853;
  --g-600: #1e8e3e;
  --g-700: #188038;
  --g-800: #137333;
  --g-900: #0d652d;

  /* semânticos (claro) */
  --bg: var(--g-50);
  --surface: #fafafa;
  --surface-2: #f0f8f2;
  --ink: #12261a;
  --ink-2: #2f4a3a;
  --muted: #4d6657;
  --line: #c3dacb;
  --line-strong: #8fb79c;
  --primary: var(--g-700);
  --primary-hover: var(--g-800);
  --on-primary: #ffffff;
  --primary-soft: var(--g-100);
  --on-primary-soft: #0d4a22;
  --danger: #b3261e;
  --danger-bg: #fce8e6;
  --warn: #7a4a00;
  --warn-bg: #fef1cc;
  --hero-from: var(--g-800);
  --hero-to: var(--g-900);
  --on-hero: #ffffff;
  --on-hero-2: #dff1e4;

  /* destaques por grupo (como as cores da planilha, só que sutis) */
  --gp-fixo: #5f8497; --gp-fixo-bg: #e3eef1;
  --gp-var: #e08a00; --gp-var-bg: #fff0d6;
  --gp-pj: #3b6fd4; --gp-pj-bg: #e5edfb;
  --gp-terc: #8a62c8; --gp-terc-bg: #eee8f8;
  --gp-inv: #1a7f64; --gp-inv-bg: #ddf1ec;
  --gp-div: #c5392b; --gp-div-bg: #fbe6e3;

  /* séries dos gráficos */
  --cx1: #188038; --cx2: #3b6fd4; --cx3: #e08a00; --cx4: #8a62c8; --cx5: #c2185b; --cx6: #00838f;
  --c1: #0d652d;
  --c2: #34a853;
  --c3: #a8dab5;
  --c4: #f9ab00;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(13, 101, 45, 0.08), 0 6px 20px rgba(13, 101, 45, 0.07);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --cx1: #34a853; --cx2: #86aaf2; --cx3: #f2a33a; --cx4: #b79ae6; --cx5: #f48fb1; --cx6: #4dd0e1;
    --bg: #0b1710;
    --surface: #122219;
    --surface-2: #173024;
    --ink: #e6f4ea;
    --ink-2: #c5decc;
    --muted: #9bb8a5;
    --line: #25402f;
    --line-strong: #3d6a4e;
    --primary: #34a853;
    --primary-hover: #4cbb68;
    --on-primary: #06210e;
    --primary-soft: #1b3a27;
    --on-primary-soft: #cee9d6;
    --danger: #f28b82;
    --danger-bg: #3b1b19;
    --warn: #f9c74f;
    --warn-bg: #3a2d0e;
    --hero-from: #0f4d27;
    --hero-to: #0a3a1d;
    --c1: #81c995;
    --c2: #34a853;
    --c3: #1e6a37;
    --c4: #f9ab00;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --gp-fixo: #8db2c6; --gp-fixo-bg: #1a2d35;
    --gp-var: #f2a33a; --gp-var-bg: #3a2b10;
    --gp-pj: #86aaf2; --gp-pj-bg: #18274a;
    --gp-terc: #b79ae6; --gp-terc-bg: #2a2040;
    --gp-inv: #5fd0b0; --gp-inv-bg: #123a30;
    --gp-div: #f28b82; --gp-div-bg: #3b1b19;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul { list-style: none; padding: 0; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
.brand {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  font-weight: 800; font-size: 18px; letter-spacing: -0.01em;
}
.brand-mark {
  width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary);
}
.brand-mark .i { width: 18px; height: 18px; }
.brand-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a, .nav-more {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 62px; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none;
}
.nav a .pill, .nav-more .pill { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background 0.2s var(--ease); }
.nav a[aria-current="page"], .nav-more[aria-current="page"] { color: var(--on-primary-soft); }
.nav a[aria-current="page"] .pill, .nav-more[aria-current="page"] .pill { background: var(--primary-soft); }

main { padding: 16px; max-width: 760px; margin: 0 auto; }
main[data-route="painel"] { max-width: 1240px; }

.fab {
  position: fixed; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 25;
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 20px 0 16px;
  border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 800;
  box-shadow: 0 10px 26px rgba(13, 101, 45, 0.35); transition: transform 0.15s var(--ease), background 0.15s;
}
.fab:hover { background: var(--primary-hover); }
.fab:active { transform: scale(0.97); }
.fab[hidden] { display: none; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: auto 1fr; padding-bottom: 0; }
  .brand { grid-column: 1; grid-row: 1; position: sticky; top: 0; border-bottom: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 24px 20px 12px; font-size: 20px; }
  .nav {
    position: sticky; top: 76px; grid-column: 1; grid-row: 2; align-self: start; height: calc(100dvh - 76px);
    display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 16px; background: transparent;
    -webkit-backdrop-filter: none; backdrop-filter: none; border-top: 0;
  }
  .nav a, .nav-more { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 14px; font-size: 15px; }
  .nav a .pill, .nav-more .pill { width: auto; height: auto; background: none !important; }
  .nav a[aria-current="page"] { background: var(--primary-soft); }
  main { grid-column: 2; grid-row: 1 / span 2; width: 100%; padding: 28px 32px; }
  .fab { bottom: 28px; right: 32px; }
}

/* ---------- tipografia ---------- */
h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 800; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- botões / chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 700;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--primary-soft); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); }
.icon-btn:hover { background: var(--primary-soft); }

.chips, .tabs { display: flex; gap: 6px; padding: 4px; border-radius: 16px; background: var(--g-100); overflow-x: auto; scrollbar-width: none; }
:root[data-theme="dark"] :is(.chips, .tabs) { background: var(--surface-2); }
.chip, .tab { flex: 1 0 auto; min-height: 44px; padding: 0 14px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.chip[aria-selected="true"], .chip[aria-checked="true"], .tab[aria-selected="true"] { background: var(--surface); color: var(--on-primary-soft); box-shadow: var(--shadow); }

/* ---------- barra de mês ---------- */
.monthbar { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; }
.monthbar h1 { flex: 1; text-align: center; }
.monthbar .tag { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 700; color: var(--warn); background: var(--warn-bg); padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.monthbar .tag .i { width: 13px; height: 13px; }
.today-link { font-size: 13px; font-weight: 700; color: var(--primary); min-height: 44px; padding: 0 8px; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  color: var(--on-hero); border-radius: 24px; padding: 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(168, 218, 181, 0.14); }
.hero-label { font-size: 14px; font-weight: 600; color: var(--on-hero-2); }
.hero-value { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 2px 0 12px; }
.progress { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--g-200); transition: width 0.4s var(--ease); }
.hero-sub { font-size: 13px; color: var(--on-hero-2); margin: 8px 0 16px; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; position: relative; z-index: 1; }
.hero-stats dt { font-size: 12px; color: var(--on-hero-2); font-weight: 600; }
.hero-stats dd { font-size: 17px; font-weight: 800; }
.hero-stats .neg { color: #ffd9d6; }
@media (min-width: 560px) { .hero-stats { grid-template-columns: repeat(4, 1fr); } }

/* ---------- alertas / cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.alert { margin-top: 14px; border-radius: var(--radius); border: 1px solid var(--danger); background: var(--danger-bg); }
.alert > summary { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 16px; font-weight: 700; color: var(--danger); cursor: pointer; list-style: none; }
.alert > summary::-webkit-details-marker { display: none; }
.alert > summary span { flex: 1; }
.alert .items { padding: 0 8px 8px; }

/* ---------- blocos ---------- */
.blocks { display: grid; gap: 14px; margin-top: 16px; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.block > summary { display: grid; grid-template-columns: 1fr auto 24px; align-items: center; gap: 4px 10px; padding: 14px 16px; min-height: 64px; cursor: pointer; list-style: none; }
.block > summary::-webkit-details-marker { display: none; }
.block > summary h2 { grid-column: 1; }
.block > summary .tot { grid-column: 2; grid-row: 1 / span 2; font-weight: 800; font-size: 18px; text-align: right; }
.block > summary .sub { grid-column: 1; font-size: 13px; color: var(--muted); }
.block > summary .chev { grid-column: 3; grid-row: 1 / span 2; transition: transform 0.2s var(--ease); color: var(--muted); }
.block[open] > summary .chev { transform: rotate(90deg); }
.block .items { padding: 0 8px 8px; border-top: 1px solid var(--line); }
.empty { padding: 20px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- itens ---------- */
.item {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; column-gap: 4px;
  min-height: 64px; border-bottom: 1px solid var(--line); position: relative;
}
.item:last-child { border-bottom: 0; }
.item.is-overdue::before { content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--danger); }
.check { width: 44px; height: 44px; display: grid; place-items: center; }
.check span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; color: transparent; transition: background 0.15s, border-color 0.15s; }
.check span .i { width: 16px; height: 16px; stroke-width: 3; }
.check[aria-pressed="true"] span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.check:hover span { border-color: var(--primary); }
.item-main { text-align: left; padding: 8px 4px; min-height: 44px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; min-width: 0; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.item-sub { font-size: 13px; color: var(--muted); }
.is-paid .item-name { color: var(--muted); }
.is-void .item-name, .is-void .amount { text-decoration: line-through; color: var(--muted); }
.amount { min-height: 44px; padding: 0 8px; font-weight: 800; border-radius: 10px; white-space: nowrap; }
.amount:not(.static) { text-decoration: underline dotted var(--line-strong); text-underline-offset: 5px; }
.amount:hover { background: var(--primary-soft); }
.is-paid .amount { color: var(--muted); font-weight: 700; }
.amount-input { width: 120px; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 2px solid var(--primary); background: var(--surface); text-align: right; font-weight: 800; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-top: 2px; }
.badge .i { width: 13px; height: 13px; }
.b-danger { background: var(--danger-bg); color: var(--danger); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-void { background: var(--g-100); color: var(--ink-2); }
:root[data-theme="dark"] .b-void { background: var(--surface-2); }

.close-bar { margin-top: 18px; display: grid; gap: 8px; }

/* ---------- lançamentos ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters .full { grid-column: 1 / -1; }
.filters input, .filters select { width: 100%; }
.entries-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; gap: 8px; }
.entry { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 8px; padding: 6px 8px 6px 12px; min-height: 64px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.entry:last-child { border-bottom: 0; }
.entry:hover { background: var(--surface-2); }
.entry .amount { pointer-events: none; }
.entry-kind { font-size: 12px; font-weight: 700; color: var(--on-primary-soft); background: var(--primary-soft); padding: 1px 8px; border-radius: 999px; }
.entry-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- formulários ---------- */
.field { display: grid; gap: 4px; }
.field label, .field > span { font-size: 14px; font-weight: 700; }
.field .opt { font-weight: 500; color: var(--muted); }
input[type="text"], input[type="number"], input[type="date"], input[type="month"], input[type="search"], select, textarea {
  min-height: 48px; width: 100%; padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; }
input::placeholder { color: var(--muted); opacity: 0.8; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 0; }
.err:empty { display: none; }
.form { display: grid; gap: 14px; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-field { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 600; cursor: pointer; }
.check-field input { width: 22px; height: 22px; accent-color: var(--primary); }
.form-actions { display: grid; gap: 8px; padding-top: 4px; }

/* ---------- sheet ---------- */
dialog.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--ink);
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0;
  border-radius: 26px 26px 0 0; overflow: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
}
dialog.sheet::backdrop { background: rgba(8, 26, 15, 0.55); }
dialog.sheet[open] { animation: sheet-in 0.26s var(--ease); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px 20px; background: var(--surface); }
.sheet-head h2 { flex: 1; font-size: 18px; }
.sheet-body { padding: 4px 20px calc(24px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 26px; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin-bottom: 14px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { font-weight: 700; text-align: right; }
.plist li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plist li:last-child { border-bottom: 0; }

/* ---------- painel: grade ---------- */
.panel-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.yearbar { display: flex; align-items: center; gap: 4px; }
.yearbar h1 { min-width: 64px; text-align: center; }
.grid-scroll { overflow: auto; max-height: 72dvh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: calc(150px + 12 * 112px); width: 100%; }
.grid th, .grid td { padding: 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.grid thead th { position: sticky; top: 0; z-index: 3; padding: 10px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); text-align: right; }
.grid thead th.cur { color: var(--primary); }
.grid .sticky { position: sticky; left: 0; z-index: 2; text-align: left; padding: 0 10px; min-width: 150px; max-width: 150px; border-right: 1px solid var(--line); }
.grid thead th.sticky { z-index: 4; }
.grid td.sticky { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; height: 48px; }
.grid tr.grp th, .grid tr.grp td { background: var(--gb, var(--surface-2)); font-weight: 800; height: 40px; padding: 0 8px; text-align: right; }
.grid tr.grp th.sticky { text-align: left; }
.grid tfoot th, .grid tfoot td { background: var(--surface-2); font-weight: 700; padding: 0 8px; height: 42px; text-align: right; }
.grid tfoot tr:last-child th, .grid tfoot tr:last-child td { border-bottom: 0; }
.grid td.num { text-align: right; padding: 0 4px; }
.cell { display: flex; align-items: center; justify-content: flex-end; gap: 2px; border-radius: 10px; margin: 3px 2px; min-height: 42px; }
.cell-v { flex: 1; min-height: 42px; text-align: right; padding: 0 4px 0 6px; font-weight: 700; display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; border-radius: 10px; }
.cell-c { width: 36px; min-height: 42px; display: grid; place-items: center; border-radius: 10px; }
.cell-c .i { width: 16px; height: 16px; stroke-width: 3; opacity: 0.25; }
.cell.paid { background: var(--primary-soft); color: var(--on-primary-soft); }
.cell.paid .cell-c .i { opacity: 1; }
.cell.pending, .cell.soon { background: var(--warn-bg); color: var(--warn); }
.cell.overdue { background: var(--danger-bg); color: var(--danger); }
.cell.void { color: var(--muted); text-decoration: line-through; }
.cell-v .i { width: 14px; height: 14px; }
.cell-empty { display: block; text-align: right; color: var(--muted); padding: 0 12px; }
.neg { color: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sw.dash { height: 0; border-top: 3px dashed var(--c4); width: 18px; border-radius: 0; }
.sw.c1, .bar.c1 { background: var(--c1); } .sw.c2, .bar.c2 { background: var(--c2); }
.sw.c3, .bar.c3 { background: var(--c3); } .sw.c4, .bar.c4 { background: var(--c4); }

/* ---------- painel: gráficos ---------- */
.charts { display: grid; gap: 16px; }
@media (min-width: 900px) { .charts { grid-template-columns: 1fr 1fr; } .charts .wide { grid-column: 1 / -1; } }
.chart-card { padding: 16px; }
.chart-card h2 { margin-bottom: 2px; }
.chart-card p.hint { margin-bottom: 10px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .axis { font-size: 12px; fill: var(--muted); font-family: inherit; }
svg.chart .zero { stroke: var(--line-strong); stroke-width: 1; }
svg.chart rect.c1 { fill: var(--c1); } svg.chart rect.c2 { fill: var(--c2); }
svg.chart rect.c3 { fill: var(--c3); } svg.chart rect.c4 { fill: var(--c4); }
svg.chart rect { stroke: var(--surface); stroke-width: 1; }
svg.chart .ln { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
svg.chart .ln.l1 { stroke: var(--c2); } svg.chart .ln.l2 { stroke: var(--c1); } svg.chart .ln.l3 { stroke: var(--c4); stroke-dasharray: 5 4; }
svg.chart .dot.l1 { fill: var(--c2); } svg.chart .dot.l2 { fill: var(--c1); } svg.chart .dot.l3 { fill: var(--c4); }
.hbars { display: grid; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; }
.hbar-track { position: relative; height: 12px; border-radius: 999px; background: var(--g-100); margin-top: 4px; }
:root[data-theme="dark"] .hbar-track { background: var(--surface-2); }
.hbar-fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--primary); }
.hbar-avg { position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px; background: var(--c4); }
.hbar-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- cadastros ---------- */
.cad { display: grid; gap: 16px; }
.cad-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 4px 16px; }
.cad-list { padding: 0 8px 8px; }
.cad-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 56px; padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.cad-row:last-child { border-bottom: 0; }
.cad-row:hover { background: var(--surface-2); border-radius: 10px; }
.cad-row small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 80; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.toast[hidden] { display: none; }
@media (min-width: 900px) { .toast { bottom: 40px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- destaques por grupo ---------- */
.g-fixo { --gs: var(--gp-fixo); --gb: var(--gp-fixo-bg); }
.g-var { --gs: var(--gp-var); --gb: var(--gp-var-bg); }
.g-pj { --gs: var(--gp-pj); --gb: var(--gp-pj-bg); }
.g-terc { --gs: var(--gp-terc); --gb: var(--gp-terc-bg); }
.g-inv { --gs: var(--gp-inv); --gb: var(--gp-inv-bg); }
.g-div { --gs: var(--gp-div); --gb: var(--gp-div-bg); }
.block[class*="g-"] { border-left: 4px solid var(--gs); }
.grid tr.grp th.sticky { box-shadow: inset 4px 0 0 var(--gs); }
.grid tbody tr:not(.grp) td.sticky { background: color-mix(in srgb, var(--gb) 55%, var(--surface)); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--gs) 65%, transparent); }
.grid tfoot tr.tot th, .grid tfoot tr.tot td { background: var(--primary-soft); color: var(--on-primary-soft); font-weight: 800; border-top: 2px solid var(--primary); }

/* ---------- cartões ---------- */
.tabs.block-tabs { margin-bottom: 14px; }
.cart-sum, .cart-prev { padding: 16px; margin-bottom: 14px; }
.cart-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cart-total { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin: 6px 0 2px; }
.b-ok { background: var(--primary-soft); color: var(--on-primary-soft); }
.pbar { height: 10px; border-radius: 999px; background: var(--g-100); overflow: hidden; margin: 10px 0 6px; }
:root[data-theme="dark"] .pbar { background: var(--surface-2); }
.pbar span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width 0.4s var(--ease); }
.pbar.over span { background: var(--danger); }
.prev-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 12px; }
.sug { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line-strong); display: grid; gap: 6px; justify-items: start; }
.cart-actions { display: grid; gap: 8px; margin-bottom: 16px; }
@media (min-width: 480px) { .cart-actions { grid-template-columns: 1fr 1fr; } }
.imp-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; min-height: 60px; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.imp-row input { width: 22px; height: 22px; accent-color: var(--primary); }
input[type="file"] { width: 100%; min-height: 48px; padding: 10px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface); }

/* ---------- avatar / perfil / login ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 14px; object-fit: cover; }
.avatar.lg { width: 88px; height: 88px; font-size: 30px; flex: none; }
a.avatar-link { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
a.avatar-link:hover .avatar { box-shadow: 0 0 0 3px var(--primary-soft); }
.settings { display: grid; gap: 14px; }
.sec { padding: 16px; }
.sec h2 { margin-bottom: 12px; }
.profile-head { display: flex; align-items: center; gap: 16px; padding: 18px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 2px; top: 2px; }
input[type="email"], input[type="password"] { min-height: 48px; width: 100%; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); }
input[type="email"][aria-invalid="true"], input[type="password"][aria-invalid="true"] { border-color: var(--danger); }
a.btn { text-decoration: none; }
.link { min-height: 44px; padding: 0 8px; color: var(--primary); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
body[data-auth="out"] .shell, body[data-auth="out"] .fab { display: none; }
body[data-auth="in"] #auth { display: none; }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--hero-from), var(--hero-to)); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 28px; padding: 28px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; margin-bottom: 18px; }
.auth-theme { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; color: #fff; }
.auth-theme:hover { background: rgba(255, 255, 255, 0.15); }
.auth-note { margin-top: 14px; text-align: center; }
.onboard { padding: 22px; display: grid; gap: 10px; }
.onboard h1 { font-size: 22px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
fieldset.modes { border: 1.5px solid var(--line); border-radius: 12px; padding: 4px 14px 8px; }
fieldset.modes legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.check-field input[type="radio"] { width: 22px; height: 22px; accent-color: var(--primary); }
details.warns { margin-top: 12px; border: 1px solid var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 8px 14px; font-size: 14px; }
details.warns summary { cursor: pointer; font-weight: 700; min-height: 36px; display: flex; align-items: center; }
details.warns ul { list-style: disc; padding-left: 18px; margin: 4px 0 6px; }

/* ---------- rodapé da navbar (perfil + tema) ---------- */
.nav-foot { display: none; }
.nav-desk { display: none !important; }
.nav-theme { display: none; }
.nav-user .avatar { width: 26px; height: 26px; font-size: 11px; }
.nav-user-text { display: none; }
@media (min-width: 900px) {
  .brand-actions { display: none; }
  .nav-desk { display: flex !important; }
  .nav-more { display: none !important; }
  .nav-foot { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
  .nav-theme { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 14px; font-weight: 700; font-size: 15px; color: var(--muted); }
  .nav-theme:hover { background: var(--primary-soft); color: var(--on-primary-soft); }
  .nav-user { min-height: 60px !important; }
  .nav-user .avatar { width: 36px; height: 36px; font-size: 14px; }
  .nav-user-label { display: none; }
  .nav-user-text { display: grid; line-height: 1.25; min-width: 0; text-align: left; }
  .nav-user-text b { font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-user-text small { font-size: 12px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- uso compartilhado ---------- */
[hidden] { display: none !important; }
.entry-kind.owner { background: var(--gp-terc-bg); color: var(--ink); border: 1px solid var(--gp-terc); }
.who-list { margin-top: 6px; }
.who { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.who b { text-align: right; }
.who.tot { border-bottom: 0; border-top: 2px solid var(--line-strong); font-weight: 800; }
pre.msg { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: 15px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; max-height: 50dvh; overflow: auto; }
.imp-row select { margin-top: 6px; min-height: 40px; padding: 4px 10px; font-size: 14px; }

/* ---------- usuários / menu "Mais" ---------- */
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.more-list { margin-top: 4px; }
.more-item { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; }

/* ---------- investimentos / dashboard ---------- */
.cx-list { display: grid; gap: 12px; }
.cx-card { display: grid; gap: 6px; width: 100%; text-align: left; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--cx); border-radius: var(--radius); box-shadow: var(--shadow); }
.cx-card:hover { background: var(--surface-2); }
.cx-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cx-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--cx); flex: none; }
.cx-vals { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cx-vals b { font-size: 22px; letter-spacing: -0.01em; }
.cx-bar { margin: 2px 0; }
.cx-bar span { background: var(--cx, var(--primary)); }
.who.member { grid-template-columns: 1fr auto auto; }
.who-inline { padding: 0 12px 10px; }
.who-sel { min-height: 40px; padding: 4px 10px; font-size: 14px; }
.entry-wrap { border-bottom: 1px solid var(--line); }
.entry-wrap:last-child { border-bottom: 0; }
.entry-wrap .entry { border-bottom: 0; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { padding: 14px; display: grid; gap: 2px; }
.kpi b { font-size: 22px; letter-spacing: -0.01em; }
.sub-h { font-size: 14px; margin: 14px 0 8px; color: var(--ink-2); }
fieldset.checklist { border: 1.5px solid var(--line); border-radius: 12px; padding: 4px 14px 10px; }
fieldset.checklist legend { font-weight: 700; font-size: 14px; padding: 0 6px; }

.lbl-s { display: inline; } .lbl-l { display: none; }
@media (min-width: 900px) { .lbl-s { display: none; } .lbl-l { display: inline; } }

a.cad-row { text-decoration: none; color: inherit; }

/* ---------- caixinha compartilhada: indicativo claro ---------- */
.b-share { background: var(--gp-terc-bg); color: var(--ink); border: 1px solid var(--gp-terc); }
.cx-card.is-shared { border-color: var(--gp-terc); border-left-color: var(--cx); }
.cx-shared { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.avatars { display: inline-flex; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; border: 2px solid var(--surface); margin-left: -8px; }
.avatars .avatar.sm:first-child { margin-left: 0; }
.share-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 14px; border-radius: 14px; background: var(--gp-terc-bg); border: 1px solid var(--gp-terc); font-size: 14px; }
.share-banner > span:first-of-type { flex: 1; }
.share-banner .i { color: var(--gp-terc); }
.item-static { grid-template-columns: 1fr auto; padding-left: 8px; }

.hero.hero-danger { background: linear-gradient(135deg, #8c2018, #5f130e); }
:root[data-theme="dark"] .hero.hero-danger { background: linear-gradient(135deg, #6e1a14, #451009); }
.dv-card .pbar span { background: var(--primary); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(3, 1fr); } }

/* ---------- sincronização e importação de PDF ---------- */
.sync { font-size: 12px; color: var(--muted); margin-left: 4px; }
.sync.off { color: var(--danger); font-weight: 700; }
.pdf-resumo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pdf-resumo div { display: grid; }
.pdf-resumo b { font-size: 16px; }
.finais { display: grid; gap: 8px; margin-top: 6px; }
.final-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; font-weight: 700; }
.imp-row .pdf-cat { margin-top: 6px; min-height: 40px; padding: 4px 10px; font-size: 14px; }
