/* Zeny — identidade: fundo roxo vivo que escurece até o grafite, peças em grafite
   com detalhes roxos (como ícones roxos sobre fundo escuro), âmbar para conquistas.
   Tema escuro é o padrão; o claro só entra quando escolhido nos Ajustes. */

:root {
  --page: linear-gradient(180deg, #7B2FD8 0%, #5A23A8 22%, #3A2156 48%, #26232B 72%, #1E1D22 100%);
  --bg: #1E1D22;
  --surface: #28262C;
  --surface-2: #302D35;
  --sunken: #1F1D23;
  --line: #36333D;
  --line-strong: #47434F;
  --ink: #F4F1F8;
  --ink-2: #CFC8DB;
  --muted: #9C95A8;
  --accent: #9A4DFF;
  --accent-hover: #AE6BFF;
  --accent-ink: #FFFFFF;
  --accent-soft: #3A2A52;
  --hero: radial-gradient(120% 140% at 100% 0%, rgba(154, 77, 255, .45) 0%, rgba(154, 77, 255, .12) 45%, rgba(0, 0, 0, 0) 75%), #26232B;
  --hero-ink: #F6F1FF;
  --hero-muted: #BFA9EE;
  --hero-track: rgba(255, 255, 255, .16);
  --amber: #F0AE45;
  --amber-soft: #43351C;
  --in: #3CC98A;
  --in-soft: #183A2A;
  --out: #F07366;
  --out-soft: #45232A;
  --info: #7DA2F5;
  --info-soft: #232E4A;
  --glow: rgba(154, 77, 255, .5);
  --mark-bg: #2E2B33;
  --mark-fg: #9A4DFF;
  --scrim: rgba(0, 0, 0, .65);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .8);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .9);

  --f-display: 'Bricolage Grotesque', 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --tab-h: 64px;
  color-scheme: dark;
}
/* Tema claro, escolhido nos Ajustes do Zeny. */
:root[data-zeny-theme="light"] {
  --page: #F5F3FA; --bg: #F5F3FA; --surface: #FFFFFF; --surface-2: #F8F6FC; --sunken: #ECE8F4;
  --line: #E4DFEE; --line-strong: #CFC7DF; --ink: #17122A; --ink-2: #3F3656; --muted: #6D6485;
  --accent: #7C3AED; --accent-hover: #6D28D9; --accent-ink: #FFFFFF; --accent-soft: #EDE5FD;
  --hero: radial-gradient(120% 140% at 100% 0%, #6D3BE0 0%, #3A1A86 50%, #221049 100%);
  --hero-ink: #F8F4FF; --hero-muted: #CDBBF3;
  --amber: #D98A12; --amber-soft: #FBEFD9; --in: #16895A; --in-soft: #DDF3E8;
  --out: #CF4A3F; --out-soft: #FBE4E1; --info: #2F6BD8; --info-soft: #E1EAFB;
  --glow: rgba(124, 58, 237, .35);
  --mark-bg: #2E2B33; --mark-fg: #A35CFF;
  --scrim: rgba(23, 18, 42, .45);
  --shadow: 0 1px 2px rgba(23, 18, 42, .05), 0 10px 28px -14px rgba(23, 18, 42, .22);
  --shadow-lg: 0 24px 60px -20px rgba(23, 18, 42, .35);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: var(--page);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 24px; height: 24px; }
.mark { width: 36px; height: 36px; flex: none; stroke-linecap: round; stroke-linejoin: round; }
.mark.xl { width: 64px; height: 64px; }

/* ---------- Estrutura ---------- */
.shell {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}
.sidebar { display: none; }
.main { overflow-y: auto; overscroll-behavior: contain; }
.main-inner { max-width: 1080px; margin: 0 auto; padding: 0 16px 32px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 20px 0 16px;
}
.page-head h1 { font: 700 28px/1.1 var(--f-display); letter-spacing: -.02em; text-wrap: balance; }
.page-head p { color: var(--ink-2); margin-top: 4px; font-size: 14px; }
.head-actions { display: flex; gap: 8px; align-items: center; }

.chat { display: none; }
.shell.chat-open .chat {
  display: flex; position: fixed; inset: 0; z-index: 40;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar {
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  position: relative; z-index: 20;
}
.tabbar button {
  height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.tabbar button.on { color: var(--accent); }
.tabbar .tab-zeny { position: relative; }
.tabbar .tab-zeny .mark {
  width: 52px; height: 52px; transform: translateY(-12px);
  filter: drop-shadow(0 8px 16px var(--glow));
  transition: transform .2s ease;
}
.tabbar .tab-zeny:active .mark { transform: translateY(-10px) scale(.96); }

@media (min-width: 1024px) {
  .shell { grid-template-columns: 236px minmax(0, 1fr) 392px; grid-template-rows: minmax(0, 1fr); }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 24px;
    padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface);
  }
  .chat { display: flex; position: static; border-left: 1px solid var(--line); }
  .shell.chat-open .chat { position: static; padding: 0; }
  .only-mobile { display: none !important; }
  .main-inner { padding: 0 32px 48px; }
  .page-head { padding-top: 28px; }
  .page-head h1 { font-size: 32px; }
}

/* Barra lateral */
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand strong { display: block; font: 700 19px/1 var(--f-display); letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  font-weight: 600; color: var(--ink-2); text-align: left;
}
.side-nav button:hover { background: var(--surface-2); }
.side-nav button.on { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.plan-card {
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 8px; font-size: 13px;
}
.plan-card strong { font: 700 15px/1.2 var(--f-display); }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font: 650 17px/1.2 var(--f-display); letter-spacing: -.01em; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 650; font-size: 14px;
  text-decoration: none; transition: background .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--line-strong); }
