/* =========================================================================
   Meu Caderno — organizador pessoal.
   Visual: base clara e neutra, cartões arredondados e uma cor por área
   (Hoje laranja, Agenda azul, Cotidiano verde, Finanças violeta).
   ========================================================================= */

:root {
  color-scheme: light;
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --surface-3: #f0eeea;
  --ink: #17161c;
  --ink-2: #4b4a55;
  --muted: #85838f;
  --line: #e9e6e1;
  --line-strong: #d9d5ce;

  /* áreas: cor viva (ícones, faixas) e cor de ação (botões, texto) */
  /* mesma luminosidade e saturação, só o tom muda: as quatro cores combinam entre si */
  --sec-hoje: oklch(66% 0.11 50);       --acc-hoje: oklch(51% 0.11 45);
  --sec-agenda: oklch(64% 0.09 245);    --acc-agenda: oklch(50% 0.10 250);
  --sec-cotidiano: oklch(64% 0.09 165); --acc-cotidiano: oklch(50% 0.09 165);
  --sec-financas: oklch(62% 0.10 305);  --acc-financas: oklch(50% 0.11 305);
  --sec-ajustes: oklch(62% 0.015 70);   --acc-ajustes: oklch(48% 0.015 70);
  --sec: var(--sec-hoje);
  --accent: var(--acc-hoje);
  --accent-ink: #ffffff;
  --soft-pct: 13%;
  --hover-mix: #000;

  --pos: oklch(50% 0.10 160);
  --neg: oklch(53% 0.14 32);
  --warn: #9a5b00;
  --pos-soft: #e3f4ea;
  --neg-soft: #fbe6e0;
  --warn-soft: #fbf0d9;
  --good: oklch(64% 0.11 160);
  --warning: #f5a524;
  --critical: oklch(58% 0.17 30);
  --grid: #ece9e4;
  --axis: #d3cec6;
  /* paleta categórica dos gráficos (ordem fixa) */
  --s1: oklch(56% 0.12 250); --s2: oklch(62% 0.13 42); --s3: oklch(60% 0.11 165); --s4: oklch(74% 0.12 80);
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;

  --shadow-sm: 0 1px 2px rgba(23, 22, 28, .05);
  --shadow: 0 1px 2px rgba(23, 22, 28, .04), 0 6px 20px -10px rgba(23, 22, 28, .12);
  --shadow-lg: 0 24px 60px -18px rgba(23, 22, 28, .32);
  --r: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --side-w: 248px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101218; --surface: #171a22; --surface-2: #1b1f28; --surface-3: #232834;
    --ink: #eef0f5; --ink-2: #b6bac7; --muted: #7f8597; --line: #252a35; --line-strong: #343a48;
    --sec-hoje: oklch(72% 0.10 50);       --acc-hoje: oklch(78% 0.09 50);
    --sec-agenda: oklch(70% 0.09 245);    --acc-agenda: oklch(78% 0.08 245);
    --sec-cotidiano: oklch(72% 0.09 165); --acc-cotidiano: oklch(79% 0.08 165);
    --sec-financas: oklch(70% 0.10 305);  --acc-financas: oklch(78% 0.09 305);
    --sec-ajustes: oklch(70% 0.015 70);   --acc-ajustes: oklch(80% 0.015 70);
    --accent-ink: #0d0f14;
    --soft-pct: 16%;
    --hover-mix: #fff;
    --pos: #4fd59d; --neg: #ff8a70; --warn: #f2b84b;
    --pos-soft: #16302a; --neg-soft: #3a211d; --warn-soft: #362c16;
    --grid: #232835; --axis: #363d4c;
    --s1: oklch(68% 0.11 250); --s2: oklch(70% 0.12 42); --s3: oklch(70% 0.10 165); --s4: oklch(78% 0.11 80);
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .75);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101218; --surface: #171a22; --surface-2: #1b1f28; --surface-3: #232834;
  --ink: #eef0f5; --ink-2: #b6bac7; --muted: #7f8597; --line: #252a35; --line-strong: #343a48;
  --sec-hoje: oklch(72% 0.10 50);       --acc-hoje: oklch(78% 0.09 50);
  --sec-agenda: oklch(70% 0.09 245);    --acc-agenda: oklch(78% 0.08 245);
  --sec-cotidiano: oklch(72% 0.09 165); --acc-cotidiano: oklch(79% 0.08 165);
  --sec-financas: oklch(70% 0.10 305);  --acc-financas: oklch(78% 0.09 305);
  --sec-ajustes: oklch(70% 0.015 70);   --acc-ajustes: oklch(80% 0.015 70);
  --accent-ink: #0d0f14;
  --soft-pct: 16%;
  --hover-mix: #fff;
  --pos: #4fd59d; --neg: #ff8a70; --warn: #f2b84b;
  --pos-soft: #16302a; --neg-soft: #3a211d; --warn-soft: #362c16;
  --grid: #232835; --axis: #363d4c;
  --s1: oklch(68% 0.11 250); --s2: oklch(70% 0.12 42); --s3: oklch(70% 0.10 165); --s4: oklch(78% 0.11 80);
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .75);
}

