/* App "Do Caos ao Feito" — mobile primeiro. Usa tokens.css do planner (cores, fontes, temas). */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root { --nav-h: 64px; --maxw: 560px; --r: 16px; --r-s: 10px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }
html { background: var(--paper); }
body {
  font-family: var(--f-body); color: var(--ink); background: var(--paper);
  font-size: 16px; line-height: 1.4; min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }

.bar { position: sticky; top: 0; z-index: 15; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(8px); padding: calc(var(--safe-t) + 8px) 16px 8px; }
.bar[hidden] { display: none; }
.bar-in { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 8px; }
.bar .brand { flex: 1; min-width: 0; }
.ideabtn { height: 34px; padding: 0 13px; border-radius: 17px; background: var(--c5-soft); color: var(--ink); font-weight: 700; font-size: 13px; }
.cap::first-letter { text-transform: uppercase; }
.top, main { max-width: var(--maxw); margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.top { padding-top: 4px; padding-bottom: 6px; }
main { padding-top: 6px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- tipografia ---------- */
.h1 { font-family: var(--f-display); font-weight: 600; font-size: 28px; line-height: 1.05; letter-spacing: -.01em; }
.h2 { font-family: var(--f-display); font-weight: 600; font-size: 19px; line-height: 1.15; }
.h3 { font-family: var(--f-display); font-weight: 600; font-size: 16px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.hand { font-family: var(--f-hand); font-weight: 500; font-size: 22px; color: var(--accent); line-height: 1; }

/* ---------- topo ---------- */
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 600; font-size: 15px; color: var(--ink-soft); }
.brand svg { width: 28px; height: 18px; }
.datebar { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.datebar .when { flex: 1; min-width: 0; }
.datebar .when b { display: block; font-family: var(--f-display); font-size: 24px; line-height: 1.1; }
.datebar .when b::first-letter { text-transform: uppercase; }
.datebar .when span { font-size: 13px; color: var(--ink-soft); }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-size: 20px; font-weight: 700; color: var(--ink-soft); flex: none; }
.iconbtn:active { background: var(--line); }
.todaybtn { height: 44px; padding: 0 14px; border-radius: 22px; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 14px; }

/* ---------- cartões ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card.soft { background: var(--paper-2); border-color: transparent; }
.card.one { border: 2px solid var(--accent); }
.card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.card-h .right { margin-left: auto; font-size: 13px; color: var(--ink-soft); }
.k-a { --k: var(--accent); --ks: var(--accent-soft); }
.k-2 { --k: var(--c2); --ks: var(--c2-soft); }
.k-3 { --k: var(--c3); --ks: var(--c3-soft); }
.k-4 { --k: var(--c4); --ks: var(--c4-soft); }
.k-5 { --k: var(--c5); --ks: var(--c5-soft); }
.tint { background: var(--ks); border-color: transparent; }

/* ---------- campos ---------- */
.inp, .area, .sel {
  width: 100%; border: 0; border-bottom: 1.5px solid var(--line-dark); background: transparent;
  padding: 10px 2px; font-size: 16px; border-radius: 0; outline: none;
}
.inp:focus, .area:focus, .sel:focus { border-bottom-color: var(--accent); }
.area { min-height: 96px; resize: vertical; line-height: 1.5; background-image: repeating-linear-gradient(transparent 0 28px, var(--line) 28px 29px); background-attachment: local; }
.sel { background: #fff; border: 1.5px solid var(--line-dark); border-radius: var(--r-s); padding: 10px; }
.lbl { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; display: block; }
.row { display: flex; align-items: center; gap: 10px; }
.row > .grow { flex: 1; min-width: 0; }

/* caixinha de marcar */
.chk { width: 26px; height: 26px; flex: none; border: 2px solid var(--ink-faint); border-radius: 7px; background: #fff; display: grid; place-items: center; }
.chk.round { border-radius: 50%; }
.chk.on { background: var(--accent); border-color: var(--accent); }
.chk.on::after { content: ""; width: 7px; height: 12px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.tick { display: flex; align-items: center; gap: 10px; min-height: 44px; width: 100%; text-align: left; }
.tick.done .tx { text-decoration: line-through; color: var(--ink-faint); }
.todo { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--line); }
.todo .inp { border: 0; flex: 1; padding: 8px 0; }
.todo.done .inp { text-decoration: line-through; color: var(--ink-faint); }
.x { width: 36px; height: 36px; border-radius: 50%; color: var(--ink-faint); font-size: 20px; flex: none; }
.add { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-weight: 700; font-size: 14px; min-height: 44px; }

.btn { height: 46px; padding: 0 18px; border-radius: 23px; background: var(--accent); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.sec { background: var(--paper-2); color: var(--ink); }
.btn.line { background: #fff; border: 1.5px solid var(--line-dark); color: var(--ink); }
.btn.full { width: 100%; }
.btn.s { height: 36px; padding: 0 14px; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 20px; background: var(--paper-2); color: var(--ink-soft); min-height: 32px; }
.chip.on { background: var(--ks, var(--ink)); color: var(--ink); box-shadow: inset 0 0 0 2px var(--k, var(--ink)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- energia ---------- */
.energy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.en { border-radius: var(--r); padding: 12px 8px; text-align: center; border: 2px solid transparent; background: var(--ks); display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 96px; justify-content: center; }
.en svg { width: 34px; height: 34px; }
.en b { font-size: 15px; }
.en span { font-size: 12px; color: var(--ink-soft); line-height: 1.2; }
.en.on { border-color: var(--k); box-shadow: 0 2px 10px rgba(0,0,0,.08); }

/* ---------- água, refeições ---------- */
.drops { display: flex; gap: 4px; flex-wrap: wrap; }
.drop { width: 34px; height: 44px; display: grid; place-items: center; }
.drop svg { width: 26px; height: 32px; fill: transparent; stroke: var(--c3); stroke-width: 1.8; }
.drop.on svg { fill: var(--c3); }
.meals { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- blocos de horário ---------- */
.slots { display: flex; flex-direction: column; }
.slot { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); min-height: 46px; }
.slot b { width: 34px; color: var(--c3); font-size: 14px; flex: none; }
.slot .inp { border: 0; padding: 8px 0; }
.slot.now b { color: var(--accent); }
.slot.now { background: linear-gradient(90deg, var(--accent-soft), transparent); }

/* ---------- agenda ---------- */
.ev { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev .tx { flex: 1; min-width: 0; }
.ev .tx b { display: block; font-weight: 700; overflow-wrap: anywhere; }
.ev .tx span { font-size: 13px; color: var(--ink-soft); }
.ev.done .tx b { text-decoration: line-through; color: var(--ink-faint); }
.daytitle { font-family: var(--f-display); font-weight: 600; font-size: 15px; margin: 6px 0 2px; color: var(--ink-soft); }
.daytitle::first-letter, .dia b::first-letter { text-transform: uppercase; }
.bell { font-size: 12px; }

/* ---------- ideias ---------- */
.idea { padding: 12px 0; border-top: 1px solid var(--line); }
.idea:first-of-type { border-top: 0; }
.idea p { overflow-wrap: anywhere; margin-bottom: 8px; }

/* ---------- diário ---------- */
.dia { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.dia b { display: block; font-family: var(--f-display); }
.dia .l { font-size: 14px; color: var(--ink-soft); margin-top: 4px; overflow-wrap: anywhere; }
.dia .meta { display: flex; gap: 10px; font-size: 12px; color: var(--ink-faint); margin-top: 6px; }

/* ---------- avisos ---------- */
.banner { background: var(--c2-soft); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.banner.warn { background: var(--c4-soft); }
#toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 10px); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 14px; max-width: 520px; width: 100%; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 15px; display: flex; gap: 10px; align-items: center; }
.toast b { display: block; }
.toast .x { color: var(--paper); opacity: .7; margin-left: auto; }

/* ---------- navegação inferior ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: center;
}
.nav-in { width: 100%; max-width: var(--maxw); display: grid; grid-template-columns: repeat(5, 1fr); }
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--ink-faint); min-height: var(--nav-h); }
.nav button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav button.on { color: var(--accent); }
.nav .badge { position: relative; }
.nav .badge i { position: absolute; top: -4px; right: -8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-style: normal; display: grid; place-items: center; }

/* ---------- passos (Plano de volta) ---------- */
.step { display: flex; gap: 12px; }
.step-n { width: 32px; height: 32px; border-radius: 50%; background: var(--c2-soft); color: var(--c2); font-family: var(--f-display); font-weight: 700; display: grid; place-items: center; flex: none; }
.step > div { flex: 1; min-width: 0; }

.empty { text-align: center; color: var(--ink-soft); padding: 18px 8px; }
.empty .hand { display: block; margin-bottom: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }

@media (min-width: 760px) {
  :root { --maxw: 640px; }
  body { padding-top: 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, .en, .iconbtn { transition: transform .08s ease; }
  .btn:active, .chip:active, .en:active { transform: scale(.97); }
}

/* =========================================================
   Componentes das 20 páginas
   ========================================================= */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.inp:focus-visible, .area:focus-visible { outline: none; }
body.noscroll { overflow: hidden; }
body.has-timer { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 70px); }
.lead { font-size: 15px; color: var(--ink-soft); }
.top-lead { margin-top: 6px; }
.go { color: var(--accent); font-weight: 700; font-size: inherit; white-space: nowrap; text-align: left; }
.back { color: var(--ink-soft); font-weight: 700; font-size: 14px; min-height: 36px; display: inline-flex; align-items: center; margin: 4px 0 0 -4px; padding: 0 4px; }
.card.k { border-left: 6px solid var(--k, var(--accent)); }
.card.tint { background: var(--ks, var(--accent-soft)); border-color: transparent; border-left-color: var(--k, var(--accent)); }
.chip[class*="k-"]:not(.on) { background: var(--ks); color: var(--ink); }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary.card-h { margin-bottom: 0; }
details[open] > summary.card-h { margin-bottom: 8px; }
details > summary .right::after { content: " ▾"; }
details[open] > summary .right::after { content: " ▴"; }

/* topo */
.bar .sos { height: 34px; padding: 0 14px; border-radius: 17px; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .08em; }
.datebar .when b::first-letter, .daytitle::first-letter, .dia b::first-letter { text-transform: uppercase; }

/* painel deslizante */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(30,25,35,.45); animation: fade .15s ease; }
.sheet-box { position: relative; width: 100%; max-width: var(--maxw); max-height: 88dvh; overflow: auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 12px 18px calc(22px + var(--safe-b)); animation: up .2s ease; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-dark); margin: 0 auto 14px; }
.sos-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.sos-item { text-align: left; padding: 16px; border-radius: var(--r); background: var(--accent-soft); font-weight: 700; font-size: 17px; }
.sos-item:active { background: var(--accent); color: #fff; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(30px); opacity: .6 } }

/* timer */
#timerbar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 21; margin: 0 auto; max-width: calc(var(--maxw) - 24px); width: calc(100% - 24px); background: var(--ink); color: var(--paper); border-radius: 16px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 6px 22px rgba(0,0,0,.3); }
#timerbar[hidden] { display: none; }
#timerbar .tt { font-family: var(--f-display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
#timerbar .tl { flex: 1; font-size: 14px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#timerbar .x { color: var(--paper); }

/* barras, valores */
.bar { height: 10px; border-radius: 5px; background: rgba(0,0,0,.08); overflow: hidden; margin: 8px 0 4px; }
.bar.sm { height: 6px; margin: 6px 0 2px; }
.bar i { display: block; height: 100%; border-radius: 5px; background: var(--k, var(--c2)); transition: width .3s ease; }
.card:not(.tint) .bar i { background: var(--c2); }
.bigrs { font-family: var(--f-display); font-weight: 600; font-size: 34px; line-height: 1.1; letter-spacing: -.01em; }
.bigrs small { font-size: 15px; font-weight: 400; color: var(--ink-soft); font-family: var(--f-body); }
.thermo { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.thermo i { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-dark); background: #fff; }
.thermo i.on { background: var(--c4); border-color: var(--c4); }
.thermo b { font-size: 12px; align-self: center; }
.bars { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.barrow { display: flex; align-items: center; gap: 8px; }
.barrow b { width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; display: grid; place-items: center; flex: none; }
.barrow .bt { flex: 1; height: 10px; border-radius: 5px; background: rgba(0,0,0,.07); overflow: hidden; }
.barrow .bt i { display: block; height: 100%; border-radius: 5px; transition: width .3s ease; }
.barrow em { font-style: normal; font-size: 13px; width: 92px; text-align: right; font-variant-numeric: tabular-nums; }

/* linhas financeiras */
.fin-row { padding: 10px 0; border-top: 1px solid var(--line); }
.fin-row:first-of-type { border-top: 0; }
.fin-row.paid { opacity: .6; }
.fin-row.hot { background: var(--accent-soft); margin: 0 -14px; padding: 10px 14px; border-radius: var(--r-s); }
.inp.sm { text-align: center; padding-left: 0; padding-right: 0; }
.inp.money { width: 84px; flex: none; text-align: right; }
.chip.tx.on { background: var(--k); color: #fff; box-shadow: none; }
.chip.tx { min-width: 34px; justify-content: center; }
.tlist { display: flex; flex-direction: column; }

/* hábitos */
.hab-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.hab-row:first-of-type { border-top: 0; }
.hab-row .tx { flex: 1; min-width: 0; } .hab-row .tx b { display: block; } .hab-row .tx span { font-size: 13px; color: var(--ink-soft); }
.hab-b, .hd { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--c2); background: #fff; flex: none; font-size: 12px; color: var(--ink-soft); font-weight: 700; display: grid; place-items: center; padding: 0; }
.hab-b { width: 44px; height: 44px; }
.hab-b.s1, .hd.s1 { background: linear-gradient(90deg, var(--c2) 50%, #fff 50%); }
.hab-b.s2, .hd.s2 { background: var(--c2); color: #fff; }
.hab-b.s1 { color: transparent; }
.hdays { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; margin-top: 10px; justify-items: center; }
.hd.now { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.hd.s1 { text-shadow: 0 0 3px #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; align-items: center; }
.legend .hd { display: inline-block; width: 20px; height: 20px; vertical-align: middle; margin-right: 4px; pointer-events: none; }

/* calendário do mês */
.cal-dow, .cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow span { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); padding-bottom: 4px; }
.mc { aspect-ratio: 1 / 1.05; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0; }
.mc.empty { background: none; border: 0; }
.mc.we { background: var(--paper-2); }
.mc.today { border: 2px solid var(--accent); background: var(--accent-soft); }
.mc b { font-size: 15px; }
.mc i { display: flex; gap: 3px; height: 7px; }
.dt { display: inline-block; width: 7px; height: 7px; border-radius: 50%; text-decoration: none; }
.dt.c3 { background: var(--c3); } .dt.c2 { background: var(--c2); }
.evd { width: 32px; height: 32px; border-radius: 50%; background: var(--c3-soft); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.wk-day { padding: 12px; }
.wk-day.today { border: 2px solid var(--accent); }
.wk-day .card-h { flex-wrap: wrap; row-gap: 4px; }
.quick { display: flex; gap: 8px; align-items: center; }
.quick .btn { width: 44px; padding: 0; flex: none; }

/* mapa */
.maplist { padding: 12px 14px; }
.mp-gt { color: var(--ink-soft); margin-bottom: 4px; }
.mp-r { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; width: 100%; text-align: left; padding: 9px 0; border-top: 1px solid rgba(0,0,0,.07); min-height: 52px; }
.mp-r:first-of-type { border-top: 0; }
.mp-n { grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 50%; background: var(--ks); display: grid; place-items: center; font-family: var(--f-display); font-size: 13px; font-weight: 700; }
.mp-t { font-family: var(--f-display); font-weight: 600; font-size: 17px; line-height: 1.15; }
.mp-d { font-size: 13px; color: var(--ink-soft); }
.rules { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.situ { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.situ:first-of-type { border-top: 0; }
.situ b { color: var(--accent); font-size: 14px; }

/* capa */
.cover { padding-top: calc(var(--safe-t) + 28px); display: flex; flex-direction: column; gap: 6px; min-height: 100dvh; padding-bottom: 40px; }
.cover-line { width: 86%; max-width: 360px; margin: 0 0 8px -4px; }
.cover-title { font-family: var(--f-display); font-weight: 700; font-size: clamp(46px, 14vw, 72px); line-height: .92; letter-spacing: -.02em; margin-top: 6px; }
.cover-sub { font-size: 18px; color: var(--ink-soft); margin-top: 12px; line-height: 1.4; }
.pillars { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.pillars > div { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--ink-soft); }
.pillars b { color: var(--ink); }
.pillars .chip { flex: none; width: 30px; height: 30px; justify-content: center; padding: 0; }
body:has(.cover) { padding-bottom: 20px; }
body:has(.cover) main { padding-top: 0; }
.sub { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 14px 0 2px; }

.ta { resize: none; overflow: hidden; display: block; line-height: 1.35; min-height: 24px; font-family: inherit; }
.todo .ta { padding: 11px 0; border-bottom: 0; }
.todo { align-items: center; }

/* assistente com IA */
.btn.ai { background: var(--c5-soft); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--c5); }
.sheet-box ul li { overflow-wrap: anywhere; }
a.btn { text-decoration: none; }