.btn.danger { background: var(--out-soft); color: var(--out); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); }
.link { color: var(--accent); font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }

.seg { display: inline-flex; background: var(--sunken); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { height: 34px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 650; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--sunken); color: var(--ink-2);
}
.pill .ic { width: 13px; height: 13px; }
.tone-in { background: var(--in-soft); color: var(--in); }
.tone-out { background: var(--out-soft); color: var(--out); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-accent { background: var(--accent-soft); color: var(--accent); }
.pos { color: var(--in); }
.neg { color: var(--out); }

.bar { height: 8px; background: var(--sunken); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.bar.warn > i { background: var(--amber); }
.bar.over > i { background: var(--out); }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 22px 12px; color: var(--muted); font-size: 14px;
}
.empty .e-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--sunken); color: var(--muted); }
.empty strong { color: var(--ink); font-weight: 650; }

.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--amber-soft); color: var(--ink); border-radius: var(--r); padding: 10px 14px; font-size: 14px; margin-bottom: 16px;
}
.demo-banner strong { color: var(--amber); }

/* Linhas de lista */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line);
  width: 100%; text-align: left; min-width: 0;
}
.row:last-child { border-bottom: 0; }
button.row:hover, .row.clickable:hover { background: var(--surface-2); border-radius: 12px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row .amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.cat-ic .ic { width: 19px; height: 19px; }

.checkbox {
  width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line-strong); flex: none;
  display: grid; place-items: center; color: transparent; transition: .15s ease;
}
.checkbox .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.checkbox.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.row.done .title { text-decoration: line-through; color: var(--muted); }

.group-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 16px 4px 4px; display: flex; justify-content: space-between; }
.group-label.alert { color: var(--out); }

