/* Segundo Cérebro — estilo do guia "Meu Financeiro".
   Padrão: "Caminho", as cores do ícone (verde-escuro #173330, verde-menta #8FD1C4 e creme #EEF6F4).
   Verde-água e as outras paletas do financeiro ficam como opção em Ajustes › Aparência. */
:root {
  --bg: #EEF6F4;
  --surface: #FFFFFF;
  --surface2: #F3F8F6;
  --border: #D3E6E0;
  --text: #173330;
  --muted: #55706A;
  --accent: #173330;
  --on-accent: #8FD1C4;
  --accent-soft: #D7EEE8;
  --accent-ink: #1F5F55;
  --hero: #173330;
  --hero-text: #EEF6F4;
  --hero-muted: #A9C7C0;
  --hero-btn: #8FD1C4;      /* botão e barra dentro do cartão de cima */
  --c-ok: #3F9A88;          /* "fez o mínimo" nos gráficos */
  --hero-btn-ink: #123030;
  --soft: #E2F0EC;
  --pos: #15805A;
  --pos-soft: #E2F3EA;
  --warn: #94600E;
  --warn-soft: #FAF0DB;
  --neg: #B23A32;
  --neg-soft: #F8E5E3;
  --hero-chip: rgba(255, 255, 255, .10);
  --hero-chip-press: rgba(255, 255, 255, .16);
  --hero-line: rgba(255, 255, 255, .14);
  --strike: rgba(85, 112, 106, .5);
  --c-warn: #E6B15B;
  --c-neg: #D9796F;
  --danger-line: #EBC9C5;
  --opt-on: #F1F9F7;
  --radio: #B9D2CB;
  --ring: rgba(23, 51, 48, .18);
  --warn-ink: #6B460B;
  --neg-ink: #7E2620;
  --pos-ink: #0F5C41;
  --fab-shadow: 0 8px 20px rgba(23, 51, 48, .30);
  --overlay: rgba(23, 51, 48, .45);
  --sheet-shadow: 0 -8px 30px rgba(0, 0, 0, .14);
  --toast-bg: #173330;
  --toast-ink: #EEF6F4;
  --toast-act: #8FD1C4;
  --cal-out: #A9BDB8;
  --toggle-off: #C9DCD7;
  --knob: #FFFFFF;
  --ico-p: 100%; /* quanto da cor da área vai no ícone (no escuro, clareia) */
  --r-hero: 24px;
  --r-card: 20px;
  --r-btn: 14px;
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

/* ---------- Caminho no escuro ---------- */
:root[data-theme="dark"] {
  --bg: #0E1B19; --surface: #152724; --surface2: #192F2C; --border: #26423E;
  --text: #EEF6F4; --muted: #A3BDB7;
  --accent: #8FD1C4; --on-accent: #123030; --accent-soft: #1E3D39; --accent-ink: #A8DDD2;
  --hero: #1D3B37; --hero-text: #F2FAF8; --hero-muted: #A9C7C0;
  --hero-btn: #8FD1C4; --hero-btn-ink: #123030; --c-ok: #8FD1C4;
  --soft: #1A302D;
  --pos: #5CC79B; --pos-soft: #143027; --warn: #E6B15B; --warn-soft: #352812; --neg: #F28B7F; --neg-soft: #3A201D;
  --hero-chip: rgba(255, 255, 255, .10); --hero-chip-press: rgba(255, 255, 255, .16); --hero-line: rgba(255, 255, 255, .12);
  --strike: rgba(163, 189, 183, .5);
  --c-warn: #D9A54E; --c-neg: #D98378;
  --danger-line: #5A2E2A; --opt-on: #1A3632; --radio: #3A5A55; --ring: rgba(143, 209, 196, .3);
  --warn-ink: #F2CC8A; --neg-ink: #F6B1A8; --pos-ink: #9FE0C1;
  --fab-shadow: 0 8px 20px rgba(0, 0, 0, .5); --overlay: rgba(0, 0, 0, .62); --sheet-shadow: 0 -8px 30px rgba(0, 0, 0, .5);
  --toast-bg: #EEF6F4; --toast-ink: #0E1B19; --toast-act: #1F5F55;
  --cal-out: #4E6762; --toggle-off: #334A46; --knob: #F2FAF8;
  --ico-p: 72%;
  color-scheme: dark;
}

/* ---------- verde-água (o visual da primeira versão) ---------- */
:root[data-palette="agua"]:not([data-theme="dark"]) {
  --c-ok: var(--accent);
  --accent: #6BB8A8; --on-accent: #0F3A34; --accent-soft: #D8EFE9; --accent-ink: #1F5F55;
  --hero: #CDE9E2; --hero-text: #123631; --hero-muted: #3F625B;
  --hero-btn: var(--accent); --hero-btn-ink: var(--on-accent);
  --hero-chip: rgba(18, 54, 49, .08); --hero-chip-press: rgba(18, 54, 49, .14); --hero-line: rgba(18, 54, 49, .10);
  --ring: rgba(107, 184, 168, .25);
  --fab-shadow: 0 8px 20px rgba(15, 58, 52, .22);
  --toast-bg: #123631; --toast-ink: #FFFFFF; --toast-act: #A8E0D3;
}
:root[data-palette="agua"][data-theme="dark"] {
  --c-ok: var(--accent);
  --bg: #0D1514; --surface: #141E1C; --surface2: #18231F; --border: #273733;
  --text: #E6F0EE; --muted: #9AAEA9;
  --accent: #8FD1C4; --on-accent: #0E2D28; --accent-soft: #1B3430; --accent-ink: #A8DDD2;
  --hero: #1E3632; --hero-text: #F2FAF8; --hero-muted: #A9C7C0;
  --hero-btn: var(--accent); --hero-btn-ink: var(--on-accent);
  --soft: #1A2725;
  --strike: rgba(154, 174, 169, .5);
  --opt-on: #17302C; --radio: #3A524D;
  --toast-bg: #E6F0EE; --toast-ink: #0D1514; --toast-act: #1F5F55;
  --cal-out: #4E625D; --toggle-off: #33443F;
}

/* ---------- outras paletas do Meu Financeiro: fundo e destaque do guia, o resto derivado ---------- */
:root[data-palette="azul"]   { --p-bg: #EFF3FB; --p-ac: #82A3E6; --p-bg-d: #0D121C; --p-ac-d: #A9C1F2; }
:root[data-palette="verde"]  { --p-bg: #F0F6EE; --p-ac: #7EBE90; --p-bg-d: #0E140F; --p-ac-d: #A6D8B3; }
:root[data-palette="rosa"]   { --p-bg: #FBF2F5; --p-ac: #DE93AF; --p-bg-d: #160F12; --p-ac-d: #F0B5CA; }
:root[data-palette="preto"]  { --p-bg: #F4F4F5; --p-ac: #18181B; --p-bg-d: #000000; --p-ac-d: #F4F4F5; }
:root[data-palette="branco"] { --p-bg: #FFFFFF; --p-ac: #4A4640; --p-bg-d: #1C1C1E; --p-ac-d: #ECEAE5; }

/* :where() deixa esta regra fraca, para as exceções de preto e branco logo abaixo valerem */
:root:where([data-palette="azul"], [data-palette="verde"], [data-palette="rosa"], [data-palette="preto"], [data-palette="branco"]):where(:not([data-theme="dark"])) {
  --hero-btn: var(--accent); --hero-btn-ink: var(--on-accent); --c-ok: var(--accent);
  --bg: var(--p-bg);
  --surface: #FFFFFF;
  --surface2: color-mix(in srgb, var(--p-ac) 6%, var(--p-bg));
  --soft: color-mix(in srgb, var(--p-ac) 11%, var(--p-bg));
  --border: color-mix(in srgb, var(--p-ac) 20%, #DCDCDC);
  --text: color-mix(in srgb, var(--p-ac) 18%, #141414);
  --muted: color-mix(in srgb, var(--p-ac) 25%, #5A5A5A);
  --accent: var(--p-ac);
  --on-accent: color-mix(in srgb, var(--p-ac) 30%, #0A0A0A);
  --accent-soft: color-mix(in srgb, var(--p-ac) 24%, #FFFFFF);
  --accent-ink: color-mix(in srgb, var(--p-ac) 50%, #0A0A0A);
  --hero: color-mix(in srgb, var(--p-ac) 30%, var(--p-bg));
  --hero-text: color-mix(in srgb, var(--p-ac) 25%, #0B0B0B);
  --hero-muted: color-mix(in srgb, var(--p-ac) 35%, #4A4A4A);
  --hero-chip: rgba(0, 0, 0, .06); --hero-chip-press: rgba(0, 0, 0, .11); --hero-line: rgba(0, 0, 0, .09);
  --opt-on: color-mix(in srgb, var(--p-ac) 8%, #FFFFFF);
  --radio: color-mix(in srgb, var(--p-ac) 35%, #D0D0D0);
  --ring: color-mix(in srgb, var(--p-ac) 30%, transparent);
  --toast-bg: var(--hero-text); --toast-act: color-mix(in srgb, var(--p-ac) 45%, #FFFFFF);
  --cal-out: color-mix(in srgb, var(--p-ac) 15%, #ABABAB);
  --toggle-off: color-mix(in srgb, var(--p-ac) 18%, #D0D0D0);
  --fab-shadow: 0 8px 20px rgba(0, 0, 0, .2);
  --overlay: rgba(10, 10, 10, .45);
}
:root[data-palette="preto"]:not([data-theme="dark"]),
:root[data-palette="branco"]:not([data-theme="dark"]) {
  --on-accent: #FFFFFF;
  --accent-soft: color-mix(in srgb, var(--p-ac) 9%, #FFFFFF);
  --accent-ink: var(--p-ac);
  --hero: color-mix(in srgb, var(--p-ac) 8%, var(--p-bg));
  --toast-act: #FFFFFF;
}
:root:is([data-palette="azul"], [data-palette="verde"], [data-palette="rosa"], [data-palette="preto"], [data-palette="branco"])[data-theme="dark"] {
  --hero-btn: var(--accent); --hero-btn-ink: var(--on-accent); --c-ok: var(--accent);
  --bg: var(--p-bg-d);
  --surface: color-mix(in srgb, var(--p-ac-d) 5%, color-mix(in srgb, var(--p-bg-d) 93%, #FFFFFF));
  --surface2: color-mix(in srgb, var(--p-ac-d) 6%, color-mix(in srgb, var(--p-bg-d) 90%, #FFFFFF));
  --soft: color-mix(in srgb, var(--p-ac-d) 8%, color-mix(in srgb, var(--p-bg-d) 86%, #FFFFFF));
  --border: color-mix(in srgb, var(--p-ac-d) 10%, color-mix(in srgb, var(--p-bg-d) 80%, #FFFFFF));
  --text: color-mix(in srgb, var(--p-ac-d) 12%, #F2F2F2);
  --muted: color-mix(in srgb, var(--p-ac-d) 25%, #9A9A9A);
  --accent: var(--p-ac-d);
  --on-accent: color-mix(in srgb, var(--p-ac-d) 22%, #0A0A0A);
  --accent-soft: color-mix(in srgb, var(--p-ac-d) 18%, var(--p-bg-d));
  --accent-ink: var(--p-ac-d);
  --hero: color-mix(in srgb, var(--p-ac-d) 17%, var(--p-bg-d));
  --hero-text: #F5F5F5;
  --hero-muted: color-mix(in srgb, var(--p-ac-d) 40%, #A0A0A0);
  --opt-on: color-mix(in srgb, var(--p-ac-d) 12%, var(--p-bg-d));
  --radio: color-mix(in srgb, var(--p-ac-d) 30%, #3A3A3A);
  --ring: color-mix(in srgb, var(--p-ac-d) 30%, transparent);
  --toast-bg: #F2F2F2; --toast-ink: #111111; --toast-act: color-mix(in srgb, var(--p-ac-d) 40%, #0A0A0A);
  --cal-out: color-mix(in srgb, var(--p-ac-d) 10%, #555555);
  --toggle-off: color-mix(in srgb, var(--p-ac-d) 12%, #3A3A3A);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent-ink); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- estrutura ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.page { padding: calc(14px + var(--safe-t)) 16px calc(var(--nav-h) + 28px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.topbar .date { font-size: 12.5px; color: var(--muted); }
.topbar .title { font-size: 18px; font-weight: 800; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: #8FD1C4; color: #173330; overflow: hidden; display: flex; align-items: center; justify-content: center; flex: none; }
.ib { width: 44px; height: 44px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--text); flex: none; padding: 0; }
.ib:active { background: var(--surface2); }
.sec { font-size: 12.5px; font-weight: 800; color: var(--muted); margin: 6px 4px -4px; text-transform: uppercase; letter-spacing: .04em; }
.help { color: var(--muted); font-size: 12.5px; margin: 0; }
.muted { color: var(--muted); }

/* ---------- hero ---------- */
.hero { background: var(--hero); color: var(--hero-text); border-radius: var(--r-hero); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.hl { font-size: 12.5px; font-weight: 700; color: var(--hero-muted); }
.htitle { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
.hsub { font-size: 14px; color: var(--hero-muted); }
.hline { height: 1px; background: var(--hero-line); }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mid { font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.tiny { font-size: 11.5px; color: var(--hero-muted); }
.hchips { display: flex; gap: 8px; flex-wrap: wrap; }
.hchip { background: var(--hero-chip); border: 0; border-radius: 14px; min-height: 44px; padding: 0 14px; font-weight: 700; font-size: 14px; color: var(--hero-text); display: inline-flex; align-items: center; gap: 8px; }
.hchip:active { background: var(--hero-chip-press); }
.hero .btn { align-self: stretch; background: var(--hero-btn); color: var(--hero-btn-ink); }
.hero .bar i { background: var(--hero-btn); }

/* ---------- cartões e listas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: flex-start; gap: 8px; }
.ct { font-size: 16px; font-weight: 800; margin: 0; }
.cs { font-size: 12.5px; color: var(--muted); margin: 2px 0 0; }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); color: var(--text); background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100%; }
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
button.row, a.row { cursor: pointer; }
.ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.ico.sm { width: 32px; height: 32px; border-radius: 10px; }
.rt { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.rs { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.val { font-size: 14.5px; font-weight: 800; text-align: right; white-space: nowrap; }
.val.ok { color: var(--pos); }
.done-text .rt { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--strike); }
.empty { font-size: 13.5px; color: var(--muted); padding: 4px 0; }
.date-box { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; line-height: 1.1; }
.date-box b { font-size: 13px; font-weight: 800; }
.date-box span { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.date-box.now { background: var(--accent); }
.date-box.now b { color: var(--on-accent); }
.dot { width: 10px; height: 10px; border-radius: 99px; display: inline-block; flex: none; }

.tag { font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; display: inline-block; background: var(--soft); color: var(--accent-ink); }
.tag.ok { background: var(--pos-soft); color: var(--pos); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.neg { background: var(--neg-soft); color: var(--neg); }

.bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar i.warn { background: var(--c-warn); }
.bar i.neg { background: var(--c-neg); }

.chk { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; padding: 0; }
.chk.done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chk:active { transform: scale(.96); }

.next { display: flex; gap: 8px; align-items: baseline; font-size: 13px; background: var(--surface2); border-radius: 12px; padding: 8px 10px; }

/* ---------- botões ---------- */
.btn { min-height: 48px; border-radius: var(--r-btn); border: 0; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 15px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.btn:active { filter: brightness(.95); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn2 { min-height: 48px; border-radius: var(--r-btn); border: 0; background: var(--soft); color: var(--text); font-weight: 800; font-size: 15px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-danger { min-height: 48px; border-radius: var(--r-btn); border: 1px solid var(--danger-line); background: var(--surface); color: var(--neg); font-weight: 800; font-size: 15px; padding: 0 16px; }
.btns { display: flex; gap: 8px; }
.btns > * { flex: 1; }
.dashed { min-height: 44px; border-radius: 14px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: var(--muted); background: none; width: 100%; }
.link { background: none; border: 0; padding: 0 4px; min-height: 44px; font-weight: 800; font-size: 13px; color: var(--accent-ink); display: inline-flex; align-items: center; gap: 4px; }

/* ---------- chips e seletores ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days .chip { padding: 0; justify-content: center; min-height: 40px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sb { min-height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: 12.5px; color: var(--text); padding: 0 4px; }
.sb.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.opt { display: flex; align-items: center; gap: 12px; min-height: 56px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--text); text-align: left; width: 100%; }
.opt.on { border-color: var(--accent); background: var(--opt-on); box-shadow: inset 0 0 0 1px var(--accent); }
.radio { width: 22px; height: 22px; border-radius: 99px; border: 2px solid var(--radio); flex: none; display: flex; align-items: center; justify-content: center; }
.opt.on .radio { border-color: var(--accent-ink); }
.opt.on .radio::after { content: ""; width: 10px; height: 10px; border-radius: 99px; background: var(--accent-ink); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 36px; height: 36px; border-radius: 99px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--accent-ink); }

/* ---------- formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input { min-height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); padding: 0 14px; font-weight: 600; font-size: 16px; width: 100%; color: var(--text); }
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.big-input { min-height: 96px; border-radius: 14px; border: 1px solid var(--accent); background: var(--surface); padding: 14px 60px 14px 14px; font-weight: 800; font-size: 20px; letter-spacing: -.01em; width: 100%; resize: none; line-height: 1.3; color: var(--text); }
.big-input:focus { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.note { border-radius: 14px; padding: 12px 14px; font-size: 13.5px; background: var(--surface2); }
.note.warn { background: var(--warn-soft); color: var(--warn-ink); }
.note.neg { background: var(--neg-soft); color: var(--neg-ink); }
.note.ok { background: var(--pos-soft); color: var(--pos-ink); }
.soft { display: flex; align-items: center; gap: 10px; background: var(--surface2); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: var(--text); }
.search { display: flex; align-items: center; gap: 10px; min-height: 48px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); padding: 0 14px; color: var(--muted); }
.search input { border: 0; outline: 0; flex: 1; font-weight: 600; font-size: 16px; color: var(--text); background: transparent; min-width: 0; min-height: 46px; }
.qbox { display: flex; gap: 12px; align-items: center; background: var(--hero); border-radius: 20px; padding: 14px 16px; color: var(--hero-text); }
.num { width: 32px; height: 32px; border-radius: 99px; background: var(--soft); color: var(--text); font-size: 14px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.num.done { background: var(--accent); color: var(--on-accent); }

/* ---------- barra de baixo ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-b); }
.nav-in { max-width: 560px; margin: 0 auto; height: var(--nav-h); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; padding-top: 8px; }
.nv { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: var(--muted); background: none; border: 0; padding: 0; }
.pill { width: 48px; height: 28px; border-radius: 99px; display: flex; align-items: center; justify-content: center; }
.nv.on { color: var(--accent-ink); }
.nv.on .pill { background: var(--accent-soft); }
.plus { width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--on-accent); margin: -24px auto 0; display: flex; align-items: center; justify-content: center; box-shadow: var(--fab-shadow); border: 0; }

/* ---------- folhas (sheets) ---------- */
.layer { position: fixed; inset: 0; z-index: 40; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px - var(--safe-t)); overflow: auto; border-radius: 24px 24px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--sheet-shadow); animation: up .2s ease-out; overscroll-behavior: contain; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.handle { width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; flex: 1; }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + var(--safe-b)); transform: translateX(-50%); z-index: 60; background: var(--toast-bg); color: var(--toast-ink); font-weight: 700; font-size: 14px; padding: 12px 16px; border-radius: 14px; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); display: flex; gap: 12px; align-items: center; }
.toast button { background: none; border: 0; color: var(--toast-act); font-weight: 800; min-height: 32px; }

/* ---------- agenda ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.cal .wd { font-size: 11.5px; font-weight: 800; color: var(--muted); padding: 4px 0; }
.cal button { background: none; border: 0; border-radius: 12px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-weight: 700; font-size: 14px; color: var(--text); padding: 2px 0; }
.cal button.out { color: var(--cal-out); }
.cal button.today { color: var(--accent-ink); font-weight: 800; box-shadow: inset 0 0 0 1px var(--accent); }
.cal button.sel { background: var(--accent); color: var(--on-accent); }
.cal .dots { display: flex; gap: 2px; height: 6px; }
.cal .dots i { width: 5px; height: 5px; border-radius: 99px; display: block; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 14px; font-weight: 700; }
.toggle input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--toggle-off); position: relative; flex: none; margin: 0; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 99px; background: var(--knob); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(20px); }

/* ---------- gráficos ---------- */
.chart { width: 100%; height: auto; display: block; }
.grid-areas { display: grid; gap: 4px; align-items: center; font-size: 12px; }
.grid-areas .cell { height: 22px; border-radius: 6px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- entrada ---------- */
.login { max-width: 420px; margin: 0 auto; padding: calc(40px + var(--safe-t)) 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.loading { min-height: 60vh; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }

@media (min-width: 700px) {
  .layer { align-items: center; }
  .sheet { border-radius: 24px; max-height: calc(100vh - 80px); }
}

/* ---------- gráficos (texto e eixos seguem o tema) ---------- */
.chart .ch-t { fill: var(--text); }
.chart .ch-m { fill: var(--muted); }
.chart .ch-axis { stroke: var(--border); }
.chart .ch-dot { fill: var(--surface); }

/* ---------- aparência ---------- */
.palettes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.palettes button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 16px; padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; font-weight: 700; min-height: 56px; min-width: 0; }
.palettes button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palettes button b { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1px solid rgba(0, 0, 0, .08); }
.palettes button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* código do diário */
.input.pin { text-align: center; letter-spacing: .35em; font-size: 20px; font-weight: 800; }
.input.pin::placeholder { letter-spacing: normal; font-size: 15px; font-weight: 600; }

/* Guardados › Diário */
.card.door { flex-direction: row; align-items: center; gap: 12px; text-align: left; width: 100%; color: var(--text); cursor: pointer; }
.pill-btn { min-height: 40px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 14px; font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; flex: none; }
.pill-btn:active { background: var(--surface2); }
.dz-day { gap: 0; }
.dz-entry { display: block; width: 100%; background: none; border: 0; padding: 0; text-align: left; color: var(--text); cursor: pointer; }
.dz-entry + .dz-entry { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dz-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 9; line-clamp: 9; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; font-size: 15px; line-height: 1.55; }
.dz-sep { height: 1px; background: var(--border); margin: 14px 0 12px; }
.dz-day .row .rt { font-weight: 700; }
.dz-foot { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 2px 8px; }
.dz-area { min-height: 260px; font-size: 15.5px; line-height: 1.55; resize: vertical; }

/* Base fixa › tipos */
.chip.chip-add { border-style: dashed; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.type-add { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.type-add .input { grid-column: 1 / -1; }

/* folha com alteração não salva: aviso preso embaixo */
.leave-bar { position: sticky; bottom: 0; z-index: 2; margin-top: auto; background: var(--toast-bg); color: var(--toast-ink); border-radius: 18px; padding: 12px 12px 12px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .22); animation: up .18s ease-out; }
.leave-bar .lb-t { flex: 1 1 180px; font-weight: 700; font-size: 14px; }
.leave-bar .lb-b { display: flex; gap: 8px; flex: 1 1 auto; justify-content: flex-end; }
.leave-bar button { min-height: 42px; border-radius: 12px; padding: 0 14px; font-weight: 800; font-size: 14px; border: 0; }
.leave-bar .lb-no { background: transparent; color: inherit; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); }
.leave-bar .lb-yes { background: var(--toast-act); color: var(--toast-bg); }
.leave-bar.nudge { animation: nudge .3s ease-in-out; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- v1.6 ---------- */
/* aba Tarefas: passar para hoje */
.today-btn { min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface2); color: var(--accent-ink); font-weight: 800; font-size: 12.5px; flex: none; }
.today-btn:active { background: var(--soft); }
/* como foi o dia */
.scores { display: flex; gap: 8px; }
.score { flex: 1; min-height: 52px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); font-size: 18px; font-weight: 800; color: var(--text); padding: 0; }
.score.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.score-legend { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: -4px; }
/* Evolução */
.quad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.stat3 { text-align: center; }
.stat3 > div { background: var(--surface2); border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; gap: 2px; }
.stat3 b { font-size: 22px; font-weight: 800; }
.stat3 b.warn { color: var(--warn); }
.stat3 span { font-size: 12px; color: var(--muted); font-weight: 700; }
.score-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ss { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ss b { width: 100%; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800;
  background: color-mix(in srgb, var(--c-ok) var(--h, 0%), var(--surface2)); color: var(--text); }
.ss.empty b { background: var(--surface2); color: var(--muted); font-weight: 700; }
.ss span { font-size: 11px; font-weight: 700; color: var(--muted); }
