/* ==========================================================================
   CapyLeve — design system + shell (web desktop + responsivo)
   v2 · refresh moderno
   Canvas arejado + ambiente luminoso, profundidade em camadas, superfícies
   "ink" para os momentos da Cacau, botões com gradiente/brilho e movimento
   com física de mola.
   Marca: docs/identidade-visual.md · brand-spec.md
   A paleta e as fontes da marca foram preservadas — mudou o *uso*.
   ========================================================================== */

@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }

:root {
  /* ── marca (valores originais, preservados) ─────────────────────────── */
  --creme: #FFF6EB;
  --creme-escuro: #F3E7D8;
  --caramelo: #C9956C;
  --caramelo-claro: #D4A87A;
  --caramelo-forte: #B37F53;
  --chocolate: #6B3F2A;
  --sage: #7BA88A;
  --sage-claro: #A8C9B5;
  --coral: #E8A090;
  --dourado: #E6C35C;
  --texto: #3D2B22;
  --texto-suave: #6B5348;
  --branco: #fff;
  --borda: #E8D5C4;
  --erro: #B54A3C;
  --erro-bg: #F8E0DC;
  --sucesso: #5A9E6F;
  --sucesso-bg: #E4F0E8;

  /* ── sistema: canvas, camadas e superfícies "ink" ───────────────────── */
  --bg: #FBF8F4;
  --surface: var(--branco);
  --surface-2: #F7F1E9;
  --border: var(--borda);
  --border-strong: #E0CDB9;
  --accent: var(--caramelo);

  /* chocolate profundo — onde a Cacau e a marca aparecem "sob os refletores" */
  --ink: #241410;
  --ink-2: #2E1B14;
  --ink-3: #3A2318;
  --on-ink: #FDF4EC;
  --on-ink-muted: rgba(253, 244, 236, .68);
  --on-ink-line: rgba(255, 255, 255, .12);
  --on-ink-fill: rgba(255, 255, 255, .07);

  /* papéis semânticos de texto */
  --fg: var(--texto);
  --heading: var(--chocolate);
  --muted: var(--texto-suave);

  --font-display: 'Plus Jakarta Sans', 'Nunito', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-full: 999px;

  --sh-xs: 0 1px 2px rgba(66, 38, 24, .05);
  --sh-sm: 0 1px 2px rgba(66, 38, 24, .05), 0 3px 8px -3px rgba(66, 38, 24, .09);
  --sh-md: 0 2px 4px rgba(66, 38, 24, .05), 0 12px 26px -10px rgba(66, 38, 24, .17);
  --sh-lg: 0 6px 14px -6px rgba(66, 38, 24, .10), 0 30px 60px -22px rgba(66, 38, 24, .28);
  --sh-glow: 0 10px 24px -10px rgba(201, 149, 108, .68);

  --ease: cubic-bezier(.23, 1, .32, 1);
  --spring: cubic-bezier(.34, 1.36, .44, 1);

  --rail: 244px;
  --aside: 356px;
}

/* ── reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--bg);
  /* ambiente: três halos quentes de baixa opacidade — dá profundidade ao
     canvas sem virar lavagem colorida */
  background-image:
    radial-gradient(760px 520px at 84% -6%, rgba(201, 149, 108, .15), transparent 68%),
    radial-gradient(620px 480px at -8% 12%, rgba(232, 160, 144, .12), transparent 70%),
    radial-gradient(560px 440px at 52% 108%, rgba(123, 168, 138, .10), transparent 72%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--fg);
  font: 400 15.5px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--heading);
  line-height: 1.14;
  letter-spacing: -.022em;
  font-weight: 700;
  text-wrap: balance;
}
h1 { font-size: clamp(28px, 2.6vw, 34px); }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

p { text-wrap: pretty; }
::selection { background: var(--sage-claro); }

:focus-visible {
  outline: 2.5px solid var(--caramelo-forte);
  outline-offset: 2px;
  border-radius: 8px;
}

/* scrollbars discretas */
* { scrollbar-width: thin; scrollbar-color: rgba(107, 63, 42, .26) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(107, 63, 42, .22);
  background-clip: content-box;
  border: 3px solid transparent;
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(107, 63, 42, .36); background-clip: content-box; }

