/* Gestão Doméstica — estilos do app (mobile first, claro/escuro automáticos). */

/* Tema único: fundo 100% preto + tons pastel.
   Superfícies levemente elevadas para separar cartões do fundo sem perder o preto. */
:root {
  --bg: #000000;
  --surface: #111114;
  --surface-2: #1c1c21;
  --text: #f5f3f7;
  --muted: #a3a1ad;
  --border: #26252c;

  /* Pastéis */
  --accent: #c3b5fd;          /* lavanda — ações principais */
  --accent-contrast: #000000; /* texto sobre pastel: sempre preto */
  --accent-soft: rgba(195, 181, 253, .14);
  --accent-2: #9fe3d2;        /* menta — segunda cor da marca */
  --peach: #ffc7a8;
  --butter: #fde6a2;
  --rose: #ffb3c7;
  --sky: #a9d6ff;
  --danger: #ff9fb0;          /* rosa-coral pastel */
  --ok: #9be7c4;              /* menta: receitas, sucesso */

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: none;
  --nav-h: 64px;
  --top-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
p { margin: .4rem 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Estrutura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--rose) 55%, var(--peach) 100%);
  -webkit-mask: none;
}
.brand-mark-lg { width: 48px; height: 48px; border-radius: 14px; display: block; margin-bottom: 12px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.nav-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600;
}
.nav-link.active { color: var(--accent); }
.nav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 8px; }

.content {
  max-width: 920px; margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom));
  outline: none;
}
.view { display: flex; flex-direction: column; gap: 14px; }
.view > * { margin-top: 0; margin-bottom: 0; }
.back { align-self: flex-start; }

@media (min-width: 900px) {
  #app.has-shell { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: var(--top-h) 1fr; min-height: 100vh; }
  .topbar { grid-column: 1 / -1; }
  .nav {
    position: sticky; top: var(--top-h); bottom: auto; height: calc(100vh - var(--top-h));
    display: flex; flex-direction: column; gap: 4px; padding: 16px 10px;
    border-top: 0; border-right: 1px solid var(--border); background: transparent;
  }
  .nav-link { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: .95rem; }
  .nav-link.active { background: var(--accent-soft); }
  .content { padding: 28px 28px 48px; width: 100%; }
}