/* cor da área aberta (as misturas são calculadas no body para seguir a área) */
body {
  --accent-soft: color-mix(in srgb, var(--sec) var(--soft-pct), var(--surface));
  --accent-hover: color-mix(in srgb, var(--accent) 86%, var(--hover-mix));
}
body[data-section="hoje"] { --sec: var(--sec-hoje); --accent: var(--acc-hoje); }
body[data-section="agenda"] { --sec: var(--sec-agenda); --accent: var(--acc-agenda); }
body[data-section="cotidiano"] { --sec: var(--sec-cotidiano); --accent: var(--acc-cotidiano); }
body[data-section="financas"] { --sec: var(--sec-financas); --accent: var(--acc-financas); }
body[data-section="ajustes"] { --sec: var(--sec-ajustes); --accent: var(--acc-ajustes); }
[data-section="hoje"] { --c: var(--sec-hoje); }
[data-section="agenda"] { --c: var(--sec-agenda); }
[data-section="cotidiano"] { --c: var(--sec-cotidiano); }
[data-section="financas"] { --c: var(--sec-financas); }
[data-section="ajustes"] { --c: var(--sec-ajustes); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 0;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 18px; height: 18px; flex: none; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.mt { margin-top: 10px; }
code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link .ic { width: 15px; height: 15px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, color .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--sec) 20%, var(--surface)); }
.btn-soft.is-done, .btn-primary.is-done { background: var(--pos-soft); color: var(--pos); }
.btn-danger { background: var(--critical); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-danger-ghost { background: transparent; border-color: color-mix(in srgb, var(--neg) 40%, transparent); color: var(--neg); }
.btn-danger-ghost:hover { background: var(--neg-soft); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; gap: 6px; border-radius: 10px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-icon-only { width: 40px; padding: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s;
  font-size: 18px; font-weight: 700; flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover { background: var(--neg-soft); color: var(--neg); }
.icon-btn .ic { width: 17px; height: 17px; }

/* ---------- menu lateral ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 20;
  display: flex; flex-direction: column; gap: 22px; padding: 22px 14px 16px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; padding: 0 8px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--ink);
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: var(--bg); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -.03em; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 13px;
  text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav-ic {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: var(--c); transition: background .15s, color .15s;
}
.nav-ic .ic { width: 17px; height: 17px; stroke-width: 2; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.on { background: color-mix(in srgb, var(--c) 10%, var(--surface)); color: var(--ink); }
.nav a.on .nav-ic { background: var(--c); color: #fff; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--c) 70%, transparent); }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 6px 0 10px; border-top: 1px solid var(--line); }
.save-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.save-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.save-state.is-saving i { background: var(--warning); animation: pulse 1s infinite; }
.save-state.is-error { color: var(--neg); }
.save-state.is-error i { background: var(--critical); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- página ---------- */
.shell { margin-left: var(--side-w); min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 26px 32px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { min-width: 0; }
.kicker { margin: 0 0 2px; font-size: 13px; font-weight: 700; color: var(--accent); }
.kicker::first-letter { text-transform: uppercase; }
.kicker:empty { display: none; }
.page-head h1 { font-weight: 800; font-size: 32px; letter-spacing: -.035em; }
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.month-switch { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 3px; box-shadow: var(--shadow-sm); }
.month-switch #month-label { min-width: 150px; text-align: center; font-weight: 700; font-size: 14.5px; }
.month-switch .btn-sm { height: 32px; margin-left: 2px; }
.main { min-height: 50vh; }
.loading { display: flex; gap: 6px; justify-content: center; padding: 80px 0; }
.loading span { width: 9px; height: 9px; border-radius: 50%; background: var(--sec); animation: pulse 1s infinite; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }

/* ---------- painéis ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 22px; box-shadow: var(--shadow-sm); margin-bottom: 18px; min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 9px; min-width: 0; }
.panel-head h2 .ic { width: 18px; height: 18px; color: var(--sec); }
.head-meta { display: inline-flex; align-items: center; gap: 8px; }
.panel-alert { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface)); }
.panel-alert h2 .ic { color: var(--warn); }
.mini-title { display: flex; align-items: center; gap: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 800; margin: 18px 0 8px; }
.split { display: grid; grid-template-columns: 1fr; gap: 24px; }
.split:has(> div + div) { grid-template-columns: 1.4fr 1fr; }
.split .mini-title:first-child { margin-top: 0; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 18px; align-items: start; }
.col { min-width: 0; }
.empty-inline { color: var(--muted); font-size: 14px; margin: 4px 0; }

/* ---------- destaque do topo (hero) ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 28px; align-items: center;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--sec) 20%, transparent) 0%, transparent 55%),
    radial-gradient(90% 120% at 0% 100%, color-mix(in srgb, var(--sec) 12%, transparent) 0%, transparent 60%),
    color-mix(in srgb, var(--sec) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--sec) 22%, var(--line));
  border-radius: 24px; padding: 28px 30px; margin-bottom: 18px; position: relative; overflow: hidden;
}
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: var(--accent); margin: 0 0 6px; }
.hero-num { font-size: clamp(32px, 4.6vw, 46px); font-weight: 800; letter-spacing: -.04em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hero-num small { font-size: .42em; color: var(--muted); font-weight: 700; letter-spacing: 0; }
.hero-num.neg { color: var(--neg); }
.hero-sub { margin: 10px 0 0; color: var(--ink-2); font-size: 14.5px; font-weight: 500; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; position: relative; z-index: 1; }
.stat {
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid color-mix(in srgb, var(--sec) 14%, var(--line));
  border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
}
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.stat-label .ic { width: 15px; height: 15px; color: var(--sec); }
.stat b { font-size: 19px; font-weight: 800; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.02em; }
.stat small { font-size: 12px; color: var(--muted); font-weight: 500; }
.hero-compact .hero-main .bar { margin-top: 14px; background: color-mix(in srgb, var(--sec) 15%, var(--surface)); }

/* ---------- boas-vindas ---------- */
.welcome { max-width: 760px; margin: 20px auto; text-align: center; }
.welcome h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; letter-spacing: -.04em; margin: 6px 0 14px; }
.welcome .eyebrow { opacity: 1; }
.lead { font-size: 17px; color: var(--ink-2); max-width: 600px; margin: 0 auto 28px; }
.welcome-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.step-card {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px;
  cursor: pointer; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-sm); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.step-card:hover { transform: translateY(-2px); border-color: var(--sec); box-shadow: var(--shadow); }
.step-card .n { width: 30px; height: 30px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; margin-bottom: 8px; }
.step-card small { color: var(--muted); }

/* ---------- gráficos ---------- */
.chart { position: relative; }
.chart-plot { position: relative; overflow: hidden; }
.chart-svg { display: block; max-width: 100%; height: auto; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis { stroke: var(--axis); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-svg .tick-strong { fill: var(--ink); font-weight: 700; }
.chart-svg .band { fill: var(--surface-3); opacity: .7; }
.chart-svg .hit { cursor: pointer; }
.chart-svg .hit.on { fill: color-mix(in srgb, var(--ink) 4%, transparent) !important; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; font-weight: 600; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.tip {
  position: absolute; z-index: 2; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; box-shadow: var(--shadow-lg); min-width: 180px;
}
.tip strong { display: block; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row i { width: 8px; height: 8px; border-radius: 2px; }
.tip-row span { flex: 1; color: var(--ink-2); }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }

.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rank-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 5px; }
.rank-label { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.rank-val small { color: var(--muted); font-weight: 600; margin-left: 6px; }
.rank-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.rank-fill { height: 100%; background: var(--s2); border-radius: 99px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.bar > div { height: 100%; background: var(--sec); border-radius: 99px; transition: width .4s ease; }
.bar.ok > div { background: var(--good); }
.bar.warn > div { background: var(--warning); }
.bar.over > div { background: var(--critical); }

/* ---------- listas laterais ---------- */
.acc-mini, .card-mini, .mini-list, .due-list { list-style: none; margin: 0; padding: 0; }
.acc-mini li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.acc-mini li:last-child { border-bottom: 0; }
.acc-mini li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.acc-mini li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc-mini li .ic { width: 16px; height: 16px; color: var(--muted); }
.acc-mini .pay-date { flex: 0 0 auto; color: var(--muted); font-weight: 600; font-size: 13px; }
.card-mini li, .mini-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.card-mini li:last-child, .mini-list li:last-child { border-bottom: 0; }
.mini-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.mini-row > span { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.mini-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-mini small, .mini-list small { font-size: 12.5px; }
.due-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.due-list li:last-child { border-bottom: 0; }
.due-date { width: 46px; height: 50px; border-radius: 13px; background: var(--surface-3); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex: none; }
.due-date b { font-size: 19px; font-weight: 800; }
.due-date small { font-size: 10.5px; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-top: 3px; }
.due-list li.soon .due-date { background: var(--warn-soft); color: var(--warn); }
.due-list li.late .due-date { background: var(--neg-soft); color: var(--neg); }
.due-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.due-info span { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-info small { color: var(--muted); font-size: 12.5px; }
.due-list li.late .due-info small { color: var(--neg); font-weight: 600; }
.due-val { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.due-val b { font-variant-numeric: tabular-nums; font-size: 14px; }
.due-val .btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }

/* ---------- lançamentos ---------- */
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx { display: flex; align-items: center; gap: 14px; padding: 11px 8px; border-radius: 12px; transition: background .12s; }
.tx + .tx { border-top: 1px solid var(--line); }
.tx:hover { background: var(--surface-2); }
.tx-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tx-ico-pos { background: var(--pos-soft); color: var(--pos); }
.tx-ico-neg { background: var(--neg-soft); color: var(--neg); }
.tx-ico-neutral { background: var(--surface-3); color: var(--ink-2); }
.tx-main { flex: 1; min-width: 0; }
.tx-desc { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tx-owner, .tx-note, .tx-fee { display: inline-flex; align-items: center; gap: 3px; }
.tx-owner .ic, .tx-note .ic, .tx-fee .ic { width: 13px; height: 13px; }
.tx-val { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; font-size: 15px; }
.tx-val.neutral { color: var(--ink-2); }
.tx-inst { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.tx-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.tx:hover .tx-actions, .tx:focus-within .tx-actions { opacity: 1; }
@media (hover: none) { .tx-actions { opacity: 1; } }
.chip {
  --chip: var(--muted);
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--chip) 13%, transparent); color: var(--ink-2); white-space: nowrap;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--chip); }
.chip-neutral { background: var(--surface-3); padding: 1px 9px; }
.chip-neutral::before { display: none; }

.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.search { position: relative; }
.search .ic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 46px; padding: 0 16px 0 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); font-size: 15px; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select { height: 36px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); padding: 0 30px 0 12px; font-size: 13.5px; font-weight: 600; max-width: 220px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 0 4px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.sum-strip { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); margin-bottom: 8px; overflow: hidden; }
.sum-strip > div { padding: 12px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.sum-strip > div:last-child { border-right: 0; }
.sum-strip span { font-size: 11.5px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.sum-strip b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-groups { display: grid; gap: 14px; margin-top: 16px; }
.day { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 12px; box-shadow: var(--shadow-sm); }
.day > header { display: flex; justify-content: space-between; align-items: center; padding: 10px 8px 8px; border-bottom: 1px solid var(--line); }
.day > header h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 800; }
.day > header h3 small { color: var(--muted); }
.day > header span { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 50px 20px; background: var(--surface); border: 1.5px dashed var(--line-strong); border-radius: var(--r); margin-top: 16px; }
.empty-art { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-art .ic { width: 30px; height: 30px; }
.empty h3 { font-size: 21px; font-weight: 800; }
.empty p { color: var(--ink-2); max-width: 420px; margin: 6px auto 18px; }

/* ---------- contas ---------- */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 8px 0 14px; flex-wrap: wrap; }
.section-head h2 { font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.section-head p { margin: 2px 0 0; font-size: 14px; }
.section-head + .acc-grid, .section-head + .cc-grid, .section-head + .empty-box { margin-bottom: 34px; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.acc {
  --acc: var(--accent);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 18px 14px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden; display: flex; flex-direction: column;
}
.acc::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 4px; border-radius: 0 0 4px 4px; background: var(--acc); }
.acc header { display: flex; justify-content: space-between; align-items: center; margin: -6px -6px 0 0; }
.acc-fees { margin: -2px 0 6px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.acc-fees .ic { width: 13px; height: 13px; flex-shrink: 0; }
.acc-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; color: var(--muted); }
.acc-actions { display: flex; }
.acc-actions .icon-btn { width: 30px; height: 30px; }
.acc h3 { font-size: 16.5px; font-weight: 800; margin: 2px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-bal { font-size: 28px; font-weight: 800; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.acc footer { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.acc-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.acc-quick .btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.is-archived { opacity: .62; }
.empty-box { background: var(--surface); border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.empty-box p { margin: 0; color: var(--ink-2); }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.cc-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); overflow: hidden; }
.cc {
  --cc: #6250d6;
  margin: 12px; border-radius: 17px; padding: 16px 18px; color: #fff; aspect-ratio: 1.75; min-height: 170px;
  display: grid; grid-template-rows: auto 1fr auto auto; position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cc) 88%, #fff) 0%, var(--cc) 45%, color-mix(in srgb, var(--cc) 62%, #000) 100%);
  box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--cc) 80%, #000);
}
.cc::after { content: ''; position: absolute; width: 240px; height: 240px; border-radius: 50%; right: -90px; bottom: -130px; border: 38px solid rgba(255, 255, 255, .09); }
.cc-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.cc-name { font-weight: 800; font-size: 16px; text-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.acc-actions.on-dark .icon-btn { color: rgba(255, 255, 255, .85); }
.acc-actions.on-dark .icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.cc-chip { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #f6dd9a, #c9a24a); margin-top: 6px; opacity: .9; }
.cc-avail { display: flex; flex-direction: column; position: relative; z-index: 1; }
.cc-avail small { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; opacity: .85; font-weight: 700; }
.cc-avail b { font-size: 25px; font-weight: 800; line-height: 1.1; letter-spacing: -.03em; }
.cc-days { display: flex; justify-content: space-between; font-size: 12px; opacity: .88; margin-top: 6px; font-weight: 600; position: relative; z-index: 1; }
.cc-info { padding: 4px 20px 16px; }
.archived { margin-top: 10px; }
.archived summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: 8px 0; }
.archived .acc-grid, .archived .cc-grid { margin-bottom: 18px; }

/* ---------- faturas ---------- */
.card-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 16px; scrollbar-width: thin; }
.card-tab {
  --cc: var(--accent);
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; white-space: nowrap; font-weight: 700; box-shadow: var(--shadow-sm); transition: border-color .15s;
}
.card-tab i { width: 12px; height: 12px; border-radius: 4px; background: var(--cc); }
.card-tab b { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13.5px; }
.card-tab.on { border-color: var(--cc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cc) 28%, transparent); }
.bill-head {
  --cc: var(--accent);
  display: grid; grid-template-columns: 1.1fr 1.4fr auto; gap: 24px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px 26px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.bill-head::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--cc); }
.bill-title h2 { font-size: 15px; color: var(--ink-2); margin: 8px 0 2px; font-weight: 700; }
.bill-total { font-size: 38px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bill-title p { margin: 2px 0 0; font-size: 14px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-aberta { background: color-mix(in srgb, var(--s1) 14%, transparent); color: var(--s1); }
.status-fechada { background: var(--warn-soft); color: var(--warn); }
.status-vencida { background: var(--neg-soft); color: var(--neg); }
.status-paga { background: var(--pos-soft); color: var(--pos); }
.status-vazia { background: var(--surface-3); color: var(--muted); }
.bill-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 20px; margin: 0; }
.bill-facts div { border-left: 2px solid var(--line); padding-left: 12px; }
.bill-facts dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.bill-facts dd { margin: 0; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.bill-cta { display: flex; flex-direction: column; gap: 8px; }
.timeline { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.tl { background: transparent; border: 1px solid transparent; border-radius: 12px; padding: 8px 2px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; transition: background .15s; }
.tl:hover { background: var(--surface-2); }
.tl.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--sec) 40%, transparent); }
.tl-bar { width: 22px; height: 64px; display: flex; align-items: flex-end; background: var(--surface-3); border-radius: 7px; overflow: hidden; }
.tl-bar span { width: 100%; background: var(--s7); border-radius: 5px 5px 0 0; }
.tl-paga .tl-bar span { background: color-mix(in srgb, var(--s7) 45%, var(--surface-3)); }
.tl small { font-size: 11px; color: var(--muted); font-weight: 800; text-transform: uppercase; }
.tl b { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tl-vencida small { color: var(--neg); }
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 800; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tfoot td { font-weight: 800; border-bottom: 0; padding-top: 12px; }
.table .r { text-align: right; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.table .icon-btn { width: 28px; height: 28px; }

/* ---------- metas ---------- */
.bud-list { list-style: none; margin: 0; padding: 0; }
.bud { padding: 12px 0; border-bottom: 1px solid var(--line); }
.bud:last-child { border-bottom: 0; }
.bud-top { display: flex; align-items: center; gap: 12px; }
.bud-name { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 0; }
.bud-nums { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.bud-nums small { color: var(--muted); font-weight: 600; }
.bud-none .bud-nums { color: var(--muted); }
.bud-left { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.bud-left.neg { color: var(--neg); }

/* ---------- ajustes ---------- */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 0 18px; align-items: start; }
.settings .panel-wide { grid-column: 1 / -1; }
.owner-list, .cat-list { list-style: none; margin: 0 0 12px; padding: 0; }
.owner-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.owner-list li > span:first-child { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.owner-list .ic { width: 16px; height: 16px; color: var(--muted); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; height: 40px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0 14px; }
.inline-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cat-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cat-list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cat-list li small.muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path { display: block; padding: 10px 12px; margin: 6px 0 10px; word-break: break-all; }
.stats-line { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); margin: 12px 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.danger-zone { padding-top: 14px; margin-top: 16px; border-top: 1px solid var(--line); }

/* ---------- modal ---------- */
dialog.modal {
  border: 0; padding: 0; background: transparent; max-width: min(580px, calc(100vw - 24px)); width: 100%;
  max-height: calc(100vh - 40px); color: var(--ink); animation: pop .18s ease;
}
dialog.modal.modal-sm { max-width: min(440px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(16, 15, 22, .42); backdrop-filter: blur(4px); animation: fade .18s ease; }
dialog.modal.closing { animation: popout .14s ease forwards; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes popout { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.modal-box { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 40px); border: 1px solid var(--line); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 6px 24px; }
.modal-head h2 { font-weight: 800; font-size: 20px; letter-spacing: -.03em; }
.modal-body { padding: 12px 24px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 24px 20px; border-top: 1px solid var(--line); margin-top: 6px; flex-wrap: wrap; }
.confirm-text { margin: 0; color: var(--ink-2); line-height: 1.6; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .amount-field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field label small { font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea, .notes textarea {
  width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 0 14px; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.field textarea, .notes textarea { height: auto; padding: 10px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .notes textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input:disabled, .field select:disabled { background: var(--surface-3); color: var(--muted); }
.field.is-disabled { opacity: .5; }
.field .input-lg { height: 50px; font-size: 17px; font-weight: 700; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hint b { color: var(--ink-2); }
.amount-field { display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; }
.amount-field input { border: 0; background: transparent; padding: 0; height: auto; width: 100%; }
.amount-field input:focus { outline: none; }
.money-big { font-size: 34px !important; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
form[data-type="expense"] .money-big { color: var(--neg); }
form[data-type="income"] .money-big { color: var(--pos); }
.amount-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: grid; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 14px; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-2 { grid-template-columns: repeat(2, 1fr); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: background .15s, color .15s; text-align: center; padding: 0 4px; }
.seg span .ic { width: 16px; height: 16px; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg-expense input:checked + span { color: var(--neg); }
.seg-income input:checked + span { color: var(--pos); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.seg-inline { max-width: 420px; margin-bottom: 14px; }
.card-extra { display: flex; flex-direction: column; gap: 8px; background: color-mix(in srgb, var(--s7) 7%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--s7) 35%, var(--line)); border-radius: 14px; padding: 12px 14px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper input { width: 80px !important; text-align: center; font-weight: 700; }
.stepper .icon-btn { background: var(--surface); border: 1px solid var(--line-strong); width: 40px; height: 40px; }
.notes summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.notes textarea { margin-top: 8px; }
.note-warn, .form-error, .note-info { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600; margin: 0; }
.note-warn { background: var(--warn-soft); color: var(--warn); }
.form-error { background: var(--neg-soft); color: var(--neg); }
.note-info { background: var(--accent-soft); color: var(--ink-2); font-weight: 500; line-height: 1.5; }
.note-info > .ic { color: var(--accent); }
.note-info .check { padding: 0; margin-top: 6px; font-weight: 600; }
.note-warn .ic, .form-error .ic, .note-info .ic { margin-top: 1px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); transition: transform .12s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--ink); transform: scale(1.08); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.row-3 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.fees-box { margin: 0; padding: 12px 14px 14px; border: 1px dashed var(--line-strong); border-radius: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fees-box legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input-suffix { position: relative; }
.input-suffix input { width: 100%; padding-right: 30px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.fee-line { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface-2); border-radius: 14px; }
.fee-line .field { flex: 0 1 160px; }
.fee-line p { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); flex: 1 1 160px; }
.input-with-btn { display: flex; gap: 6px; }
.input-with-btn .btn { height: 44px; border-radius: 12px; font-size: 17px; }
.pay-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pay-summary div { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; }
.pay-summary span { font-size: 12px; color: var(--muted); font-weight: 600; }
.pay-summary b { font-variant-numeric: tabular-nums; }
.declare-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 14px; }
.declare-box div { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.declare-box small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.declare-box .btn { flex-shrink: 0; }
@media (max-width: 440px) { .declare-box { flex-direction: column; align-items: stretch; } }

/* formulário de compromisso */
.when { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }
.when.is-locked { opacity: .55; }
.when-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dt { display: flex; gap: 6px; }
.dt input { padding: 0 10px; font-size: 14.5px; }
.dt input[type=date] { flex: 1 1 auto; min-width: 0; }
.dt input[type=time] { flex: 0 0 96px; }
.color-name { font-weight: 600; color: var(--muted); margin-left: 4px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; cursor: pointer; width: fit-content; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 38px; height: 22px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ev-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-color { position: relative; cursor: pointer; }
.ev-color input { position: absolute; opacity: 0; pointer-events: none; }
.ev-color span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: transform .12s, box-shadow .12s; }
.ev-color em { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ev-color:first-child span { background: conic-gradient(var(--c) 0 50%, color-mix(in srgb, var(--c) 45%, var(--surface)) 0); }
.ev-color input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); transform: scale(.92); }
.ev-color input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 4px; }
.ev-color:hover span { transform: scale(1.08); }

/* ---------- avisos ---------- */
.toasts { position: fixed; bottom: 24px; left: calc(50% + var(--side-w) / 2); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; background: #1c1b22; color: #f5f4f1; padding: 11px 18px; border-radius: 14px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; max-width: min(560px, 92vw);
}
:root[data-theme="dark"] .toast { background: #2a2f3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #2a2f3c; } }
.toast.show { opacity: 1; transform: none; }
.toast .ic { color: #6ee7b7; }
.toast-erro .ic { color: #ffa587; }
.toast-info .ic { color: #9ec5f4; }

.boot-error { max-width: 560px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 32px; box-shadow: var(--shadow); }
.boot-error h1 { font-weight: 800; font-size: 26px; margin-bottom: 8px; letter-spacing: -.03em; }
.boot-error ol { line-height: 1.9; }

/* ---------- sub-navegação de Finanças ---------- */
.subnav { display: flex; gap: 4px; margin: -6px 0 20px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; box-shadow: var(--shadow-sm); }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 11px; text-decoration: none; font-weight: 700; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s; }
.subnav a .ic { width: 16px; height: 16px; }
.subnav a:hover { color: var(--ink); background: var(--surface-3); }
.subnav a.on { background: var(--accent-soft); color: var(--accent); }

/* ---------- Hoje ---------- */
a.stat { text-decoration: none; color: inherit; transition: transform .15s, border-color .15s, box-shadow .15s; }
a.stat:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--sec) 40%, var(--line)); box-shadow: var(--shadow); }
a.stat[href="#/agenda"] .stat-label .ic { color: var(--sec-agenda); }
a.stat[href="#/cotidiano"] .stat-label .ic { color: var(--sec-cotidiano); }
a.stat[href="#/painel"] .stat-label .ic { color: var(--sec-financas); }
.hero-today .hero-sub { font-size: 15px; }

/* ---------- hábitos ---------- */
.habit-list, .task-list, .event-list, .habit-manage, .cal-list { list-style: none; margin: 0; padding: 0; }
.habit { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.habit + .habit { border-top: 1px solid var(--line); }
.habit-check {
  --p: 0%;
  --hc: var(--sec-cotidiano);
  width: 40px; height: 40px; border-radius: 50%; flex: none; cursor: pointer; display: grid; place-items: center;
  border: 2px solid var(--line-strong); color: transparent; font-weight: 800; font-size: 13px;
  background: conic-gradient(color-mix(in srgb, var(--hc) 22%, transparent) var(--p), transparent 0);
  transition: background .2s, border-color .2s, transform .1s;
}
.habit-check:hover { border-color: var(--hc); color: color-mix(in srgb, var(--hc) 45%, transparent); }
.habit-check:active { transform: scale(.9); }
.habit-check .ic { width: 20px; height: 20px; stroke-width: 2.8; }
.habit-check span { color: var(--acc-cotidiano); }
.habit.is-partial .habit-check { border-color: var(--hc); }
.habit.is-done .habit-check { background: var(--hc); border-color: var(--hc); color: #fff; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--hc) 70%, transparent); }
.habit-emoji { font-size: 22px; width: 30px; text-align: center; flex: none; line-height: 1; }
.habit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.habit-main b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habit-main small { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.habit-main small .ic { width: 13px; height: 13px; margin-right: -3px; }
.habit-main .sep { opacity: .5; }
.habit.is-done .habit-main b { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); color: var(--muted); }
.streak { color: var(--acc-hoje); }
.day-score { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.off-day { margin-top: 10px; }
.off-day summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--muted); padding: 6px 0; }
.habit-manage li { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.habit-manage li + li { border-top: 1px solid var(--line); }
.habit-manage li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.habit-manage small { font-size: 12.5px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.welcome .suggest { justify-content: center; margin-bottom: 22px; }
.suggest-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px 0 12px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; font-size: 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.suggest-chip span { font-size: 17px; }
.suggest-chip .ic { width: 15px; height: 15px; color: var(--accent); }
.suggest-chip:hover { border-color: var(--sec); background: var(--accent-soft); }
.pop { position: fixed; z-index: 200; pointer-events: none; font-size: 20px; transform: translate(-50%, 0); animation: popup .7s ease-out forwards; }
@keyframes popup { to { transform: translate(-50%, -34px) scale(1.4); opacity: 0; } }

/* grade dos últimos 7 dias */
.week-grid { display: grid; grid-template-columns: minmax(0, 1fr) repeat(var(--cols), 28px); gap: 5px 4px; align-items: center; }
.wg-head { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1.2; display: flex; flex-direction: column; }
.wg-head b { font-size: 13px; color: var(--ink-2); }
.wg-head.on b { color: var(--accent); }
.wg-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-cell { width: 28px; height: 28px; border-radius: 9px; border: 0; cursor: pointer; padding: 0; display: inline-block; }
.wg-cell.done { background: var(--sec-cotidiano); }
.wg-cell.partial { background: color-mix(in srgb, var(--sec-cotidiano) 40%, var(--surface-3)); }
.wg-cell.miss { background: var(--surface-3); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.wg-cell.off { background: repeating-linear-gradient(135deg, var(--surface-3) 0 3px, transparent 3px 6px); }
.wg-cell:hover { outline: 2px solid var(--sec-cotidiano); outline-offset: 1px; }
.wg-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 12px; color: var(--muted); font-weight: 600; }
.wg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wg-legend .wg-cell { width: 13px; height: 13px; border-radius: 4px; cursor: default; }
.wg-legend .wg-cell:hover { outline: 0; }

/* tarefas */
.task { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.task + .task { border-top: 1px solid var(--line); }
.task-check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line-strong); background: transparent; color: transparent; display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; transition: background .15s, border-color .15s; }
.task-check .ic { width: 15px; height: 15px; stroke-width: 3; }
.task-check:hover { border-color: var(--accent); }
.task.is-done .task-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.task-text { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.task.is-done .task-text { text-decoration: line-through; color: var(--muted); }
.task-time { color: var(--muted); font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.task .icon-btn { width: 30px; height: 30px; opacity: .5; }
.task:hover .icon-btn, .task .icon-btn:focus-visible { opacity: 1; }
@media (hover: none) { .task .icon-btn { opacity: 1; } }
.task-add { display: flex; gap: 6px; margin-top: 10px; }
.task-add input { height: 40px; border-radius: 12px; border: 1px dashed var(--line-strong); background: var(--surface-2); padding: 0 12px; min-width: 0; }
.task-add input[name=text] { flex: 1; }
.task-add input[name=time] { width: 104px; flex: none; color: var(--ink-2); }
.task-add input:focus { outline: none; border-style: solid; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.task-add .btn { height: 40px; width: 40px; padding: 0; border-radius: 12px; }
.sync-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: none; color: var(--acc-agenda); background: color-mix(in srgb, var(--sec-agenda) 12%, var(--surface)); padding: 2px 8px 2px 6px; border-radius: 99px; }
.sync-chip .ic { width: 13px; height: 13px; }
.sync-chip.is-error { color: var(--neg); background: var(--neg-soft); }
.day-note { width: 100%; border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: 14px; padding: 12px 14px; resize: vertical; min-height: 120px; line-height: 1.6; }
.day-note:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }

/* formulário de hábito */
.emoji-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; }
.emoji-pick label, .day-pick label { position: relative; cursor: pointer; }
.emoji-pick input, .day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.emoji-pick span { display: grid; place-items: center; height: 40px; border-radius: 11px; font-size: 20px; border: 1.5px solid transparent; }
.emoji-pick span:hover { background: var(--surface-3); }
.emoji-pick input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.emoji-pick input:focus-visible + span, .day-pick input:focus-visible + span { outline: 2px solid var(--accent); }
.day-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day-pick span { display: grid; place-items: center; height: 38px; border-radius: 11px; font-weight: 700; font-size: 13px; border: 1px solid var(--line-strong); color: var(--ink-2); }
.day-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-presets { display: flex; gap: 14px; font-size: 13px; }
.field-check { justify-content: flex-end; padding-bottom: 10px; }

/* ---------- agenda ---------- */
.agenda-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: -6px 0 14px; }
.agenda-bar .btn-row { margin: 0; }
.src-line, .agenda-bar .small { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.agenda-bar .ic { width: 15px; height: 15px; }
.panel-setup { border-color: color-mix(in srgb, var(--sec) 35%, var(--line)); }
.panel-setup > p { margin-top: 0; color: var(--ink-2); }
.panel-promo { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; background: color-mix(in srgb, var(--sec) 6%, var(--surface)); border-color: color-mix(in srgb, var(--sec) 25%, var(--line)); }
.promo-text { flex: 1 1 380px; }
.promo-text h2 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.promo-text p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
.g-setup { flex: 1 1 100%; }
.g-setup > summary { list-style: none; width: fit-content; }
.g-setup > summary::-webkit-details-marker { display: none; }
.g-setup[open] > summary { display: none; }
.alt-setup { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.alt-setup > summary { cursor: pointer; font-size: 14px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alt-setup[open] > summary { margin-bottom: 10px; }
.steps { margin: 0 0 14px; padding-left: 22px; line-height: 1.8; font-size: 14.5px; }
.steps .ic { width: 14px; height: 14px; }
.gsteps { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: g; display: grid; gap: 4px; }
.gsteps > li { counter-increment: g; display: flex; gap: 14px; padding: 12px 0; position: relative; }
.gsteps > li + li { border-top: 1px solid var(--line); }
.gsteps > li::before {
  content: counter(g); flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; background: var(--accent-soft); color: var(--accent);
}
.gsteps > li > div { flex: 1; min-width: 0; }
.gsteps b { font-weight: 800; }
.gsteps p { margin: 3px 0 8px; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.gsteps p.hint { color: var(--muted); font-size: 12.5px; }
.gsteps .btn-row { margin-top: 4px; }
.code-box { width: 100%; margin-top: 10px; font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); padding: 10px 12px; resize: vertical; }
.google-form, .ics-form { display: flex; gap: 8px; margin: 6px 0; }
.google-form input, .ics-form input { flex: 1; min-width: 0; height: 42px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0 14px; font-size: 13.5px; }
.google-form input:focus, .ics-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.google-form .btn { height: 42px; }
.settings .ics-form + .hint { margin-bottom: 12px; }
.gstatus { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.gstatus li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); line-height: 1.5; padding: 10px 12px; background: var(--pos-soft); border-radius: 12px; }
.gstatus li > .ic { color: var(--pos); margin-top: 2px; }
.gstatus li.is-warn { background: var(--warn-soft); }
.gstatus li.is-warn > .ic { color: var(--warn); }
.gstatus b { color: var(--ink); }

.cal-panel { padding: 18px; }
.cal-panel .panel-head h2 { font-size: 19px; }
.cal-legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); font-weight: 700; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 3px; }
.lg-ev { background: var(--sec-agenda); }
.lg-task { background: var(--sec-cotidiano); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.cal-wd { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 8px 0 7px; background: var(--surface-2); }
.cal-day {
  min-height: 104px; min-width: 0; border: 0; background: var(--surface); padding: 6px;
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; cursor: pointer; transition: background .15s, box-shadow .15s;
}
.cal-day.wkend { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.cal-day:hover { background: color-mix(in srgb, var(--sec) 5%, var(--surface)); }
.cal-day.out { color: var(--muted); }
.cal-day.out .cal-items { opacity: .55; }
.cal-num { font-weight: 700; font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--sec) 6%, var(--surface)); position: relative; z-index: 1; }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-ev, .cal-task, .cal-more { font-size: 11.5px; line-height: 1.35; padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-ev { --ev: var(--sec-agenda); background: color-mix(in srgb, var(--ev) 15%, var(--surface)); color: var(--ink); box-shadow: inset 3px 0 0 var(--ev); }
.cal-ev i { font-style: normal; color: color-mix(in srgb, var(--ev) 75%, var(--ink)); margin-right: 4px; font-weight: 800; }
.cal-ev.allday { background: var(--ev); color: #fff; box-shadow: none; }
.cal-task { background: color-mix(in srgb, var(--sec-cotidiano) 12%, var(--surface)); color: var(--ink-2); }
.cal-task::before { content: '☐ '; }
.cal-task.done { text-decoration: line-through; opacity: .6; }
.cal-task.done::before { content: '☑ '; }
.cal-more { color: var(--muted); padding-top: 0; }
.cal-dots { display: none; gap: 3px; justify-content: center; margin-top: auto; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--sec-agenda); }
.cal-tip { margin-top: 10px; }
.event { --ev: var(--sec-agenda); }
.event + .event { border-top: 1px solid var(--line); }
.event-btn {
  display: flex; gap: 12px; align-items: baseline; width: 100%; padding: 9px 8px 9px 14px; border: 0; background: none; text-align: left;
  position: relative; border-radius: 10px; color: inherit; font: inherit;
}
.event-btn::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; border-radius: 4px; background: var(--ev); }
button.event-btn { cursor: pointer; transition: background .12s; }
button.event-btn:hover { background: var(--surface-2); }
.event-time { flex: 0 0 92px; font-size: 13px; font-weight: 800; color: color-mix(in srgb, var(--ev) 70%, var(--ink)); font-variant-numeric: tabular-nums; }
.event.is-allday .event-time { color: var(--muted); }
.event-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.event-main b { font-weight: 700; overflow-wrap: anywhere; }
.event-main small { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 3px; }
.event-main small .ic { width: 13px; height: 13px; flex: none; }
.event-flag { color: var(--muted); align-self: center; }
.event-flag .ic { width: 14px; height: 14px; }
.cal-toggle { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 4px; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 600; color: var(--ink-2); }
.cal-toggle:hover { background: var(--surface-2); }
.cal-toggle i { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--c); display: grid; place-items: center; color: transparent; flex: none; }
.cal-toggle i .ic { width: 13px; height: 13px; stroke-width: 3.2; }
.cal-toggle.on i { background: var(--c); color: #fff; }
.cal-toggle span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-toggle.on span { color: var(--ink); }
.cal-toggle small { color: var(--muted); font-size: 11.5px; font-weight: 700; }

/* ---------- conta e tela de entrar ---------- */
.side-foot { flex-wrap: wrap; row-gap: 10px; }
.user-chip { flex: 1 1 100%; display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; font-size: 13.5px; color: var(--ink); padding: 4px; border-radius: 12px; min-width: 0; }
.user-chip:empty { display: none; }
.user-chip:hover { background: var(--surface-3); }
.user-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; object-fit: cover; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--ink-2); font-weight: 800; font-size: 13px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.account { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.account > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.account small { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.gstatus + .btn { margin-top: 6px; }
.gstatus + .btn + .hint { margin-top: 6px; }
body.is-login .sidebar, body.is-login .shell, body.is-login .tabbar, body.is-login .fab { display: none !important; }
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 34px 30px 26px; box-shadow: var(--shadow); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login-mark { width: 56px; height: 56px; border-radius: 17px; }
.login-mark svg { width: 34px; height: 34px; }
.login-card h1 { font-size: 30px; font-weight: 800; letter-spacing: -.04em; }
.login-lead { margin: -8px 0 4px; color: var(--ink-2); font-size: 15.5px; }
.login-points { list-style: none; margin: 0 0 6px; padding: 14px 16px; display: grid; gap: 10px; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }
.login-points li { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.login-points li:nth-child(1) .ic { color: var(--sec-financas); }
.login-points li:nth-child(2) .ic { color: var(--sec-agenda); }
.login-points li:nth-child(3) .ic { color: var(--sec-cotidiano); }
.login-card .form-error { width: 100%; text-align: left; }
.btn-google { width: 100%; height: 48px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); font-size: 15px; gap: 12px; }
.btn-google:hover { background: var(--surface-3); }
.login-hint { max-width: 300px; }

/* ---------- navegação móvel ---------- */
.tabbar, .fab { display: none; }

@media (max-width: 1180px) {
  :root { --side-w: 84px; }
  .sidebar { padding: 20px 12px 14px; align-items: center; }
  .brand { padding: 0; }
  .brand-name, .nav a > span, .save-state span, .user-chip span:last-child { display: none; }
  .user-chip { flex: none; justify-content: center; }
  .nav a { padding: 6px; justify-content: center; }
  .nav a.on { background: transparent; }
  .nav-ic { width: 40px; height: 40px; border-radius: 13px; }
  .side-foot { flex-direction: column; padding: 12px 0 0; }
  .grid-main { grid-template-columns: 1fr; }
  .col-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 18px; }
  .bill-head { grid-template-columns: 1fr 1fr; }
  .bill-cta { grid-column: 1 / -1; flex-direction: row; }
}

@media (max-width: 760px) {
  :root { --side-w: 0px; }
  body { font-size: 14.5px; }
  .sidebar {
    position: sticky; top: 0; inset: auto; width: auto; flex-direction: row; align-items: center; gap: 10px;
    height: 56px; padding: 0 12px 0 16px; border-right: 0; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .brand-name { display: inline; font-size: 17px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .nav { display: none; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; flex-wrap: nowrap; border: 0; padding: 0; gap: 4px; }
  .user-chip { order: 3; padding: 2px; }
  .user-chip .avatar { width: 28px; height: 28px; }
  .shell { margin-left: 0; }
  .btn-launch { display: none; }
  .page { padding: 16px 16px calc(100px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; align-items: stretch; }
  .page-head h1 { font-size: 27px; }
  .page-tools { width: 100%; }
  .month-switch { width: 100%; justify-content: space-between; }
  .month-switch #month-label { min-width: 0; flex: 1; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 2px 0; }
  .tabbar .nav-ic { width: 44px; height: 30px; border-radius: 99px; background: transparent; color: var(--muted); }
  .tabbar .nav-ic .ic { width: 21px; height: 21px; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.on .nav-ic { background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--c); }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 31;
    width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-lg); cursor: pointer;
  }
  .fab .ic { width: 26px; height: 26px; }
  .toasts { left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .hero { grid-template-columns: 1fr; padding: 22px 18px; gap: 18px; border-radius: 20px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .stat b { font-size: 16px; }
  .panel { padding: 16px; border-radius: 18px; }
  .split:has(> div + div) { grid-template-columns: 1fr; }
  .col-side { grid-template-columns: 1fr; }
  .welcome-steps { grid-template-columns: 1fr; }
  .sum-strip { grid-template-columns: repeat(2, 1fr); }
  .sum-strip > div { border-bottom: 1px solid var(--line); }
  .sum-strip > div:nth-child(2n) { border-right: 0; }
  .sum-strip > div:first-child { grid-column: 1 / -1; border-right: 0; }
  .sum-strip > div:last-child { display: none; }
  .filters select { flex: 1 1 140px; max-width: none; }
  .tx { gap: 10px; padding: 10px 2px; flex-wrap: wrap; }
  .tx-ico { width: 34px; height: 34px; border-radius: 10px; }
  .tx-main { flex: 1 1 calc(100% - 160px); }
  .tx-actions { width: 100%; justify-content: flex-end; margin-top: -6px; }
  .tx-actions .icon-btn { width: 30px; height: 30px; }
  .day { padding: 4px 10px; }
  .bill-head { grid-template-columns: 1fr; padding: 20px; gap: 18px; }
  .bill-total { font-size: 32px; }
  .bill-cta { flex-direction: column; }
  .timeline { grid-template-columns: repeat(12, 54px); overflow-x: auto; padding-bottom: 4px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td, .table tfoot { display: block; width: 100%; }
  .table tbody tr { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
  .table td { border: 0; padding: 0; }
  .table td[data-label="Descrição"] { grid-column: 1; }
  .table td[data-label="Valor"] { grid-column: 2; grid-row: 1; }
  .table td[data-label="Compra"], .table td[data-label="Parcela"], .table td[data-label="Categoria"], .table td[data-label="Responsável"] { display: inline-block; width: auto; font-size: 12.5px; color: var(--muted); grid-column: 1; }
  .table td:last-child:not([data-label]) { grid-column: 2; grid-row: 2 / span 4; align-self: center; }
  .table tbody tr:hover td { background: transparent; }
  .table tfoot tr { display: flex; justify-content: space-between; }
  .table tfoot td { width: auto; }
  .acc-grid, .cc-grid { grid-template-columns: 1fr; }
  .bud-top { flex-wrap: wrap; }
  .bud-top .btn { margin-left: auto; }
  .modal-head { padding: 16px 14px 4px 20px; }
  .modal-body { padding: 10px 20px 8px; }
  .modal-foot { padding: 12px 20px 18px; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .btn-icon-only { flex: 0 0 44px; }
  .modal-foot .grow { display: none; }
  .modal-foot [data-save-another] { flex-basis: 100%; order: 3; }
  dialog.modal { max-height: calc(100dvh - 16px); }
  .modal-box { max-height: calc(100dvh - 16px); }
  .money-big { font-size: 30px !important; }
  .subnav { width: auto; margin: -4px -16px 16px; padding: 2px 16px; border-radius: 0; background: transparent; border: 0; box-shadow: none; gap: 6px; }
  .subnav a { background: var(--surface); border: 1px solid var(--line); }
  .subnav a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .when-grid { grid-template-columns: 1fr; }
  .cal-panel { padding: 12px 10px; }
  .cal-panel .panel-head { margin-bottom: 10px; }
  .cal-legend { display: none; }
  .cal-grid { border-radius: 14px; }
  .cal-day { min-height: 54px; padding: 5px 2px; align-items: center; }
  .cal-items { display: none; }
  .cal-dots { display: flex; }
  .cal-wd { font-size: 10px; letter-spacing: 0; }
  .event-time { flex-basis: 100px; font-size: 12.5px; white-space: nowrap; }
  .week-grid { grid-template-columns: minmax(0, 1fr) repeat(var(--cols), 26px); }
  .wg-cell { width: 26px; height: 26px; }
  .ics-form, .google-form { flex-direction: column; }
  .task-add input[name=time] { width: 92px; }
  .gsteps > li { gap: 10px; }
}

@media (max-width: 440px) {
  .seg span .ic { display: none; }
}
@media (max-width: 380px) {
  .tabbar a { font-size: 9.5px; }
  .seg span { font-size: 12.5px; }
}
@media (max-width: 330px) {
  .brand-name { display: none; }
}

@media print {
  .sidebar, .tabbar, .fab, .month-switch, .tx-actions, .btn { display: none !important; }
  .shell { margin: 0; }
  body { background: #fff; }
}