/* ── movimento: revelação escalonada ─────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes fade { from { opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

:where(.main-body, .onb-inner, .auth-card, .ov) > * { animation: rise .6s var(--ease) backwards; }
:where(.main-body, .onb-inner, .auth-card, .ov) > *:nth-child(2) { animation-delay: .05s; }
:where(.main-body, .onb-inner, .auth-card, .ov) > *:nth-child(3) { animation-delay: .1s; }
:where(.main-body, .onb-inner, .auth-card, .ov) > *:nth-child(4) { animation-delay: .15s; }
:where(.main-body, .onb-inner, .auth-card, .ov) > *:nth-child(5) { animation-delay: .2s; }
:where(.main-body, .onb-inner, .auth-card, .ov) > *:nth-child(n+6) { animation-delay: .25s; }

:where(.jstep, .mission, .stat, .opt, .log-row, .mini, .seg-item) {
  animation: rise .52s var(--ease) backwards;
  animation-delay: .14s;
}
:where(.jstep, .mission, .stat, .opt, .log-row, .mini, .seg-item):nth-child(2) { animation-delay: .19s; }
:where(.jstep, .mission, .stat, .opt, .log-row, .mini, .seg-item):nth-child(3) { animation-delay: .24s; }
:where(.jstep, .mission, .stat, .opt, .log-row, .mini, .seg-item):nth-child(4) { animation-delay: .29s; }
:where(.jstep, .mission, .stat, .opt, .log-row, .mini, .seg-item):nth-child(n+5) { animation-delay: .34s; }

/* ── utilidades ──────────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 10px); }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 11.5px; }
strong, b { font-weight: 700; color: var(--heading); }
.mono { font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--texto-suave);
}

[data-ic] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 1.2em;
  line-height: 1;
}
[data-ic] > svg { width: 1em; height: 1em; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip {
  position: fixed; top: 10px; left: 10px; z-index: 200;
  transform: translateY(-200%);
  background: var(--chocolate); color: #fff;
  padding: 10px 16px; border-radius: var(--r-full);
  font-weight: 700; box-shadow: var(--sh-md);
  transition: transform .2s var(--spring);
}
.skip:focus { transform: none; }

/* ── avatar da Cacau ─────────────────────────────────────────────────── */
.cacau {
  width: var(--s, 64px); height: var(--s, 64px);
  border-radius: 50%;
  object-fit: cover;
  background: var(--creme-escuro);
  border: 2.5px solid var(--caramelo-claro);
  flex: none;
  box-shadow: var(--sh-xs);
}
.cacau--glow {
  border-color: var(--dourado);
  box-shadow: 0 0 0 4px rgba(230, 195, 92, .32), 0 12px 26px rgba(66, 38, 24, .22);
}

/* anel de progresso (XP / presença) — vive sobre o painel ink */
.ring {
  width: var(--s, 122px); height: var(--s, 122px);
  border-radius: 50%;
  padding: 5px;
  display: grid; place-items: center;
  background: conic-gradient(var(--rc, var(--sage)) calc(var(--p) * 1%), rgba(255, 255, 255, .16) 0);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .07), 0 22px 40px -22px rgba(0, 0, 0, .8);
  animation: ring-in 1.2s var(--ease) both;
}
.ring > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid rgba(36, 20, 16, .85); }
@keyframes ring-in { from { --p: 0; } }

/* barra de progresso */
.bar {
  position: relative;
  height: var(--h, 9px);
  border-radius: var(--r-full);
  background: var(--surface-2);
  overflow: hidden;
}
.bar > span {
  display: block; height: 100%;
  width: var(--w, 0%);
  background: var(--bc, var(--sage));
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: width .9s var(--ease);
}

/* ── botões ──────────────────────────────────────────────────────────── */
.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--caramelo-claro) 0%, var(--caramelo) 52%, #BE8757 100%);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), 0 1px 2px rgba(66, 38, 24, .16), var(--sh-glow);
  transition: transform .24s var(--spring), box-shadow .24s var(--ease), filter .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
/* brilho em varredura */
.btn::after {
  content: "";
  position: absolute; inset: -1px; z-index: -1;
  background: linear-gradient(105deg, transparent 34%, rgba(255, 255, 255, .45) 50%, transparent 66%);
  transform: translateX(-130%);
  transition: transform .75s var(--ease);
  pointer-events: none;
}
.btn:hover { transform: translateY(-2px); filter: saturate(1.06) brightness(1.02); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42), 0 4px 8px -2px rgba(66, 38, 24, .16), 0 16px 32px -12px rgba(201, 149, 108, .85); }
.btn:hover::after { transform: translateX(130%); }
.btn:active { transform: translateY(0) scale(.975); transition-duration: .07s; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 2px rgba(66, 38, 24, .18), var(--sh-glow); }

.btn--ghost { background: var(--surface); color: var(--chocolate); border-color: var(--border); box-shadow: var(--sh-xs); }
.btn--ghost:hover { background: var(--surface); border-color: var(--caramelo-claro); filter: none; box-shadow: var(--sh-md); }

.btn--quiet { background: transparent; color: var(--muted); box-shadow: none; padding: 0 12px; min-height: 40px; }
.btn--quiet:hover { background: var(--surface-2); color: var(--chocolate); filter: none; box-shadow: none; }