/* ---------- Conta ---------- */
.account { position: relative; }
.account summary { list-style: none; cursor: pointer; }
.account summary::-webkit-details-marker { display: none; }
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--accent-contrast); font-weight: 700; font-size: .9rem;
}
.avatar-lg { width: 44px; height: 44px; font-size: 1.1rem; color: #000; flex: none; }
.account-menu {
  position: absolute; right: 0; top: 44px; min-width: 220px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; display: flex; flex-direction: column; gap: 6px;
}
.account-menu a { text-decoration: none; padding: 6px 4px; }
.account-name { font-weight: 650; margin: 0; }

/* ---------- Componentes ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .muted { margin: 2px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; text-decoration: none; font-weight: 600; margin-bottom: 4px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card-narrow { max-width: 440px; width: 100%; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cards-list { grid-template-columns: 1fr !important; }
@media (min-width: 700px) { .cards-list { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.stat-label { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat-value { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stat-soon .stat-value { color: var(--muted); }

.month-nav { display: flex; align-items: center; gap: 8px; }
.month-label { min-width: 170px; text-align: center; }

.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; }
.list-compact .list-row { padding: 6px 0; font-size: .9rem; }
.list-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-col { flex-direction: column; align-items: flex-start; gap: 0; }
.list-side { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; text-align: right; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; margin-right: 4px; }

.stack-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 4px 0 8px; }
.stack-bar span { display: block; height: 100%; }
.stack-bar span + span { border-left: 2px solid var(--surface); }

.badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-size: .72rem; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-muted { opacity: .7; }

.person { padding: 0; }
.person-link { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: inherit; text-decoration: none; }
.person-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.person-income { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.is-inactive { opacity: .6; }

.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; font-weight: 600; }

.tabs { align-self: flex-start; display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.tab { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 650; padding: 6px 16px; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.cat-tree { display: grid; gap: 10px; }
.cat { padding: 0; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; }
.cat-head::-webkit-details-marker { display: none; }
.cat[open] .cat-head { border-bottom: 1px solid var(--border); }
.cat .list, .cat > p { padding: 4px 16px 10px; }
.cat-head::after { content: '›'; color: var(--muted); font-size: 1.3rem; line-height: 1; transition: transform .15s; }
.cat[open] .cat-head::after { transform: rotate(90deg); }
.cat-head > .muted { margin-left: auto; }
.cat-actions { display: flex; justify-content: flex-end; padding: 10px 16px 14px; border-top: 1px solid var(--border); }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: inline-block; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: .9rem; font-weight: 600; }
.segment input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.segment input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.participants { display: grid; gap: 8px; }
.participant { display: flex; align-items: center; gap: 8px; }
.pct-wrap { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.pct { width: 90px !important; }

.empty { text-align: center; padding: 28px 12px; }
.empty-title { font-weight: 650; }
.loading, .boot { display: grid; place-items: center; gap: 10px; padding: 48px 16px; color: var(--muted); }
.boot { min-height: 70vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

.onboarding { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.onboarding h1 { margin-bottom: 4px; }
.noscript { padding: 24px; text-align: center; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-weight: 650; cursor: pointer;
  text-decoration: none; background: var(--surface-2); color: var(--text);
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-danger { background: var(--danger); color: #000; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger-text { color: var(--danger); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: .85rem; }
.btn-icon { min-height: 38px; width: 38px; padding: 0; font-size: 1.4rem; line-height: 1; }
.btn-block { width: 100%; }
.link { font-weight: 600; text-decoration: none; }

/* ---------- Formulários ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-weight: 600; font-size: .92rem; }
.req { color: var(--danger); }
input, select {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; /* evita zoom no iOS */
}
input[type=checkbox], input[type=radio] { width: 20px; min-height: 20px; height: 20px; padding: 0; accent-color: var(--accent); flex: none; }
input[type=color] { padding: 4px; height: 44px; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.field-check label { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.radio-group { display: grid; gap: 8px; }
.radio { display: flex; align-items: center; gap: 8px; }
.has-error input, .has-error select { border-color: var(--danger); }
.form-error { color: var(--danger); font-weight: 600; margin: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---------- Diálogo ---------- */
.dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto;
  border: 1px solid var(--border); border-radius: 18px; padding: 20px;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .7);
}
.dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
.dialog-head { margin-bottom: 12px; }
.dialog > input { margin: 8px 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 50; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.toast-error { background: var(--danger); color: #000; }
.toast-out { opacity: 0; transform: translateY(8px); }

/* =====================================================================
   Fase 2 — lançamentos, BI
   ===================================================================== */

/* Cores das séries dos gráficos: tons suaves, validados para daltonismo e
   contraste sobre as superfícies escuras (#111114). Nunca usadas em texto. */
:root { --series-1: #7092d0; --series-2: #c6805c; --status-warning: #fde6a2; --status-critical: #ff9fb0; }

/* Navegação: botão central "Lançar" em destaque */
.nav-primary { color: var(--accent); }
.nav-primary .icon { width: 38px; height: 38px; padding: 8px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); stroke-width: 2.4; }
.nav-primary.active .icon { box-shadow: 0 0 0 3px var(--accent-soft); }
@media (min-width: 900px) {
  .nav-primary { order: -1; background: var(--accent); color: var(--accent-contrast) !important; margin-bottom: 10px; }
  .nav-primary .icon { width: 22px; height: 22px; padding: 0; background: none; color: inherit; }
  .nav-primary.active { background: var(--accent) !important; }
}

/* Chips (escolhas por toque) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
}
.chip .dot { margin: 0; }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-on { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.chip-new { border-style: dashed; color: var(--accent); background: transparent; }
.chip-edit { display: inline-flex; gap: 6px; align-items: center; }
.chip-input { width: 170px !important; min-height: 38px !important; border-radius: 999px !important; padding: 4px 14px !important; }
.date-input { width: auto !important; min-height: 38px !important; border-radius: 999px !important; padding: 4px 14px !important; }
.date-input.chip-on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* Formulário de lançamento */
.card-form { max-width: 680px; }
.entry { display: grid; gap: 18px; }
.segmented-lg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.segment-btn { min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.segment-btn.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segment-btn.on.income { color: var(--ok); }
.amount-wrap { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; background: var(--surface); }
.amount-wrap:focus-within { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.amount-prefix { font-weight: 700; color: var(--muted); font-size: 1.2rem; }
.amount-input { border: 0 !important; outline: none !important; font-size: 1.9rem !important; font-weight: 700; min-height: 60px !important; padding: 0 !important; font-variant-numeric: tabular-nums; background: transparent !important; }
.split-details { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.split-details > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; font-weight: 600; }
.split-details > summary::-webkit-details-marker { display: none; }
.split-body { display: grid; gap: 14px; padding: 4px 14px 14px; border-top: 1px solid var(--border); }
.split-preview { margin: 0; padding: 0 14px 12px; }
.split-details[open] .split-preview { padding: 0; }
.has-error .amount-wrap, .has-error .split-details, .has-error .chips { outline: 2px solid var(--danger); outline-offset: 4px; border-radius: 12px; }
.entry-actions { display: flex; gap: 10px; flex-wrap: wrap; position: sticky; bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); background: var(--surface); padding-top: 8px; }
@media (min-width: 900px) { .entry-actions { bottom: 0; padding-bottom: 8px; } }
.btn-grow { flex: 1; }

/* Lista de lançamentos */
.totals-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.totals-strip > span { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-variant-numeric: tabular-nums; }
.amount-income { color: var(--ok); }
.filters { display: grid; gap: 10px; }
.filters-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filters-row .search { flex: 1 1 180px; }
.select-compact { flex: 0 1 220px; }
.tx-list { display: grid; gap: 12px; }
.tx-day { padding: 8px 16px; }
.tx-day-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 0 2px; }
.tx-row { padding: 6px 0; gap: 4px; }
.tx-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; padding: 6px 0; }
.tx-text { min-width: 0; flex: 1; }
.tx-text strong, .tx-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tx-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-del { color: var(--muted); border: 0; }
.tx-del .icon { width: 18px; height: 18px; }

/* Toast com ação */
.toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toast-info { background: var(--text); color: var(--bg); }
.toast-action { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; padding: 4px; }

/* Painel (BI) */
.dash { display: flex; flex-direction: column; gap: 14px; }
.alerts { display: grid; gap: 8px; }
.alert { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); font-weight: 600; }
.alert .icon { flex: none; }
.alert-warning .icon { color: var(--status-warning); }
.alert-critical .icon { color: var(--status-critical); }
.alert-info .icon { color: var(--accent); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); min-width: 0; }
.kpi-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kpi-value { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.kpi-hero { grid-column: 1 / -1; }
.kpi-hero .kpi-value { font-size: 2.6rem; line-height: 1.1; letter-spacing: -.01em; }
@media (min-width: 900px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-hero { grid-column: 1 / span 2; grid-row: span 2; justify-content: center; }
  .kpi-hero .kpi-value { font-size: 3rem; }
}
.dash-grid { display: grid; gap: 14px; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.sub-title { font-size: .9rem; margin: 16px 0 6px; color: var(--muted); }
.settle { font-size: 1.05rem; margin: 0 0 10px; }

.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bar-item { display: grid; gap: 4px; width: 100%; padding: 8px 0; text-align: left; background: none; border: 0; color: inherit; font: inherit; }
.bar-button { cursor: pointer; border-radius: 8px; }
.bar-button:hover .bar-track { background: color-mix(in srgb, var(--series-1) 12%, var(--surface-2)); }
.bar-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bar-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.bar-label { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; min-width: 0; }
.bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.bar-track { display: block; height: 12px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.bar-fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.bar-hint { font-size: .8rem; }
.bar-list-compact .bar-item { padding: 5px 0; }
.bar-list-compact .bar-track { height: 8px; }
.bar-list-compact .bar-label, .bar-list-compact .bar-value { font-weight: 500; font-size: .92rem; }
.bar-children { margin: 2px 0 10px 16px; padding-left: 12px; border-left: 2px solid var(--border); display: grid; gap: 6px; }

.chart-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .88rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-plot { width: 100%; min-height: 220px; }
.chart-svg { display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .axis-base { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.chart-svg .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-svg .hit { fill: transparent; }
.chart-svg .hit.hit-on { fill: var(--text); fill-opacity: .06; }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0; }
.chart-tip {
  position: fixed; z-index: 60; pointer-events: none; min-width: 150px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .6); padding: 8px 10px; font-size: .85rem; display: grid; gap: 3px;
}
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.tip-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--muted); font-weight: 600; }

/* Categorias: inclusão direta */
.inline-add { display: flex; gap: 8px; padding: 6px 16px 12px; }
.inline-add input { min-height: 38px; }

/* Casa: atalhos */
.shortcuts { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.shortcut { display: grid; gap: 2px; text-decoration: none; color: inherit; }
.shortcut:hover { border-color: var(--accent); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 480px) { .data-table { font-size: .82rem; } .data-table th, .data-table td { padding: 6px 4px; } }
/* Evita que textos longos alarguem a página no celular (grid/flex min-width:auto). */
.view > *, .tx-list > *, .dash > *, .dash-grid > *, .kpis > * { min-width: 0; }
.entry-actions { border-top: 1px solid var(--border); margin: 0 -16px -16px; padding: 10px 16px 14px; border-radius: 0 0 var(--radius) var(--radius); }
.totals-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.totals-strip > span { min-width: 0; }
.totals-strip strong { overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .totals-strip strong { font-size: .92rem; }
  .props { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .props dd { margin-bottom: 8px; overflow-wrap: anywhere; }
}

/* =====================================================================
   Página de entrada (fora do app) — body.landing
   ===================================================================== */
.landing {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: #000; overflow-x: hidden; position: relative;
}
.l-aura { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.l-aura span { position: absolute; border-radius: 50%; opacity: .5; animation: l-drift 26s ease-in-out infinite alternate; }
.l-aura span:nth-child(1) { width: 62vmax; height: 62vmax; left: -22vmax; top: -26vmax; background: radial-gradient(circle, rgba(195, 181, 253, .30), transparent 62%); }
.l-aura span:nth-child(2) { width: 54vmax; height: 54vmax; right: -24vmax; top: 18vh; background: radial-gradient(circle, rgba(255, 179, 199, .20), transparent 62%); animation-duration: 32s; }
.l-aura span:nth-child(3) { width: 50vmax; height: 50vmax; left: 18vw; bottom: -32vmax; background: radial-gradient(circle, rgba(159, 227, 210, .18), transparent 62%); animation-duration: 38s; }
@keyframes l-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(3vmax, 2vmax, 0) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .l-aura span { animation: none; } }

.l-top, .l-main, .l-foot { position: relative; z-index: 1; }
.l-top { padding: 22px clamp(16px, 5vw, 56px); }
.l-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .01em; }
.l-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; }

.l-main {
  flex: 1; width: 100%; max-width: 1160px; margin: 0 auto;
  display: grid; gap: 40px; align-items: center;
  padding: 12px clamp(16px, 5vw, 56px) 40px;
}
@media (min-width: 960px) { .l-main { grid-template-columns: minmax(0, 1.15fr) minmax(380px, 460px); gap: 72px; } }

.l-eyebrow { margin: 0 0 14px; font-size: .74rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.l-hero h1 {
  margin: 0; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;
  font-weight: 500; font-size: clamp(2.3rem, 5.4vw, 4.1rem); line-height: 1.04; letter-spacing: -.02em; color: var(--text);
  text-wrap: balance;
}
.l-hero h1 em {
  font-style: italic; display: inline;
  background: linear-gradient(95deg, var(--accent) 0%, var(--rose) 50%, var(--peach) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.l-lede { margin: 22px 0 0; max-width: 36ch; font-size: clamp(1.02rem, 1.6vw, 1.18rem); line-height: 1.6; color: var(--muted); }
.l-points { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 12px; color: var(--muted); }
.l-points strong { color: var(--text); font-weight: 600; }
.l-points li { display: flex; align-items: baseline; gap: 12px; }
.l-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.l-dot-lavender { background: var(--accent); box-shadow: 0 0 14px rgba(195, 181, 253, .7); }
.l-dot-mint { background: var(--accent-2); box-shadow: 0 0 14px rgba(159, 227, 210, .6); }
.l-dot-peach { background: var(--peach); box-shadow: 0 0 14px rgba(255, 199, 168, .6); }

.l-card {
  background: rgba(17, 17, 20, .72); border: 1px solid rgba(255, 255, 255, .08); border-radius: 26px;
  padding: clamp(22px, 4vw, 34px); box-shadow: 0 30px 80px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .04);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.l-card h2 { font-size: 1.35rem; font-weight: 650; margin: 0 0 20px; letter-spacing: -.01em; }

.l-options > input[type=radio] { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.l-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 22px; }
.l-tab {
  display: grid; gap: 2px; align-content: start; padding: 12px 12px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .02); transition: border-color .2s, background .2s;
}
.l-tab:hover { border-color: #3a3842; }
.l-tab-title { font-weight: 650; font-size: .9rem; line-height: 1.25; }
.l-tab-sub { font-size: .76rem; color: var(--muted); }
#l-opt-login:checked ~ .l-tabs [for=l-opt-login],
#l-opt-invite:checked ~ .l-tabs [for=l-opt-invite],
#l-opt-first:checked ~ .l-tabs [for=l-opt-first] { border-color: var(--accent); background: var(--accent-soft); }
#l-opt-login:focus-visible ~ .l-tabs [for=l-opt-login],
#l-opt-invite:focus-visible ~ .l-tabs [for=l-opt-invite],
#l-opt-first:focus-visible ~ .l-tabs [for=l-opt-first] { outline: 2px solid var(--accent); outline-offset: 2px; }
.l-panel { display: none; animation: l-in .25s ease; }
#l-opt-login:checked ~ .l-panel-login,
#l-opt-invite:checked ~ .l-panel-invite,
#l-opt-first:checked ~ .l-panel-first { display: block; }
@keyframes l-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .l-panel { animation: none; } }
.l-panel > p { margin: 0 0 14px; color: var(--muted); }

.l-form { display: grid; gap: 14px; }
.l-field { display: grid; gap: 6px; }
.l-field > span { font-size: .84rem; font-weight: 600; color: var(--muted); }
.l-field input {
  min-height: 50px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: #0a0a0c; color: var(--text); font: inherit; font-size: 16px;
}
.l-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(195, 181, 253, .16); }
.l-check { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--muted); }
.l-check input { width: 18px; height: 18px; min-height: 18px; accent-color: var(--accent); }

.l-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 52px; padding: 0 22px; border-radius: 14px; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; transition: transform .15s, filter .2s;
}
.l-btn-primary { background: linear-gradient(100deg, var(--accent) 0%, #d9c7ff 50%, var(--rose) 100%); color: #000; }
.l-btn-primary:hover { filter: brightness(1.06); }
.l-btn-primary:active { transform: translateY(1px); }
.l-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.l-subtle { justify-self: center; font-size: .88rem; color: var(--muted); }
.l-subtle:hover { color: var(--text); }
.l-error { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 159, 176, .1); border: 1px solid rgba(255, 159, 176, .35); color: var(--danger); font-weight: 600; font-size: .92rem; }
.l-form .l-error { margin: 0; }
.l-note { color: var(--muted); font-size: .92rem; margin: 14px 0 0; }
.l-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; font-size: .92rem; }
.l-links a { color: var(--muted); }
.l-links a:hover { color: var(--text); }
.l-card > .l-btn { margin-top: 4px; }

.l-steps { margin: 0 0 20px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.l-steps li { counter-increment: s; display: flex; gap: 12px; align-items: baseline; color: var(--text); }
.l-steps li::before {
  content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: .8rem; font-weight: 700; color: #000; background: var(--accent-2); transform: translateY(-1px);
}

.l-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px;
  padding: 18px clamp(16px, 5vw, 56px) 26px; color: #6f6d78; font-size: .82rem;
}
@media (max-width: 420px) { .l-tab { padding: 10px 8px; } .l-tab-title { font-size: .82rem; } }

/* Tema preto: seleções em pastel (o "cartão sobre cartão" some no escuro). */
.segment-btn.on { background: var(--accent); color: #000; }
.segment-btn.on.income { background: var(--ok); color: #000; }
.tab.active { background: var(--accent-soft); color: var(--accent); }
.topbar { background: rgba(0, 0, 0, .82); }
.nav { background: #000; }
.kpi-hero .kpi-value { background: linear-gradient(95deg, var(--text) 30%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