/* ---------- Início ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) {
  .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .span-2 { grid-column: 1 / -1; }
}

.hero {
  background: var(--hero); color: var(--hero-ink); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 16px; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 36px solid rgba(255, 255, 255, .05); pointer-events: none;
}
.hero .eyebrow { color: var(--hero-muted); }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hero .big { font: 700 clamp(34px, 8vw, 44px)/1 var(--f-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-split > div { background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--hero-muted); }
.hero-split b { color: var(--hero-ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.hero-split .lbl { display: flex; align-items: center; gap: 6px; }
.hero .bar { background: var(--hero-track); }
.hero .bar > i { background: var(--hero-ink); }
.hero .bar.warn > i { background: #F6C35B; }
.hero .bar.over > i { background: #FF9A8E; }
.hero .budget-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--hero-muted); margin-bottom: 6px; }
.hero .chip-btn { color: var(--hero-ink); font-size: 13px; font-weight: 650; display: inline-flex; align-items: center; gap: 2px; opacity: .9; }
.hero .link { color: var(--hero-ink); }

.ask-bar {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px;
  color: var(--muted); box-shadow: var(--shadow); font-size: 14px;
}
.ask-bar .mark { width: 30px; height: 30px; }
.ask-bar .ic { margin-left: auto; color: var(--accent); }
@media (min-width: 1024px) { .ask-bar { display: none; } }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.quick button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px;
  border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 650; text-align: left;
}
.quick button:hover { border-color: var(--line-strong); }
.quick .q-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }

.insights { display: flex; flex-direction: column; gap: 10px; }
.insight { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.insight .i-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.insight b { font-weight: 650; }

.habit-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.habit-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 8px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: 14px;
}
.habit-chip .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; color: transparent; }
.habit-chip .dot .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.habit-chip.on { background: var(--amber-soft); border-color: transparent; }
.habit-chip.on .dot { background: var(--amber); border-color: var(--amber); color: #fff; }

.ring { width: 44px; height: 44px; flex: none; }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--sunken); }
.ring .val { stroke: var(--amber); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .4s ease; }
.ring text { font: 700 11px var(--f-body); fill: var(--ink); }

/* ---------- Finanças ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.month-nav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.month-nav strong { min-width: 132px; text-align: center; font-weight: 650; font-size: 14px; }
.month-nav .icon-btn { width: 34px; height: 34px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; box-shadow: var(--shadow); }
.stat .lbl { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.stat b { display: block; margin-top: 6px; font: 700 clamp(15px, 3.6vw, 22px)/1.1 var(--f-display); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 500 10px var(--f-body); }
.chart .axis.cur { fill: var(--ink); font-weight: 700; }
.chart .b-in { fill: var(--in); }
.chart .b-out { fill: var(--out); }
.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut circle { fill: none; stroke-width: 16; }
.donut .track { stroke: var(--sunken); }
.donut text { text-anchor: middle; }
.donut .d-lbl { fill: var(--muted); font: 600 9px var(--f-body); }
.donut .d-val { fill: var(--ink); font: 700 12px var(--f-display); }
.legend { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.legend .p { color: var(--muted); font-size: 12px; width: 36px; text-align: right; font-variant-numeric: tabular-nums; }

.search { position: relative; flex: 1; min-width: 160px; max-width: 280px; }
.search input { width: 100%; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px 0 36px; font-size: 14px; outline: 0; }
.search input:focus { border-color: var(--accent); }
.search .ic { position: absolute; left: 11px; top: 10px; width: 17px; height: 17px; color: var(--muted); }

.goal { display: flex; flex-direction: column; gap: 8px; padding: 12px 4px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.goal:last-child { border-bottom: 0; }
.goal .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.goal .top span:last-child { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- Quero comprar ---------- */
.bar.done > i { background: var(--in); }
.wish { display: flex; flex-direction: column; gap: 12px; }
.wish.ready { border-color: var(--in); box-shadow: 0 0 0 3px var(--in-soft), var(--shadow); }
.wish-head { display: flex; align-items: center; gap: 12px; }
.wish-head .w-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.wish.ready .w-ic { background: var(--in-soft); color: var(--in); }
.wish-head .grow { flex: 1; min-width: 0; }
.wish-head .name { font-weight: 650; font-size: 16px; overflow-wrap: anywhere; }
.wish-head .pct { font: 700 20px/1 var(--f-display); color: var(--accent); }
.wish-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notif-line { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.notif-line .small { display: inline-flex; align-items: center; gap: 6px; }
.goal .top .pill { font-size: 11px; }
dialog.celebrate form { text-align: center; align-items: center; }
dialog.celebrate .actions { width: 100%; }
dialog.celebrate .burst {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: var(--in-soft); color: var(--in); animation: burst .5s ease-out;
}
@keyframes burst { 0% { transform: scale(.4) rotate(-12deg); opacity: 0; } 70% { transform: scale(1.12) rotate(4deg); } 100% { transform: scale(1); } }

/* ---------- Hábitos ---------- */
.habit-card { display: flex; flex-direction: column; gap: 14px; }
.habit-head { display: flex; align-items: center; gap: 12px; }
.habit-head .h-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--sunken); color: var(--muted); flex: none; }
.habit-head .h-ic.on { background: var(--amber-soft); color: var(--amber); }
.habit-head .grow { flex: 1; min-width: 0; }
.habit-head .name { font-weight: 650; font-size: 16px; }
.habit-head .streak { font-size: 13px; color: var(--muted); }
.habit-head .streak b { color: var(--amber); }
.big-check {
  height: 40px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line-strong);
  font-weight: 650; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2);
}
.big-check.on { background: var(--amber); border-color: var(--amber); color: #fff; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 600; }
.week .d {
  width: 100%; max-width: 40px; aspect-ratio: 1; border-radius: 12px; background: var(--sunken);
  display: grid; place-items: center; color: var(--ink-2); font-size: 13px; font-weight: 650;
}
.week button.on .d { background: var(--amber); color: #fff; }
.week button.today .d { outline: 2px solid var(--amber); outline-offset: 2px; }
.week button:disabled { opacity: .45; }
.habit-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); gap: 8px; flex-wrap: wrap; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-grid .wd { font-size: 10px; text-align: center; color: var(--muted); font-weight: 700; }
.month-grid .md { aspect-ratio: 1; border-radius: 7px; background: var(--sunken); font-size: 10px; display: grid; place-items: center; color: var(--muted); max-width: 100%; }
.month-grid .md.on { background: var(--amber); color: #fff; }
.month-grid .md.blank { background: none; }

/* ---------- Planos ---------- */
.billing { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 20px; }
.save-tag { font-size: 12px; font-weight: 700; color: var(--in); background: var(--in-soft); padding: 4px 10px; border-radius: 99px; }
.plans { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
@media (min-width: 820px) { .plans { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.plan {
  display: flex; flex-direction: column; gap: 16px; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow);
}
.plan.highlight { border: 2px solid var(--accent); box-shadow: var(--shadow-lg); }
.plan .badge {
  position: absolute; top: -12px; left: 22px; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px;
}
.plan h3 { font: 700 22px/1.1 var(--f-display); letter-spacing: -.01em; }
.plan .tagline { color: var(--muted); font-size: 14px; margin-top: 4px; }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; min-height: 44px; }
.price .cur { font: 700 clamp(28px, 2.6vw, 36px)/1 var(--f-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.price .per { color: var(--muted); font-size: 14px; }
.price .soon { font: 650 20px/1.2 var(--f-display); color: var(--ink-2); }
.price-note { font-size: 13px; color: var(--muted); min-height: 20px; }
.plan ul { display: flex; flex-direction: column; gap: 10px; font-size: 14px; flex: 1; }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li .ic { color: var(--accent); width: 18px; height: 18px; margin-top: 1px; stroke-width: 2.4; }
.plan .current { font-size: 13px; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 6px; justify-content: center; height: 42px; }
.plans-foot { margin-top: 20px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plans-foot div { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.plans-foot .ic { color: var(--accent); margin-top: 2px; }
.usage { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.usage .top { display: flex; justify-content: space-between; }

/* ---------- Ajustes ---------- */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; }
.set-row .grow { flex: 1; min-width: 180px; }
.set-row .title { font-weight: 600; }
.set-row .desc { color: var(--muted); font-size: 13px; }
.set-row input[type="text"], .set-row input[type="url"], .set-row input[type="number"] {
  height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px; outline: 0; min-width: 0; width: 100%; max-width: 280px;
}
.set-row input:focus { border-color: var(--accent); }
.voice-select { height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 10px; max-width: 280px; width: 100%; color: var(--ink); }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
.ai-status { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.ai-status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.ai-status.on .dot { background: var(--in); box-shadow: 0 0 0 4px var(--in-soft); }

/* ---------- Chat ---------- */
.chat { flex-direction: column; background: var(--surface); min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-head .avatar { width: 36px; height: 36px; }
.chat-title { flex: 1; min-width: 0; }
.chat-title strong { display: block; font: 700 16px/1.2 var(--f-display); }
.chat-title small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.chat-title small::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chat-title small.ai::before { background: var(--in); }
#speakToggle[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

.messages { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; background: var(--sunken); }
.day-sep { align-self: center; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 6px 0; }
.msg { max-width: 88%; display: flex; flex-direction: column; gap: 6px; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 10px 14px; border-radius: 18px; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; font-size: 15px; }
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble ul { margin: 6px 0 2px; display: flex; flex-direction: column; gap: 3px; }
.bubble li { display: flex; gap: 8px; }
.bubble li::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 9px; flex: none; }
.bubble p + p, .bubble p + ul, .bubble ul + p { margin-top: 8px; }
.msg.fresh { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(6px); opacity: .2; } }
.msg .time { font-size: 11px; color: var(--muted); padding: 0 4px; }

.receipt { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; min-width: 240px; max-width: 100%; }
.receipt .r-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; font-size: 14px; font-weight: 600; }
.receipt .r-row span:last-child { overflow: hidden; text-overflow: ellipsis; }
.receipt .r-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.receipt .r-ic .ic { width: 16px; height: 16px; }
.receipt .r-foot { display: flex; justify-content: flex-end; padding: 4px 6px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.receipt .r-foot button { font-size: 13px; font-weight: 650; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 8px; }
.receipt .r-foot button:hover { background: var(--accent-soft); }
.receipt.undone { opacity: .55; }
.receipt.undone .r-row span:last-child { text-decoration: line-through; }

.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.suggestions { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px 0; scrollbar-width: none; background: var(--surface); }
.suggestions::-webkit-scrollbar { display: none; }
.suggestions button { white-space: nowrap; border: 1px solid var(--line); background: var(--surface-2); padding: 7px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.suggestions button:hover { border-color: var(--accent); color: var(--accent); }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 14px; background: var(--surface); }
.composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 140px; min-height: 46px; line-height: 1.45;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 16px; padding: 12px 14px; outline: 0; font-size: 15px;
}
.composer textarea:focus { border-color: var(--accent); background: var(--surface); }
.composer .mic, .composer .send { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.composer .mic { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.composer .mic.rec { background: var(--out); color: #fff; border-color: var(--out); animation: pulse 1.2s infinite; }
.composer .send { background: var(--accent); color: var(--accent-ink); }
.composer .send:disabled { opacity: .45; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px var(--out-soft); } }

/* ---------- Boas-vindas ---------- */
.onboard {
  position: fixed; inset: 0; z-index: 60; background: var(--bg); background-image: var(--page); overflow-y: auto;
  display: flex; justify-content: center; align-items: flex-start;
  padding: max(24px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px));
}
.onboard[hidden] { display: none; }
.onboard-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 18px; padding-top: 4vh; }
.onboard h1 { font: 750 36px/1.05 var(--f-display); letter-spacing: -.03em; text-wrap: balance; }
.onboard .lead { font-size: 17px; color: var(--ink-2); max-width: 36ch; }
.features { display: flex; flex-direction: column; gap: 14px; margin: 4px 0; }
.features li { display: flex; gap: 12px; align-items: flex-start; }
.features .f-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.features strong { display: block; font-weight: 650; }
.features small { color: var(--muted); font-size: 14px; }
.onboard-form { display: flex; flex-direction: column; gap: 10px; }
.fine { color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Formulários e modal ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px;
  font-size: 15px; font-weight: 500; color: var(--ink); outline: 0; width: 100%; min-width: 0;
}
.field input:focus, .field select:focus { border-color: var(--accent); background: var(--surface); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.field-check input { width: 20px; height: 20px; accent-color: var(--accent); }

dialog {
  border: 0; padding: 0; background: var(--surface); color: var(--ink);
  border-radius: 24px; width: min(calc(100vw - 32px), 460px); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
dialog form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
dialog h2 { font: 700 20px/1.2 var(--f-display); letter-spacing: -.01em; }
dialog .intro { color: var(--muted); font-size: 14px; }
dialog .actions { display: flex; gap: 8px; margin-top: 4px; }
dialog .actions .btn { flex: 1; }
dialog .actions .btn.danger { flex: 0 0 auto; }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: .22s ease;
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 12px 10px 16px;
  display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--accent-soft); font-weight: 700; padding: 4px 8px; border-radius: 8px; }
@media (min-width: 1024px) { .toast { bottom: 28px; left: calc(50% - 78px); } }

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat.bal { grid-column: 1 / -1; order: -1; }
  .stat.bal b { font-size: 26px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 25px; }
  .hide-xs { display: none; }
  .page-head .btn.sm { width: 40px; height: 40px; padding: 0; }
}

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