.btn--sage { background: linear-gradient(180deg, #8DB89B, var(--sage) 55%, #6D9A7D); }
.btn--sage:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 16px 32px -12px rgba(123, 168, 138, .85); }

.btn--ghost::after, .btn--quiet::after, .btn--google::after { display: none; }

.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: var(--r-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; box-shadow: none; }

/* ── cartões e superfícies ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-sm);
  transition: transform .28s var(--spring), box-shadow .28s var(--ease), border-color .2s var(--ease);
}
.card--flat { box-shadow: none; }
.card--warm { background: linear-gradient(180deg, #FFFDF9, #FFF6EC); }
.card--pad { padding: 26px; }
.card-link { display: block; }
.card-link:hover { transform: translateY(-4px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-lg); border-color: var(--caramelo-claro); }
.card-link:active { transform: translateY(-1px); }

.hr { height: 1px; background: var(--border); border: 0; }

/* ── badges / pill ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, #8DB89B, var(--sage));
  color: #fff;
  font-family: var(--font-display);
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), var(--sh-xs);
}
.badge--caramelo { background: linear-gradient(180deg, var(--caramelo-claro), var(--caramelo)); }
.badge--coral { background: linear-gradient(180deg, #EEB0A1, var(--coral)); }
.badge--dourado { background: linear-gradient(180deg, #EFD27A, var(--dourado)); color: #5b4310; }
.badge--soft { background: var(--creme-escuro); color: var(--chocolate); box-shadow: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--chocolate);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 700;
}

/* ── chips selecionáveis ─────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--texto);
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  box-shadow: var(--sh-xs);
  transition: transform .22s var(--spring), border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.chip:hover { border-color: var(--caramelo-claro); background: #FFFCF8; transform: translateY(-1px); box-shadow: var(--sh-sm); }
.chip:active { transform: translateY(1px) scale(.985); }
.chip.is-on {
  border-color: var(--caramelo);
  background: linear-gradient(180deg, #FFF7EE, #F6E3D1);
  color: var(--chocolate);
  box-shadow: inset 0 0 0 1px var(--caramelo), var(--sh-xs);
}

/* ── campos ──────────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 16px; }
.field > .lbl {
  display: block; margin-bottom: 7px;
  font-family: var(--font-display);
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--texto-suave);
}
.input, .textarea, select.input {
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--texto);
  box-shadow: inset 0 1px 2px rgba(66, 38, 24, .045);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.textarea { min-height: 92px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #A98F7F; }
.input:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, select.input:focus {
  outline: none;
  border-color: var(--caramelo);
  box-shadow: 0 0 0 4px rgba(201, 149, 108, .17), inset 0 1px 2px rgba(66, 38, 24, .04);
}
.field .hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.field.has-error .input, .field.has-error .textarea { border-color: var(--erro); background: #FEF6F5; }
.field.has-error .hint { color: var(--erro); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > [data-ic] { position: absolute; left: 15px; color: var(--muted); pointer-events: none; }
.input-wrap .input { padding-left: 46px; }
.input-wrap .peek {
  position: absolute; right: 8px; background: none; border: 0; cursor: pointer;
  padding: 8px; border-radius: var(--r-sm); color: var(--muted);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.input-wrap .peek:hover { background: var(--surface-2); color: var(--chocolate); }

/* ── alertas ─────────────────────────────────────────────────────────── */
.alert {
  display: none;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  margin-bottom: 16px;
}
.alert.is-on { display: block; animation: rise .35s var(--ease) backwards; }
.alert--erro { background: var(--erro-bg); color: var(--erro); }
.alert--ok { background: var(--sucesso-bg); color: var(--sucesso); }
.alert--info { background: #FBEFE2; color: var(--chocolate); }

/* ── switch (consentimento LGPD) ─────────────────────────────────────── */
.switch {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.switch:hover { border-color: var(--caramelo-claro); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .box {
  width: 26px; height: 26px; flex: none; margin-top: 1px;
  border: 2px solid var(--borda); border-radius: 8px;
  display: grid; place-items: center;
  color: transparent;
  background: var(--surface);
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .2s var(--spring);
}
.switch .box svg { width: 16px; height: 16px; }
.switch input:checked + .box { background: linear-gradient(180deg, #8DB89B, var(--sage)); border-color: var(--sage); color: #fff; transform: scale(1.04); }
.switch:has(input:checked) { border-color: var(--sage); background: #F4F9F5; }
.switch input:focus-visible + .box { outline: 2.5px solid var(--caramelo-forte); outline-offset: 2px; }

/* ==========================================================================
   Shell do app: rail · main · painel ink da Cacau
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--aside);
  grid-template-areas: "rail main aside";
  min-height: 100vh;
}

/* rail */
.rail {
  grid-area: rail;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  gap: 8px;
  padding: 26px 18px 20px;
  background: linear-gradient(180deg, #FFFDFA, #FBF5EE);
  border-right: 1px solid var(--border);
}
.rail-brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 20px; }
.rail-brand img { width: 42px; height: 42px; border-radius: 13px; box-shadow: var(--sh-xs); }
.rail-brand .nm { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -.025em; color: var(--chocolate); }
.rail-brand .nm i { font-style: normal; font-weight: 600; color: var(--caramelo-forte); }
.rail-brand .tg { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }

.rail-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  color: var(--texto);
  font-weight: 600; font-size: 14.5px;
  transition: background .18s var(--ease), color .18s var(--ease), transform .22s var(--spring), box-shadow .22s var(--ease);
}
.nav-item .ic { font-size: 21px; color: var(--texto-suave); }
.nav-item:hover { background: var(--surface-2); transform: translateX(2px); }
.nav-item:active { transform: translateX(2px) scale(.985); }
.nav-item.is-active {
  background: linear-gradient(180deg, var(--caramelo-claro), var(--caramelo) 60%, #BE8757);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), 0 10px 20px -12px rgba(201, 149, 108, .95);
}
.nav-item.is-active .ic { color: #fff; }
.nav-item .xp { margin-left: auto; }

.rail-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.rail-user { display: flex; align-items: center; gap: 11px; padding: 8px 6px; }
.rail-user .who { min-width: 0; }
.rail-user .who b { display: block; font-size: 14px; }
.rail-user .who span { display: block; font-size: 12px; color: var(--muted); }

/* main */
.main { grid-area: main; min-width: 0; display: flex; flex-direction: column; }
.main-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  padding: 30px 38px 20px;
  background: color-mix(in oklab, var(--bg) 74%, transparent);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid color-mix(in oklab, var(--border) 65%, transparent);
}
.main-head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; max-width: 62ch; }
.main-body { padding: 26px 38px 64px; display: grid; gap: 22px; align-content: start; }
.main-body--narrow { max-width: 780px; }

/* ── painel lateral ink da Cacau ─────────────────────────────────────── */
.aside {
  grid-area: aside;
  position: sticky; top: 0;
  height: 100vh;
  padding: 26px 22px;
  display: flex; flex-direction: column; gap: 18px;
  overflow: auto;
  color: var(--on-ink);
  border-left: 1px solid var(--on-ink-line);
  background:
    radial-gradient(320px 240px at 74% -4%, rgba(230, 195, 92, .20), transparent 62%),
    radial-gradient(300px 300px at 8% 102%, rgba(232, 160, 144, .22), transparent 66%),
    linear-gradient(180deg, var(--ink-3), var(--ink));
}
.companion {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
}
.companion .nm { font-family: var(--font-display); font-weight: 800; font-size: 21px; color: var(--on-ink); letter-spacing: -.02em; }

.speech {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--caramelo-claro);
  border-radius: var(--r-lg);
  padding: 15px 17px;
  font-size: 14.5px;
  color: var(--texto);
  text-align: left;
  width: 100%;
  box-shadow: var(--sh-sm);
}
.speech::before {
  content: ""; position: absolute; top: -9px; left: 34px;
  width: 15px; height: 15px;
  background: var(--surface);
  border-left: 1.5px solid var(--caramelo-claro);
  border-top: 1.5px solid var(--caramelo-claro);
  transform: rotate(45deg);
  border-radius: 3px 0 0 0;
}
.speech p { margin: 0; }

.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.mini {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px; text-align: left;
}
.mini .v { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--chocolate); line-height: 1.1; letter-spacing: -.02em; }
.mini .k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-suave); }
.mini--sage .v { color: #5F8E70; }
.mini--coral .v { color: #C97B6B; }

.prog-block { width: 100%; text-align: left; }
.prog-block .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; gap: 8px; }
.prog-block .top b { font-size: 13.5px; }
.prog-block .top span { font-size: 12px; color: var(--muted); }

/* o painel ink reescreve os componentes claros que vivem dentro dele */
.aside .speech {
  background: var(--ink-2);
  border-color: var(--on-ink-line);
  color: var(--on-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 18px 32px -24px rgba(0, 0, 0, .9);
}
.aside .speech::before { background: var(--ink-2); border-color: var(--on-ink-line); }
.aside .mini { background: var(--on-ink-fill); border-color: var(--on-ink-line); }
.aside .mini .v { color: var(--on-ink); }
.aside .mini .k { color: var(--on-ink-muted); }
.aside .mini--sage .v { color: #A9D5B9; }
.aside .mini--coral .v { color: #F3B9AB; }
.aside .prog-block .top b { color: var(--on-ink); }
.aside .prog-block .top span { color: var(--on-ink-muted); }
.aside .bar { background: rgba(255, 255, 255, .14); }
.aside .btn--ghost { background: var(--on-ink-fill); color: var(--on-ink); border-color: var(--on-ink-line); }
.aside .btn--ghost:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .26); }

/* jornada dos 5 estágios */
.journey { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.jstep { text-align: center; display: grid; gap: 7px; justify-items: center; }
.jstep img {
  width: var(--s, 56px); height: var(--s, 56px);
  border-radius: 50%; object-fit: cover;
  border: 2.5px solid var(--border);
  filter: grayscale(.55) opacity(.55);
  transition: transform .3s var(--spring), filter .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.jstep .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--texto-suave); }
.jstep.is-done img { filter: none; border-color: var(--sage-claro); }
.jstep.is-done .lbl { color: #5F8E70; }
.jstep.is-now img { filter: none; border-color: var(--caramelo); box-shadow: 0 0 0 4px rgba(201, 149, 108, .18), var(--sh-md); transform: scale(1.07); }
.jstep.is-now .lbl { color: var(--chocolate); }
.jstep.is-glow img { filter: none; border-color: var(--dourado); box-shadow: 0 0 0 4px rgba(230, 195, 92, .3); }
.jstep.is-next img { border-style: dashed; }
.jstep:hover img { filter: none; transform: translateY(-3px) scale(1.05); }

/* ── missões ─────────────────────────────────────────────────────────── */
.mission {
  display: flex; align-items: center; gap: 15px;
  width: 100%;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-sm);
  transition: transform .28s var(--spring), box-shadow .28s var(--ease), border-color .2s var(--ease);
}
.mission:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-lg); border-color: var(--caramelo-claro); }
.mission:active { transform: translateY(-1px) scale(.995); }
.mission .tick {
  width: 44px; height: 44px; flex: none;
  border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(180deg, #FFF9F1, var(--creme-escuro));
  color: var(--caramelo-forte);
  font-size: 23px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--spring);
}
.mission .tx { flex: 1; min-width: 0; }
.mission .tx b { display: block; font-size: 15px; }
.mission .tx span { font-size: 13px; color: var(--muted); }
.mission .tag { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--caramelo-forte); white-space: nowrap; }
.mission.is-done { border-color: var(--sage-claro); background: #FBFDFB; }
.mission.is-done .tick { background: linear-gradient(180deg, #8DB89B, var(--sage)); color: #fff; }
.mission.is-done .tag { color: #5F8E70; }

/* ── segmented (peso / refeição / treino) ────────────────────────────── */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.seg-item {
  display: grid; gap: 8px; justify-items: center;
  padding: 20px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-xs);
  transition: transform .26s var(--spring), border-color .2s var(--ease), background .2s var(--ease), box-shadow .26s var(--ease);
}
.seg-item .ic { font-size: 27px; color: var(--texto-suave); transition: color .2s var(--ease), transform .26s var(--spring); }
.seg-item b { font-family: var(--font-display); font-size: 14.5px; color: var(--chocolate); }
.seg-item span { font-size: 12px; font-weight: 700; color: var(--caramelo-forte); }
.seg-item:hover { border-color: var(--caramelo-claro); transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-md); }
.seg-item:hover .ic { transform: scale(1.06); }
.seg-item:active { transform: translateY(-1px) scale(.99); }
.seg-item.is-on { border-color: var(--caramelo); background: linear-gradient(180deg, #FFFCF8, #FDF3E9); box-shadow: inset 0 0 0 1px var(--caramelo), var(--sh-md); }
.seg-item.is-on .ic { color: var(--caramelo-forte); }

/* ── chat ────────────────────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; gap: 16px; }
.bubble-row { display: flex; gap: 10px; align-items: flex-end; max-width: 74%; animation: rise .45s var(--ease) backwards; }
.bubble-row--me { margin-left: auto; flex-direction: row-reverse; }
.bubble-row .cacau { width: 34px; height: 34px; }
.bubble {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 15px; line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  box-shadow: var(--sh-sm);
}
.bubble--me {
  background: linear-gradient(180deg, #8DB89B, var(--sage));
  color: #fff;
  border-color: transparent;
  border-bottom-left-radius: var(--r-lg);
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 18px -12px rgba(123, 168, 138, .9);
}
.bubble-row--me .bubble { box-shadow: 0 8px 18px -12px rgba(123, 168, 138, .9); }
.bubble .meta { display: block; margin-top: 5px; font-size: 11px; opacity: .7; }
.bubble-row--me .meta { color: rgba(255, 255, 255, .85); }
.bubble.is-typing { display: inline-flex; gap: 5px; align-items: center; padding: 15px 18px; }
.bubble.is-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--caramelo-claro); animation: bounce 1.1s infinite var(--ease); }
.bubble.is-typing i:nth-child(2) { animation-delay: .15s; }
.bubble.is-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.composer {
  display: flex; gap: 10px; align-items: flex-end;
  position: sticky; bottom: 0;
  padding: 14px 0 0;
  background: linear-gradient(transparent, var(--bg) 34%);
}
.composer .input-wrap { flex: 1; }
.composer .input { min-height: 52px; padding-left: 46px; }

.quick-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* ── estatísticas / listas ───────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 17px;
  display: grid; gap: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-xs);
  transition: transform .26s var(--spring), box-shadow .26s var(--ease), border-color .2s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-md); border-color: var(--caramelo-claro); }
.stat .k { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-suave); }
.stat .v { font-family: var(--font-display); font-weight: 800; font-size: 27px; color: var(--chocolate); line-height: 1.05; letter-spacing: -.03em; }
.stat .v small { font-size: 14px; font-weight: 700; color: var(--muted); }
.stat p { font-size: 12.5px; color: var(--muted); }
.stat--sage .v { color: #5F8E70; }
.stat--coral .v { color: #C97B6B; }

.log-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.log-row:last-child { border-bottom: 0; }
.log-row .tick { width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--caramelo-forte); flex: none; font-size: 20px; }
.log-row .xp { font-family: var(--font-display); font-weight: 700; color: var(--caramelo-forte); font-size: 13.5px; }

/* ── tabela simples (histórico) ─────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; font-family: var(--font-display); font-size: 11.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--texto-suave);
  padding: 0 14px 10px; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-weight: 700; color: var(--chocolate); }

/* ── gráfico de peso (sparkline SVG) ────────────────────────────────── */
.spark { width: 100%; height: 132px; display: block; }
.spark .line { fill: none; stroke: var(--caramelo); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 800; stroke-dashoffset: 800; animation: draw 1.5s var(--ease) .35s both; }
.spark .area { fill: url(#sparkFill); stroke: none; animation: fade .9s var(--ease) 1s backwards; }
/* transform-box: fill-box — sem isto o scale() do pop giraria em torno de (0,0)
   do viewBox e o ponto deslizaria ~34px antes de assentar */
.spark .dot { fill: var(--branco); stroke: var(--caramelo); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: pop .5s var(--spring) 1.5s backwards; }
.spark .grid-l { stroke: var(--borda); stroke-width: 1; stroke-dasharray: 4 6; }

/* ==========================================================================
   Telas de autenticação
   ========================================================================== */
.auth { display: grid; grid-template-columns: 1.02fr .98fr; min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden;
  padding: 56px 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: var(--on-ink);
  background:
    radial-gradient(760px 540px at 84% 4%, rgba(230, 195, 92, .22), transparent 62%),
    radial-gradient(640px 480px at 4% 98%, rgba(232, 160, 144, .24), transparent 64%),
    linear-gradient(158deg, var(--ink-3), var(--ink));
  border-right: 1px solid var(--on-ink-line);
}
.auth-brand .word { width: 232px; border-radius: var(--r-md); }
.auth-brand .brand-word {
  font-family: var(--font-display); font-weight: 800; font-size: 29px;
  letter-spacing: -.03em; color: var(--on-ink);
}
.auth-brand .brand-word i { font-style: normal; color: var(--caramelo-claro); }
.auth-brand h2 { font-size: clamp(30px, 3.4vw, 44px); max-width: 15ch; letter-spacing: -.035em; margin-top: 26px; color: var(--on-ink); }
.auth-brand p { max-width: 40ch; color: var(--on-ink-muted); font-size: 16px; margin-top: 14px; }
.auth-brand .stages { display: flex; gap: 12px; align-items: flex-end; margin-top: 32px; }
.auth-brand .stages img {
  width: 58px; height: 58px; border-radius: 50%; object-fit: cover;
  border: 2.5px solid rgba(255, 255, 255, .82);
  box-shadow: 0 14px 26px -14px rgba(0, 0, 0, .9);
  animation: pop .5s var(--spring) backwards;
}
.auth-brand .stages img:nth-child(1) { animation-delay: .1s; }
.auth-brand .stages img:nth-child(2) { animation-delay: .16s; }
.auth-brand .stages img:nth-child(3) { animation-delay: .22s; }
.auth-brand .stages img:nth-child(4) { animation-delay: .28s; }
.auth-brand .stages img:nth-child(5) { animation-delay: .34s; }
.auth-brand .stages img:nth-child(5) { width: 76px; height: 76px; border-color: var(--dourado); box-shadow: 0 0 0 4px rgba(230, 195, 92, .26), 0 16px 30px -14px rgba(0, 0, 0, .9); }
.auth-brand .foot { font-size: 12.5px; color: var(--on-ink-muted); }
.auth-hero-capy {
  position: absolute; right: -28px; bottom: -18px; width: 260px; opacity: .1; pointer-events: none;
}

.auth-panel { display: grid; place-items: center; padding: 48px 40px; background: transparent; }
.auth-card { width: 100%; max-width: 428px; }
.auth-card .mobile-brand { display: none; }
.auth-swap { text-align: center; margin-top: 22px; font-size: 14.5px; color: var(--muted); }
.auth-swap a { color: var(--chocolate); font-weight: 800; border-bottom: 2px solid var(--caramelo-claro); transition: border-color .18s var(--ease); }
.auth-swap a:hover { border-color: var(--caramelo); }

.divider-or { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.divider-or::before, .divider-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.btn--google { background: var(--surface); color: var(--chocolate); border-color: var(--border); box-shadow: var(--sh-xs); }
.btn--google:hover { background: var(--surface); border-color: var(--border-strong); filter: none; box-shadow: var(--sh-md); }

/* ==========================================================================
   Onboarding
   ========================================================================== */
.onb {
  min-height: 100vh;
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
}
.onb-rail {
  position: sticky; top: 0; height: 100vh;
  padding: 40px 34px;
  display: flex; flex-direction: column; gap: 30px;
  background: linear-gradient(180deg, #FFFDFA, #FBF5EE);
  border-right: 1px solid var(--border);
}
.onb-steps { display: grid; gap: 6px; }
.onb-step { display: flex; gap: 13px; align-items: center; padding: 12px 14px; border-radius: var(--r-md); transition: background .22s var(--ease); }
.onb-step .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--creme-escuro); color: var(--muted); font-family: var(--font-display); font-weight: 800; font-size: 13px; transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--spring); }
.onb-step .tx b { display: block; font-size: 14px; color: var(--muted); font-weight: 700; transition: color .25s var(--ease); }
.onb-step .tx span { font-size: 12px; color: var(--muted); }
.onb-step.is-on { background: linear-gradient(180deg, #FFF8F0, #F7E6D7); }
.onb-step.is-on .n { background: linear-gradient(180deg, var(--caramelo-claro), var(--caramelo)); color: #fff; transform: scale(1.06); box-shadow: 0 8px 16px -10px rgba(201, 149, 108, .95); }
.onb-step.is-on .tx b { color: var(--chocolate); }
.onb-step.is-done .n { background: linear-gradient(180deg, #8DB89B, var(--sage)); color: #fff; }
.onb-step.is-done .tx b { color: var(--chocolate); }

.onb-main { display: flex; flex-direction: column; min-height: 100vh; }
.onb-top { display: flex; align-items: center; gap: 16px; padding: 26px 40px; border-bottom: 1px solid var(--border); }
.onb-prog { flex: 1; height: 8px; border-radius: var(--r-full); background: var(--creme-escuro); overflow: hidden; }
.onb-prog i { display: block; height: 100%; width: 25%; background: linear-gradient(90deg, var(--caramelo-claro), var(--caramelo)); border-radius: inherit; transition: width .55s var(--ease); }
.onb-canvas { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px; }
.onb-inner { width: 100%; max-width: 720px; margin: 0 auto; }
.onb-foot { padding: 22px 40px 32px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 16px; }

.opt-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.opt {
  display: flex; align-items: center; gap: 15px;
  padding: 20px;
  border: 1.5px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); cursor: pointer; text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-xs);
  transition: transform .26s var(--spring), box-shadow .26s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.opt .ic { font-size: 26px; color: var(--caramelo-forte); transition: transform .26s var(--spring); }
.opt b { display: block; font-family: var(--font-display); font-size: 15px; color: var(--chocolate); }
.opt span { font-size: 12.5px; color: var(--muted); }
.opt:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--sh-md); border-color: var(--caramelo-claro); }
.opt:hover .ic { transform: scale(1.06); }
.opt:active { transform: translateY(-1px) scale(.99); }
.opt.is-on { border-color: var(--caramelo); background: linear-gradient(180deg, #FFFCF8, #FDF3E9); box-shadow: inset 0 0 0 1px var(--caramelo), var(--sh-md); }
.opt .radio { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--borda); display: grid; place-items: center; flex: none; transition: border-color .2s var(--ease); }
.opt.is-on .radio { border-color: var(--caramelo); }
.opt.is-on .radio::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--caramelo); animation: pop .28s var(--spring) backwards; }

/* ==========================================================================
   Overview / launcher
   ========================================================================== */
.ov { max-width: 1180px; margin: 0 auto; padding: 40px 32px 80px; }
.ov-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 34px; }
.ov-hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 34px; align-items: center; margin-bottom: 46px; }
.ov-hero h1 { font-size: clamp(34px, 4.6vw, 56px); letter-spacing: -.04em; max-width: 16ch; }
.ov-hero .lead { font-size: 17px; color: var(--texto); max-width: 46ch; margin-top: 16px; }
.ov-hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.ov-hero-media {
  position: relative; display: grid; place-items: center;
  padding: 34px;
  border-radius: var(--r-xl);
  overflow: hidden;
  background:
    radial-gradient(70% 60% at 74% -6%, rgba(230, 195, 92, .22), transparent 62%),
    radial-gradient(80% 70% at 6% 104%, rgba(232, 160, 144, .24), transparent 64%),
    linear-gradient(180deg, var(--ink-3), var(--ink));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--sh-lg);
  animation: pop .7s var(--spring) backwards;
}
.ov-hero-media .blob { position: absolute; inset: 2% 4%; border-radius: 50%; background: radial-gradient(circle at 50% 42%, rgba(230, 195, 92, .34), transparent 62%); z-index: 0; }
.ov-hero-media img { position: relative; z-index: 1; width: min(100%, 340px); aspect-ratio: 1; object-fit: cover; border-radius: var(--r-xl); border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 30px 60px -26px rgba(0, 0, 0, .9); }
.ov-hero-media .float {
  position: absolute; z-index: 2; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 11px 14px; box-shadow: var(--sh-md); font-size: 12.5px; font-weight: 700; color: var(--chocolate);
  display: flex; align-items: center; gap: 8px;
  animation: rise .6s var(--ease) .35s backwards;
}
.ov-hero-media .float--a { top: 6%; left: 4%; }
.ov-hero-media .float--b { bottom: 7%; right: 4%; animation-delay: .45s; }

.ov-screens { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.scr { padding: 22px; display: grid; gap: 12px; align-content: start; }
.scr .ic { font-size: 24px; color: var(--caramelo-forte); }
.scr h3 { font-size: 17px; }
.scr p { font-size: 13.5px; color: var(--muted); }
.scr .go { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--caramelo-forte); display: inline-flex; align-items: center; gap: 7px; transition: gap .24s var(--spring); }
.scr .go .ic { font-size: 17px; color: inherit; }
.card-link:hover .go { gap: 11px; }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1280px) {
  :root { --rail: 216px; --aside: 316px; }
  .main-head, .main-body { padding-left: 28px; padding-right: 28px; }
}

/* painel da Cacau vira faixa horizontal acima do conteúdo */
@media (max-width: 1080px) {
  .app { grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-areas: "rail companion" "rail main"; grid-template-rows: auto 1fr; }
  .aside {
    grid-area: companion;
    position: static; height: auto; overflow: visible;
    border-left: 0; border-bottom: 1px solid var(--on-ink-line);
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 16px 22px;
    padding: 18px 26px;
  }
  .companion { flex-direction: row; text-align: left; gap: 14px; }
  .companion .ring { --s: 92px; }
  .speech { flex: 1 1 240px; min-width: 0; }
  .aside .speech::before { display: none; }
  .aside .prog-block { flex: 1 1 200px; max-width: none; }
  .aside .mini-grid { flex: 1 1 180px; max-width: none; }
  .aside .stat-grid { flex: 1 1 180px; }
  .ov-hero { grid-template-columns: 1fr; }
  .ov-hero-media { order: -1; }
}

/* tablet: a faixa da Cacau fica enxuta — os números já vivem no conteúdo */
@media (min-width: 761px) and (max-width: 1080px) {
  .aside .mini-grid, .aside .stat-grid, .aside > .btn { display: none; }
}

@media (max-width: 940px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { padding: 34px 22px; min-height: 100vh; align-items: start; padding-top: 64px; }
  .auth-card .mobile-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; text-align: center; }
  .auth-card .mobile-brand img.word { width: 178px; }
  .auth-card .mobile-brand .tag { font-size: 13.5px; color: var(--muted); }

  .onb { grid-template-columns: 1fr; }
  .onb-rail { display: none; }
  .onb-top { padding: 18px 22px; }
  .onb-canvas { padding: 26px 22px; }
  .onb-foot { padding: 16px 22px 24px; }
}

/* mobile: rail vira tab bar inferior */
@media (max-width: 760px) {
  .app {
    display: flex; flex-direction: column;
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
  .rail {
    position: fixed; inset: auto 0 0 0; z-index: 60;
    height: auto; flex-direction: row; align-items: stretch; gap: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    border-right: 0; border-top: 1px solid var(--border);
    background: color-mix(in oklab, #FFFDFA 90%, transparent);
    backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
    box-shadow: 0 -8px 24px -12px rgba(66, 38, 24, .3);
  }
  .rail-brand, .rail-foot { display: none; }
  .rail-nav { flex-direction: row; width: 100%; gap: 2px; }
  .nav-item { flex: 1; flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11px; font-weight: 700; border-radius: var(--r-sm); }
  .nav-item .ic { font-size: 22px; }
  .nav-item:hover { transform: none; }
  .nav-item.is-active { box-shadow: none; }

  .aside {
    flex-direction: column; align-items: stretch; gap: 14px;
    order: -1; padding: 16px 18px 20px;
  }
  .companion { flex-direction: row; text-align: left; }
  .companion .ring { --s: 74px; }
  .aside .speech { min-width: 0; }
  .aside .mini-grid, .aside .prog-block { max-width: none; }

  .main-head { padding: 18px 18px 14px; position: static; }
  .main-body { padding: 18px 18px 40px; gap: 16px; }

  .seg { grid-template-columns: 1fr; gap: 9px; }
  .seg-item { grid-template-columns: auto 1fr auto; justify-items: start; align-items: center; padding: 14px 16px; }
  .seg-item .ic { font-size: 23px; }
  .seg-item span { justify-self: end; }

  .bubble-row { max-width: 88%; }
  .journey { gap: 5px; }
  .jstep img { --s: 46px; }
  .jstep .lbl { font-size: 9px; }

  .ov { padding: 26px 18px 60px; }
  .ov-hero { gap: 22px; }
  .ov-hero-media { padding: 26px; }
  .main-body--narrow { max-width: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }

  .onb-foot { flex-direction: column-reverse; align-items: stretch; }
  .onb-foot .btn { width: 100%; }
}

@media (max-width: 420px) {
  .jstep .lbl { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   Mobile-first — faixa companheira + folha (padrão provado no Hoje)
   Mobile = uma tela. A Cacau deixa de empurrar o conteúdo e vira faixa
   companheira fixa no topo, que abre em folha sob demanda. Vale para toda
   tela que traga uma .cstrip dentro do .aside (Hoje, Registrar, Conversar);
   metas.html e as telas de auth não têm faixa e ficam intactas.
   ========================================================================== */

/* faixa companheira — existe só no celular */
.cstrip { display: none; }

/* a folha (bottom sheet) — presença da Cacau sob demanda */
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  color: var(--on-ink);
  background:
    radial-gradient(320px 200px at 78% -6%, rgba(230, 195, 92, .20), transparent 62%),
    radial-gradient(280px 240px at 6% 104%, rgba(232, 160, 144, .20), transparent 66%),
    linear-gradient(180deg, var(--ink-3), var(--ink));
  box-shadow: 0 -20px 50px -14px rgba(0, 0, 0, .55);
  max-height: 88vh;
  max-height: 88dvh;
  overflow: auto;
  overscroll-behavior: contain;
  transform: translateY(var(--drag, 0px));
  transition: transform .34s var(--ease);
}
.sheet::backdrop { background: rgba(26, 18, 13, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet.is-in { animation: sheet-up .38s var(--spring); }
.sheet.is-out { animation: sheet-down .24s var(--ease) forwards; }
.sheet.is-drag { transition: none; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }

.sheet-grab {
  width: 42px; height: 5px; border-radius: var(--r-full);
  background: rgba(255, 255, 255, .26);
  margin: 10px auto 2px;
  touch-action: none;
  cursor: grab;
}
.sheet-body {
  display: grid; gap: 18px;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom, 0px));
}

/* a folha reescreve os componentes claros que vivem dentro dela */
.sheet .speech { background: var(--ink-2); border-color: var(--on-ink-line); color: var(--on-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
.sheet .speech::before { display: none; }
.sheet .mini { background: var(--on-ink-fill); border-color: var(--on-ink-line); }
.sheet .mini .v { color: var(--on-ink); }
.sheet .mini .k { color: var(--on-ink-muted); }
.sheet .mini--sage .v { color: #A9D5B9; }
.sheet .mini--coral .v { color: #F3B9AB; }
.sheet .prog-block .top b { color: var(--on-ink); }
.sheet .prog-block .top span { color: var(--on-ink-muted); }
.sheet .bar { background: rgba(255, 255, 255, .14); }
.sheet .btn--quiet { color: var(--on-ink-muted); }
.sheet .btn--quiet:hover { background: rgba(255, 255, 255, .08); color: var(--on-ink); }

@media (max-width: 760px) {
  /* o painel lateral dá lugar à faixa; a folha carrega o resto.
     :has(.cstrip) mantém isto inerte em quem não tem faixa (ex.: metas.html) */
  .aside:has(.cstrip) {
    position: sticky; top: 0; z-index: 45;
    flex-direction: row; align-items: center; gap: 0;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 14px 8px;
    border-left: 0; border-bottom: 1px solid var(--on-ink-line);
    overflow: visible;
  }
  .aside:has(.cstrip) > *:not(.cstrip) { display: none; }

  .cstrip {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: 52px;
    padding: 4px 2px;
    background: none; border: 0;
    color: var(--on-ink);
    font: inherit; text-align: left; cursor: pointer;
    transition: transform .2s var(--spring);
  }
  .cstrip:active { transform: scale(.985); }
  .cstrip-tx { min-width: 0; display: grid; gap: 1px; }
  .cstrip-tx b { font-family: var(--font-display); font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
  .cstrip-tx > span {
    font-size: 12.5px; color: var(--on-ink-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .cstrip-go {
    margin-left: auto; flex: 0 0 auto;
    font-size: 20px; color: var(--on-ink-muted);
    transition: transform .24s var(--spring);
  }
  .cstrip:active .cstrip-go { transform: translateX(3px); }

  /* o dia primeiro: os números (referência) descem para o fim */
  .main-body > .sec-numeros { order: 2; }

  /* conversar: a faixa vira o cabeçalho do chat; a conversa preenche a tela
     e o composer fica logo acima da tab bar */
  body[data-page="conversar"] .app { height: 100dvh; overflow: hidden; }
  body[data-page="conversar"] .main { flex: 1; min-height: 0; }
  body[data-page="conversar"] .main-head { display: none; }
  body[data-page="conversar"] #chat { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .rail, .aside, .composer, .skip { display: none !important; }
  .app, .onb, .auth { display: block !important; }
  body { background: #fff; }
}
