/* Papel frío y tinta de birome. Un solo color fuerte: el azul.
   Tipografía: Bricolage Grotesque para lo que habla fuerte (saludo, días,
   títulos), la del sistema para leer. */

/* Bricolage Grotesque (OFL, ver fonts/OFL.txt), servida desde la propia app:
   sin depender de Google y funciona aunque la red esté lenta. */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/bricolage-grotesque-latin-opsz.woff2') format('woff2-variations'), url('/fonts/bricolage-grotesque-latin-opsz.woff2') format('woff2');
}

:root {
  color-scheme: light dark;
  --paper: #F4F1FC;
  --surface: #FFFFFF;
  --ink: #1B1537;
  --muted: #645C85;
  --line: #E1DBF3;
  --accent: #6127F6;
  --accent-ink: #FFFFFF;
  --accent-soft: #EDE8FC;
  --danger: #B42318;

  --font-display: 'Bricolage Grotesque', ui-rounded, -apple-system, 'SF Pro Rounded', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;

  --gutter: 16px;
  --radius-lg: 28px;
  --radius-sm: 16px;
  --float: 0 10px 30px rgb(20 12 50 / .14), 0 2px 6px rgb(20 12 50 / .06);
  --tap: 48px;
  --tabbar: 72px; /* barra flotante: 64 de alto + 8 de aire abajo */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #110D24;
    --surface: #1B1536;
    --ink: #ECE8F8;
    --muted: #A49DC4;
    --line: #2E2651;
    --accent: #A98BFF;
    --accent-ink: #110D24;
    --accent-soft: #2A1F55;
    --danger: #FF8A80;
    --float: 0 12px 34px rgb(0 0 0 / .45), 0 2px 6px rgb(0 0 0 / .25);
  }
}
:root[data-theme="dark"] {
  --paper: #110D24; --surface: #1B1536; --ink: #ECE8F8; --muted: #A49DC4; --line: #2E2651;
  --accent: #A98BFF; --accent-ink: #110D24; --accent-soft: #2A1F55; --danger: #FF8A80;
  --float: 0 12px 34px rgb(0 0 0 / .45), 0 2px 6px rgb(0 0 0 / .25);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
}
body.sheet-open { overflow: hidden; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 20px) var(--gutter) calc(var(--tabbar) + var(--safe-b) + 32px);
}
body:not(.authed) #app { padding-bottom: calc(var(--safe-b) + 32px); }

h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.display {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  line-height: 1.08;
  font-weight: 700;
}

/* ---------- encabezados ---------- */

.hello { padding: 28px 0 20px; }
.greet {
  font-size: clamp(40px, 12vw, 56px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
}
.date { color: var(--muted); margin-top: 10px; font-size: 16px; }
.screen-head { padding: 20px 0 16px; }
.screen-head h1 { font-size: 34px; }
.lede { font-size: 18px; line-height: 1.5; margin: 4px 0 20px; max-width: 34em; }
.muted { color: var(--muted); font-size: 15px; }
.fine { font-size: 13px; text-align: center; margin-top: 24px; }
.hint { color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- arranque: el momento fuerte ---------- */

.startcard {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-lg);
  padding: 22px 20px 20px;
  margin: 4px 0 28px;
  animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
}
.startcard-k { font-size: 15px; opacity: .8; }
.startcard-task {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 6px 0 14px;
  text-wrap: balance;
}
.startcard-msg { font-size: 16px; line-height: 1.5; opacity: .92; margin-bottom: 18px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .startcard { animation: none; } }

/* ---------- días y tareas ---------- */

.day { margin: 0 0 22px; }
/* Encabezado de semana (v1.8): el mes se ve por semanas. */
.week-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 26px 0 12px; padding: 0 2px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent);
}
.week-head:first-of-type { margin-top: 18px; }
.week-head .count { font-weight: 500; letter-spacing: 0; text-transform: none; }
.day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--line);
}
.day-head h2 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; letter-spacing: -0.015em;
}
.day.is-today .day-head h2 { color: var(--accent); }
.day.is-free { margin-bottom: 4px; }
.day.is-free .day-head { border-bottom: 0; padding-bottom: 4px; }
.day.is-free .day-head h2 { font-size: 17px; font-weight: 500; color: var(--muted); font-family: var(--font-body); letter-spacing: 0; }
.day.is-late .day-head h2 { color: var(--danger); }
.count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.mark { font-size: 18px; }

.cap { display: inline-flex; gap: 5px; align-items: center; }
.cap i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); opacity: .6; }
.cap i.on { background: var(--accent); border-color: var(--accent); opacity: 1; }
.cap i.over { background: var(--danger); border-color: var(--danger); }

.tasks, .plain { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.check {
  flex: none;
  width: 30px; height: 30px; margin: 0 2px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: transparent;
  display: grid; place-items: center;
  color: transparent;
  position: relative;
  transition: background .15s, border-color .15s, color .15s;
}
.check::before { content: ''; position: absolute; inset: -9px; } /* zona de toque de 48px */
.task.is-done .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.task-title { font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.task-meta { font-size: 14px; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.task-tag { font-size: 13px; font-weight: 600; color: var(--accent); }
.task.is-start .check { border-color: var(--accent); border-width: 2.5px; }
.task.is-start .task-title { font-weight: 600; }
.mini {
  flex: none;
  min-height: 36px; padding: 0 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 14px; color: var(--muted);
}
.mini.danger { color: var(--danger); }
.task-actions { flex: none; display: flex; gap: 6px; }
.plain li { padding: 12px 2px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }

/* ---------- botones y campos ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 24px;
  border-radius: 999px;
  border: 0;
  font-weight: 600; font-size: 17px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.on-accent { background: var(--accent-ink); color: var(--accent); width: 100%; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.sq { min-width: 54px; padding: 0; }
.btn:disabled { opacity: .55; }
.btn:active:not(:disabled), .choice:active, .chip:active { transform: scale(.98); }
.link { background: none; border: 0; padding: 12px 0; color: var(--accent); font-weight: 600; min-height: var(--tap); }
.link.danger { color: var(--danger); }

.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 15px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 17px; /* 17px evita el zoom automático de iOS */
  -webkit-appearance: none; appearance: none;
}
input[type="time"], input[type="date"] { display: block; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
  padding-right: 36px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* Jefe · Jefa: dos botones grandes en el login y un control segmentado en Ajustes. */
.field-q { font-size: 15px; color: var(--muted); }
.title-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.title-btn {
  min-height: 54px; padding: 0 10px; font-family: var(--font-display); font-size: 17px; font-weight: 700;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink);
}
.title-btn:active:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg-field legend { padding: 0; margin-bottom: 6px; font-size: 15px; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); padding: 4px; gap: 4px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); }
.seg-opt { position: relative; display: block; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; min-height: 0; margin: 0; cursor: pointer; }
.seg-opt span { display: grid; place-items: center; min-height: 44px; border-radius: 9px; font-size: 17px; font-weight: 600; color: var(--muted); }
.seg-opt input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.quick { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin: 0 0 26px; }
.quick select { width: auto; max-width: 122px; }
.quick.has-space select[name="space_id"] { grid-column: 1 / -1; max-width: none; width: 100%; }

/* ---------- espacios (v1.9) ---------- */
.spaces {
  display: flex; gap: 8px; margin: 0 -16px 16px; padding: 2px 16px 6px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.spaces::-webkit-scrollbar { display: none; }
.spaces .chip { flex: 0 0 auto; margin: 0; }
.space-tag {
  display: inline-block; width: fit-content; margin: 0; padding: 1px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; vertical-align: 2px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.task-body .space-tag { margin-top: 2px; }
.facts .space-tag { margin-right: 6px; vertical-align: 1px; }
.space-row .space-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.space-open { background: none; border: 0; padding: 0; font: inherit; font-size: 17px; color: var(--ink); text-align: left; min-height: 0; flex: 1; }
.link.back { margin: 0 0 6px; padding: 8px 0; font-size: 17px; }
.file-btn { display: grid; place-items: center; cursor: pointer; }
.file-btn.is-busy { opacity: .7; pointer-events: none; }

/* ---------- tablas (v2.8) ---------- */
.rows li.row-item { gap: 4px; }
.row-main { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cell { font-size: 15px; }
.cell-k { color: var(--muted); font-size: 13px; }
.cell-v { font-weight: 600; }
a.btn.listen { text-decoration: none; margin-right: 6px; }

/* ---------- bitácora (v2.7) ---------- */
.log li { gap: 1px; }
.log-text { font-size: 15px; overflow-wrap: anywhere; }

/* ---------- escuchar (v2.5) ---------- */
.btn.listen { display: inline-flex; align-items: center; gap: 8px; width: auto; min-height: 40px; padding: 6px 14px; margin-top: 10px; font-size: 15px; border-radius: 999px; }
.btn.listen.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- plata en la agenda (v2.4) ---------- */
.money { list-style: none; margin: 4px 0 0; padding: 0; }
.money-head { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px 4px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.money.is-late .money-head { color: var(--danger); }
.money-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px dashed var(--line); }
.money-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.money-concept { font-size: 15px; overflow-wrap: anywhere; }
.money-amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 15px; }
.money-amount.neg { color: var(--danger); }
.money-amount.pos { color: var(--ok, #1f8a4c); }

/* ---------- caja (v2.1) ---------- */
.accounts li.account { gap: 4px; }
.account-main, .mov-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.account-name { font-size: 17px; font-weight: 600; }
.account-balance { font-family: var(--font-display); font-size: 20px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.account-balance.neg, .mov-amount.neg { color: var(--danger); }
.mov-amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mov-amount.pos { color: var(--ok, #1f8a4c); }
.mov-concept { font-size: 16px; overflow-wrap: anywhere; }
.mov.is-prev .mov-concept, .mov.is-prev .mov-amount { opacity: .7; font-style: italic; }
.mini-link { display: inline; padding: 0; min-height: 0; font-size: 14px; font-weight: 600; }
.mini-link.danger { color: var(--danger); }
.chk { display: flex; align-items: center; gap: 12px; font-size: 16px; min-height: var(--tap); cursor: pointer; }
.chk input[type="checkbox"] {
  -webkit-appearance: checkbox; appearance: checkbox;
  width: 24px; height: 24px; min-height: 0; flex: 0 0 auto; margin: 0; padding: 0;
  border-radius: 6px; accent-color: var(--accent);
}
.on-chat .spaces { margin-top: 4px; }

/* ---------- capturar ---------- */

.capture { display: flex; flex-direction: column; gap: 12px; }
.capture textarea {
  min-height: 46dvh;
  resize: none;
  padding: 18px;
  border-radius: var(--radius-lg);
  font-size: 19px; line-height: 1.55;
  background: var(--surface);
}
.capture textarea::placeholder { color: var(--muted); }

/* ---------- cierre ---------- */

.progress { color: var(--muted); font-size: 15px; padding-top: 24px; }
.step-title { font-size: 32px; margin: 8px 0 20px; text-wrap: balance; overflow-wrap: anywhere; }
.choices { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 12px; }
.choice {
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; padding: 0 20px;
  border-radius: 18px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 19px; font-weight: 600; text-align: left;
}
.choice span { font-size: 22px; }
.closing-line { font-size: 26px; font-weight: 650; line-height: 1.2; margin: 0 0 28px; text-wrap: balance; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.chip {
  min-height: 44px; padding: 0 16px;
  border-radius: 22px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 16px;
}
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- avisos, vacío, carga ---------- */

.note {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px 4px;
  margin: 0 0 22px;
  font-size: 15px; line-height: 1.5;
}
p.note { padding-bottom: 14px; margin-top: 12px; }
.empty { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; margin: 8px 0 28px; font-size: 18px; }
form.stack + .day { margin-top: 36px; }
#push-box { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }

.skeleton { display: flex; flex-direction: column; gap: 14px; padding-top: 40px; }
.skeleton i { display: block; height: 22px; border-radius: 8px; background: var(--line); animation: pulse 1.2s ease-in-out infinite; }
.skeleton i:first-child { height: 48px; width: 70%; }
.skeleton i:nth-child(3) { width: 85%; }
.skeleton i:nth-child(4) { width: 60%; }
@keyframes pulse { 50% { opacity: .45; } }

.spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: turn .8s linear infinite;
}
@keyframes turn { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .skeleton i, .spin { animation-duration: 3s; } }

.toast {
  position: fixed; left: var(--gutter); right: var(--gutter);
  bottom: calc(var(--tabbar) + var(--safe-b) + 14px);
  max-width: 528px; margin: 0 auto;
  background: var(--ink); color: var(--paper);
  padding: 14px 18px; border-radius: 22px;
  font-size: 16px; z-index: 40;
  box-shadow: 0 8px 30px rgb(15 20 38 / .25);
}
.toast.error { background: var(--danger); color: #fff; }
.toast[hidden] { display: none; }

/* ---------- login ---------- */

.login { display: flex; flex-direction: column; gap: 14px; padding-top: 12vh; }
.logo .lm-bg { fill: var(--accent); }
.logo .lm-fg { fill: var(--accent-ink); }
.logo .dim { opacity: .55; }
.logo .lm-tick { fill: none; stroke: var(--accent-ink); stroke-width: 30; stroke-linecap: round; stroke-linejoin: round; }
.login-title { font-size: 64px; font-weight: 800; letter-spacing: -0.04em; }
.login .lede { color: var(--muted); }
.login-claim { font-size: 26px; font-weight: 700; line-height: 1.15; text-wrap: balance; }
.login-points { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 16px; line-height: 1.4; }
.login-points li { position: relative; padding-left: 17px; }
.login-points li::before { content: ''; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---------- guía de la primera vez ---------- */

.guide { min-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 52px); display: flex; align-items: center; }
.guide-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  display: flex; flex-direction: column; gap: 16px;
  animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
}
.guide-title { font-size: 34px; }
.guide-steps { list-style: none; counter-reset: g; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.guide-steps li { counter-increment: g; position: relative; padding-left: 40px; min-height: 28px; font-size: 17px; line-height: 1.45; }
.guide-steps li::before {
  content: counter(g);
  position: absolute; left: 0; top: -1px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
}
@media (prefers-reduced-motion: reduce) { .guide-card { animation: none; } }
.mic-hint { margin-top: -4px; }

/* ---------- Maia: la charla ---------- */

body.on-chat #app { padding-bottom: calc(var(--tabbar) + var(--safe-b) + var(--composer, 72px) + 16px); }
body.on-chat .toast { bottom: calc(var(--tabbar) + var(--safe-b) + var(--composer, 72px) + 10px); }
body.on-chat.kb-open #app, body.on-chat.kb-focus #app { padding-bottom: calc(var(--kb, 0px) + var(--composer, 72px) + 16px); }

.chat-empty { display: flex; flex-direction: column; gap: 16px; padding-top: 9vh; }
.chat-hello {
  font-size: clamp(38px, 11vw, 52px);
  font-weight: 800; letter-spacing: -0.035em; line-height: 1;
  text-wrap: balance;
}
.chat-examples { margin: 4px 0 0; }
.chat-examples .chip { font-size: 16px; text-align: left; }
.chat-mic { text-align: left; margin-top: 0; }

.chat-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 18px; }
.chat-head .logo { width: 40px; height: 40px; flex: none; }
.chat-name { font-family: var(--font-display); font-size: 22px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.1; }
.chat-sub { color: var(--muted); font-size: 14px; }

.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; max-width: 85%; }
.msg.from-me { align-self: flex-end; align-items: flex-end; }
.msg.from-mia { align-self: flex-start; align-items: flex-start; }
.from-me + .from-mia, .from-mia + .from-me { margin-top: 6px; }
.bubble {
  padding: 10px 15px;
  border-radius: 24px;
  font-size: 17px; line-height: 1.42;
  overflow-wrap: anywhere;
}
.from-mia .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 8px; box-shadow: var(--float); }
.from-me .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 8px; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 30%, transparent); }
.msg-acts { display: flex; gap: 6px; align-items: flex-start; margin: 6px 6px 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.msg-acts svg { flex: none; margin-top: 2px; color: var(--accent); }
.msg-acts.is-off { opacity: .6; }
.msg-acts.is-off svg { color: var(--muted); }
.msg-confirm { margin: 8px 6px 0; padding: 12px 14px; background: var(--accent-soft); border-radius: 22px; font-size: 14px; line-height: 1.4; box-shadow: var(--float); }
.msg-confirm-btns { display: flex; gap: 8px; margin-top: 8px; }
.msg-confirm-btns .btn { min-height: 38px; padding: 6px 14px; font-size: 14px; flex: 1; }
.typing .bubble { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation-duration: 3s; } }

.composer {
  position: fixed; left: 0; right: 0; z-index: 29;
  bottom: calc(var(--tabbar) + var(--safe-b));
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px max(var(--gutter), calc((100% - 560px) / 2 + var(--gutter)));
  background: linear-gradient(to top, var(--paper) 55%, transparent);
}
/* v2.20.10 (pedido 8/10 19:54): el cuadro para hablarle a Maia es UN globo de punta a punta, con el micrófono y la flecha
   adentro; igual en la charla (.pill), en Hoy y la Agenda (.ask-bar) y en Capturar (.cap-box). */
.pill, .ask-bar {
  display: flex; align-items: flex-end; gap: 2px;
  flex: 1 1 100%; min-width: 0;
  padding: 4px; border-radius: 26px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--float);
}
.pill:focus-within, .ask-bar:focus-within { border-color: var(--accent); }
.pill textarea, .ask-bar input {
  flex: 1; min-width: 0; width: auto;
  min-height: 42px; padding: 9px 6px 9px 14px;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
.pill textarea { max-height: 160px; line-height: 1.4; resize: none; overflow-y: auto; }
.pill .mic.attach + textarea { padding-left: 2px; }
.pill textarea::placeholder, .ask-bar input::placeholder { color: var(--muted); }
.pill .mic, .ask-bar .mic { width: 42px; height: 42px; border: 0; background: transparent; }
.pill .send, .ask-bar .send { width: 42px; height: 42px; box-shadow: none; }
.send {
  flex: none;
  width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent);
}
.send:disabled { opacity: .45; }
.send:active:not(:disabled) { transform: scale(.94); }
/* Teclado abierto: el cuadro va arriba del teclado y la barra de pestañas se va. */
body.kb-open .composer, body.kb-focus .composer { bottom: var(--kb, 0px); }
body.kb-open .tabs, body.kb-focus .tabs { display: none; }

.facts li.fact { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.fact span { overflow-wrap: anywhere; }
.facts-empty { padding-top: 12px; }

/* ---------- barra de pestañas ---------- */

.tabs {
  position: fixed; z-index: 30;
  left: 12px; right: 12px; bottom: calc(var(--safe-b) + 8px);
  max-width: 560px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(var(--tabs-n, 5), 1fr);
  padding: 6px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--float);
}
.tabs[hidden] { display: none; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px;
  background: none; border: 0;
  color: var(--muted);
  font-size: 12px; font-weight: 500;
}
.tab-ico { height: 32px; display: grid; place-items: center; }
.tab.is-on { color: var(--accent); }
.tab.is-on .tab-label { font-weight: 700; }
.tab-main { position: relative; }
.tab-main .tab-ico { height: 32px; width: 56px; position: relative; }
.tab-main .tab-maia {
  position: absolute; left: 50%; bottom: -2px; width: 52px; height: 52px; margin-left: -26px;
  filter: drop-shadow(0 4px 8px rgb(40 20 90 / .25));
  animation: maia-float 4.5s ease-in-out infinite; transform-origin: 50% 85%;
  transition: width .25s, height .25s, margin .25s;
}
.tab-main.is-on .tab-maia { width: 58px; height: 58px; margin-left: -29px; }
.tab-main:active .tab-maia { animation: maia-wiggle .6s cubic-bezier(.3,1.6,.5,1) both; }
@media (prefers-reduced-motion: reduce) { .tab-main .tab-maia { animation: none; } }

/* ---------- hoja inferior ---------- */

.scrim { position: fixed; inset: 0; background: rgb(10 14 30 / .45); z-index: 50; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-width: 560px; margin: 0 auto;
  background: var(--surface);
  border-radius: 30px 30px 0 0;
  box-shadow: 0 -10px 40px rgb(20 12 50 / .18);
  padding: 10px var(--gutter) calc(var(--safe-b) + 16px);
  max-height: 85dvh; overflow-y: auto;
  animation: up .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-k { color: var(--muted); font-size: 15px; }
.sheet-title { font-family: var(--font-display); font-size: 24px; letter-spacing: -0.015em; line-height: 1.15; margin: 2px 0 16px; overflow-wrap: anywhere; }
.sheet-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------- Logo Maia ---------- */
.login-logo{display:block;width:min(300px,82vw);height:auto;margin:0 0 18px -6px;border-radius:12px}
img.logo{width:56px;height:56px;border-radius:14px;display:block}

/* ---------- Maia: modo voz (v1.4) ---------- */

.mic {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--accent);
  display: grid; place-items: center;
}
.mic:active { transform: scale(.94); }
.chat-examples .chip svg { vertical-align: -3px; margin-right: 4px; }

.voz {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
  min-height: calc(100dvh - var(--tabbar) - var(--safe-b) - 40px);
  padding-bottom: 12px;
}
.voz-top { align-self: stretch; display: flex; justify-content: flex-end; }
.voz .logo { width: 84px; height: 84px; margin-top: 2vh; }
.voz-status {
  font-size: clamp(26px, 7vw, 34px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05;
  text-wrap: balance;
}
.voz-heard { color: var(--muted); font-size: 17px; line-height: 1.4; max-width: 36ch; }
.voz-said { font-size: 20px; line-height: 1.4; max-width: 34ch; text-wrap: balance; }
.voz .msg-acts { justify-content: center; }
.voz-mic {
  margin-top: auto;
  width: 104px; height: 104px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 38%, transparent);
  transition: transform .15s ease, background .2s ease;
}
.voz-mic:active:not(:disabled) { transform: scale(.95); }
.voz-mic:disabled { opacity: .5; }
.voz-mic.is-listening { animation: pulse 1.3s ease-in-out infinite; }
.voz-mic.is-speaking { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 2.5px var(--accent); }
.voz-hint { color: var(--muted); font-size: 14px; min-height: 20px; }
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 22px transparent; }
}
@media (prefers-reduced-motion: reduce) { .voz-mic.is-listening { animation: none; outline: 3px solid var(--accent); outline-offset: 4px; } }

.steps { margin: 0 0 8px; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 16px; }
.steps .btn { margin-top: 2px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- globo de confirmación (v2.12) ---------- */

.pop-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgb(10 8 30 / .40);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade .2s ease-out;
}
.pop {
  position: fixed; z-index: 61;
  left: 50%; top: 50%;
  width: min(360px, calc(100% - 40px));
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 26px 22px 14px;
  text-align: center;
  box-shadow: 0 24px 70px rgb(20 12 50 / .35), 0 4px 14px rgb(20 12 50 / .12);
  animation: pop-in .32s cubic-bezier(.2,1.3,.4,1);
}
.pop-logo { width: 54px; height: 54px; border-radius: 18px; margin: 0 auto 12px; display: block; box-shadow: var(--float); }
.pop-k { color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.pop-t { font-family: var(--font-display); font-size: 21px; line-height: 1.25; letter-spacing: -0.01em; margin: 6px 0 4px; overflow-wrap: anywhere; }
.pop-more { color: var(--muted); font-size: 14px; }
.pop-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.pop-btns .btn { width: 100%; min-height: 52px; }
.pop-btns .btn.primary { box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 38%, transparent); }
.pop-later { display: block; margin: 10px auto 2px; padding: 8px 16px; color: var(--muted); font-size: 15px; background: none; border: 0; }
body.pop-open { overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.9); } }
@media (prefers-reduced-motion: reduce) { .pop, .pop-scrim { animation: none; } }

/* ---------- fotos en la charla (v2.13) ---------- */
.mic.attach { cursor: pointer; }
.attach-chip { position: relative; flex: none; width: 48px; height: 48px; border-radius: 16px; overflow: visible; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 13px; box-shadow: var(--float); }
.attach-chip img { width: 48px; height: 48px; object-fit: cover; border-radius: 16px; }
.attach-chip button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); font-size: 15px; line-height: 22px; padding: 0; }
.msg-photo { max-width: 220px; max-height: 260px; border-radius: 22px; margin-bottom: 6px; object-fit: cover; box-shadow: var(--float); }

/* ---------- respuesta escribiéndose (v2.14) ---------- */
.caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--accent); animation: blink 1s steps(2) infinite; }

/* ---------- mensajes que entran (v2.15.6) ---------- */
.msg.is-new { animation: msg-in .26s cubic-bezier(.2,.8,.2,1); }
.msg.from-me.is-new { transform-origin: bottom right; }
.msg.from-mia.is-new { transform-origin: bottom left; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@media (prefers-reduced-motion: reduce) { .msg.is-new { animation: none; } }

/* ---------- la cabecita de Maia en la charla (v2.15.10) ---------- */
.mia-row { display: flex; align-items: flex-end; gap: 8px; }
.mia-av, .mia-av-gap { flex: none; width: 30px; height: 30px; }
.mia-av { border-radius: 50%; box-shadow: var(--float); }
.mia-under { padding-left: 38px; }
.msg.from-mia { max-width: 92%; }
.mia-av.is-thinking { animation: mia-slither 1.4s ease-in-out infinite; transform-origin: 50% 80%; }
.mia-av.is-talking { animation: mia-nod 1.1s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes mia-slither { 0%, 100% { transform: rotate(-8deg) translateX(-1px); } 50% { transform: rotate(8deg) translateX(1px) translateY(-2px); } }
@keyframes mia-nod { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) { .mia-av.is-thinking, .mia-av.is-talking { animation: none; } }

/* ---------- la víbora sin fondo (v2.15.11) ---------- */
img.logo { border-radius: 0; filter: none; }
.login-logo { border-radius: 0; margin-left: 0; filter: none; animation: maia-float 5s ease-in-out infinite; }
.pop-logo { border-radius: 0; box-shadow: none; width: 64px; height: 64px; filter: none; animation: maia-float 4s ease-in-out infinite; }
.mia-av { border-radius: 0; box-shadow: none; width: 40px; height: 40px; filter: none; cursor: pointer; }
.mia-av-gap { width: 40px; height: 1px; }
.mia-under { padding-left: 48px; }

/* ---------- Maia viva (v2.15.12): flota, y si la tocás se sacude ---------- */
.maia-poke { background: none; border: 0; padding: 0; display: inline-block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.maia-poke img.logo { animation: maia-float 4.5s ease-in-out infinite; transform-origin: 50% 85%; }
.login-mark .maia-poke img.logo, .voz .maia-poke img.logo { width: 96px; height: 96px; }
img.is-poked, .maia-poke img.is-poked { animation: maia-wiggle .7s cubic-bezier(.3,1.6,.5,1) both !important; }
@keyframes maia-float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(-2deg); } }
@keyframes maia-wiggle { 0% { transform: scale(1) rotate(0); } 20% { transform: scale(1.12) rotate(-10deg); } 40% { transform: scale(1.08) rotate(9deg); } 60% { transform: scale(1.05) rotate(-6deg); } 80% { transform: scale(1.02) rotate(3deg); } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .maia-poke img.logo, .login-logo, .pop-logo { animation: none; } }

/* ---------- viborita que piensa y aviso de "tocame" (v2.15.13) ---------- */
.snake-typing { display: inline-flex; align-items: center; margin-right: 8px; vertical-align: middle; }
.snake-typing .snake-body { animation: snake-slide .9s linear infinite; }
.snake-typing .snake-head { animation: snake-bob .9s ease-in-out infinite; transform-origin: 47px 12px; }
.snake-typing .snake-tongue { animation: snake-tongue 1.8s steps(1) infinite; }
@keyframes snake-slide { from { transform: translateX(0); } to { transform: translateX(12px); } }
@keyframes snake-bob { 0%, 100% { transform: translateY(-1.2px) rotate(-4deg); } 50% { transform: translateY(1.2px) rotate(4deg); } }
@keyframes snake-tongue { 0%, 60% { opacity: 0; } 61%, 80% { opacity: 1; } 81%, 100% { opacity: 0; } }
.login-mark { position: relative; display: inline-block; align-self: flex-start; }
.poke-hint {
  position: absolute; left: calc(100% - 6px); top: 6px; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px;
  padding: 6px 12px; border-radius: 16px 16px 16px 4px; box-shadow: var(--float);
  animation: hint-pop 2.4s ease-in-out infinite; pointer-events: none;
}
@keyframes hint-pop { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4px) scale(1.04); } }
/* De vez en cuando la víbora se sacude sola para invitar a tocarla. */
.chat-empty .maia-poke img.logo { animation: maia-float 4.5s ease-in-out infinite, maia-nudge 9s ease-in-out 3s infinite; }
@keyframes maia-nudge { 0%, 88%, 100% { rotate: 0deg; } 91% { rotate: -9deg; } 94% { rotate: 8deg; } 97% { rotate: -4deg; } }
@media (prefers-reduced-motion: reduce) { .snake-typing *, .poke-hint, .chat-empty .maia-poke img.logo { animation: none !important; } }

/* ---------- Maia viva de frente (v2.15.19) ---------- */
.maia-live .ml-tilt { transform-box: view-box; transform-origin: 120px 126px; animation: ml-tilt 4.8s ease-in-out infinite; }
.maia-live .ml-pupil { animation: ml-look 7s ease-in-out infinite; }
.maia-live .ml-eye { transform-box: fill-box; transform-origin: 50% 50%; animation: ml-blink 4.2s infinite; }
.maia-live .ml-tongue { transform-box: view-box; transform-origin: 120px 112px; animation: ml-tongue 3.6s ease-in-out infinite; }
@keyframes ml-tilt { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }
@keyframes ml-look { 0%,22%,100% { transform: translate(0,0); } 28%,44% { transform: translate(-3.5px,.5px); } 50%,66% { transform: translate(3.5px,.5px); } 72%,94% { transform: translate(0,1.5px); } }
@keyframes ml-blink { 0%,92%,100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@keyframes ml-tongue { 0%,58%,100% { transform: scaleY(0); } 64% { transform: scaleY(1) rotate(-6deg); } 70% { transform: scaleY(.85) rotate(6deg); } 76% { transform: scaleY(1) rotate(-4deg); } 84% { transform: scaleY(0); } }
.maia-live { display: block; overflow: visible; }
.maia-poke svg.logo { width: 64px; height: 64px; animation: none; }
.login-mark .maia-poke svg.logo, .voz .maia-poke svg.logo { width: 112px; height: 112px; }
.chat-empty .maia-poke svg.logo { width: 120px; height: 120px; animation: none; }
svg.pop-logo { width: 76px; height: 76px; animation: none; }
.mia-av { display: inline-block; }
.mia-av svg { width: 100%; height: 100%; }
.tab-main .tab-maia { width: 58px; height: 58px; margin-left: -29px; bottom: -6px; animation: none; filter: drop-shadow(0 3px 6px rgb(40 20 90 / .22)); }
.tab-main.is-on .tab-maia { width: 64px; height: 64px; margin-left: -32px; }
.maia-poke svg.is-poked, .mia-av.is-poked, .tab-main:active .tab-maia { animation: maia-wiggle .7s cubic-bezier(.3,1.6,.5,1) both !important; }
.is-poked .ml-tongue { animation: ml-tongue-now .8s ease-in-out both; }
@keyframes ml-tongue-now { 0%,100% { transform: scaleY(0); } 30% { transform: scaleY(1) rotate(-8deg); } 55% { transform: scaleY(.85) rotate(8deg); } 75% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .maia-live * { animation: none !important; } }

/* ---------- Maia con la cabeza del logo (v2.15.20) ---------- */
.maia-live .mh-tilt { transform-box: view-box; transform-origin: 100px 112px; animation: mh-tilt 4.8s ease-in-out infinite; }
.maia-live .mh-pupil { animation: mh-look 7s ease-in-out infinite; }
.maia-live .mh-lid { transform-box: fill-box; transform-origin: 50% 0%; transform: scaleY(0); animation: mh-blink 4.2s infinite; }
.maia-live .mh-tongue { transform-box: view-box; transform-origin: 500px 288px; animation: mh-tongue 3.6s ease-in-out infinite; }
@keyframes mh-tilt { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(5deg); } }
@keyframes mh-look { 0%,22%,100% { transform: translate(0,0); } 28%,44% { transform: translate(-9px,2px); } 50%,66% { transform: translate(8px,-3px); } 72%,94% { transform: translate(-3px,6px); } }
@keyframes mh-blink { 0%,92%,100% { transform: scaleY(0); } 95% { transform: scaleY(1); } }
@keyframes mh-tongue { 0%,55%,100% { transform: scale(1,.35); } 61% { transform: scale(1,1.15) rotate(-8deg); } 67% { transform: scale(1,.95) rotate(7deg); } 73% { transform: scale(1,1.1) rotate(-5deg); } 82% { transform: scale(1,.35); } }
.is-poked .mh-tongue { animation: mh-tongue-now .8s ease-in-out both; }
@keyframes mh-tongue-now { 0%,100% { transform: scale(1,.35); } 30% { transform: scale(1,1.2) rotate(-9deg); } 55% { transform: scale(1,1) rotate(8deg); } 75% { transform: scale(1,1.1); } }

/* ---------- Selva (v2.15.22): hojas suaves detrás de todo, se mecen; sin tocar los violetas ---------- */
:root { --leaf: #2E9E6A; --leaf-2: #3DBA7E; --leaf-vein: #F4F1FC; --leaf-op: .16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --leaf: #2FCB8C; --leaf-2: #46E0A0; --leaf-vein: #110D24; --leaf-op: .10; } }
:root[data-theme="dark"] { --leaf: #2FCB8C; --leaf-2: #46E0A0; --leaf-vein: #110D24; --leaf-op: .10; }
#jungle { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
body:not(.authed) #jungle { opacity: .9; }
#app { position: relative; z-index: 1; }
.j-leaf { position: absolute; color: var(--leaf); opacity: var(--leaf-op); }
.j-monstera { width: 230px; right: -78px; top: calc(var(--safe-t) - 46px); transform-origin: 100% 0%; animation: j-sway 9s ease-in-out infinite; }
.j-palm { width: 260px; left: -70px; bottom: calc(var(--tabbar) + var(--safe-b) - 30px); color: var(--leaf-2); transform-origin: 0% 90%; animation: j-sway 11s ease-in-out -3s infinite reverse; }
.j-vine { width: 46px; left: -8px; top: calc(var(--safe-t) - 8px); transform-origin: 50% 0%; animation: j-swing 7s ease-in-out infinite; }
.j-fall { position: absolute; width: 18px; top: -30px; color: var(--leaf-2); opacity: 0; }
.j-fall.f1 { left: 72%; animation: j-fall 19s linear 4s infinite; }
.j-fall.f2 { left: 28%; width: 14px; animation: j-fall 23s linear 13s infinite; }
@keyframes j-sway { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-4deg); } }
@keyframes j-swing { 0%, 100% { transform: rotate(2.5deg); } 50% { transform: rotate(-2.5deg); } }
@keyframes j-fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  6% { opacity: calc(var(--leaf-op) * 2.2); }
  25% { transform: translate(-26px, 25vh) rotate(80deg); }
  50% { transform: translate(18px, 50vh) rotate(170deg); }
  75% { transform: translate(-20px, 75vh) rotate(260deg); }
  90% { opacity: calc(var(--leaf-op) * 2.2); }
  100% { transform: translate(10px, 105vh) rotate(350deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { #jungle * { animation: none !important; } .j-fall { display: none; } }
/* La pestaña Maia lleva su cabecita en vez del globito */
.tab-mia-head { width: 34px; height: 30px; display: block; }
/* Íconos de selva (v2.15.23): el de la pestaña elegida se mece como hoja */
.tab:not(.tab-main).is-on .tab-ico svg { animation: j-tab 3.2s ease-in-out infinite; transform-origin: 50% 85%; }
.tab:not(.tab-main):active .tab-ico svg { animation: maia-wiggle .6s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes j-tab { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-6deg); } 65% { transform: rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .tab .tab-ico svg { animation: none !important; } }

/* v2.15.24: las hojas distraían — más tenues, sin nervadura marcada y sin hojitas que caen */
:root { --leaf-op: .07; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --leaf-op: .045; } }
:root[data-theme="dark"] { --leaf-op: .045; }
.j-monstera path[stroke] { display: none; }
.j-fall { display: none !important; }
.j-monstera { width: 190px; right: -84px; }
.j-palm { width: 210px; left: -84px; }

/* v2.15.26: ver mensajes anteriores */
.chat-more { display: block; margin: 4px auto 14px; }

/* ---------- Fondo selva (v2.15.29): elegido por Benjamín "la del medio" — lima de día, bosque de noche ---------- */
:root {
  --paper: #D9F2A6; --line: #C2E383; --accent-soft: #E9E2FF;
  --leaf: #4C8A13; --leaf-2: #5E9E22; --leaf-vein: #D9F2A6; --leaf-op: .12;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #123D1C; --surface: #1B4E27; --line: #2A6538; --muted: #BCD6BF; --accent-soft: #235C31;
    --leaf: #7DEB8E; --leaf-2: #8FF09E; --leaf-vein: #123D1C; --leaf-op: .08;
  }
}
:root[data-theme="dark"] {
  --paper: #123D1C; --surface: #1B4E27; --line: #2A6538; --muted: #BCD6BF; --accent-soft: #235C31;
  --leaf: #7DEB8E; --leaf-2: #8FF09E; --leaf-vein: #123D1C; --leaf-op: .08;
}

/* ---------- v2.15.30: Maia habla en violeta, la persona en verde; íconos de abajo del color de Maia ---------- */
:root { --maia: #6028F6; --maia-ink: #FFFFFF; --me: #2F7A21; --me-ink: #FFFFFF; --tab-ico: #6028F6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --me: #8FE388; --me-ink: #0E2A13; --tab-ico: #8A63FF; } }
:root[data-theme="dark"] { --me: #8FE388; --me-ink: #0E2A13; --tab-ico: #8A63FF; }
.from-mia .bubble { background: var(--maia); color: var(--maia-ink); border-color: transparent; box-shadow: 0 8px 22px color-mix(in srgb, var(--maia) 28%, transparent); }
.from-mia .bubble .caret { background: var(--maia-ink); }
.from-me .bubble { background: var(--me); color: var(--me-ink); box-shadow: 0 8px 22px color-mix(in srgb, var(--me) 30%, transparent); }
/* Mientras piensa, la burbuja queda clara para que se vea la viborita */
.from-mia.typing .bubble { background: var(--surface); color: var(--muted); border: 1px solid var(--line); box-shadow: var(--float); }
.tab:not(.tab-main) .tab-ico { color: var(--tab-ico); }

/* ---------- v2.15.30: Maia habla en violeta, la persona en verde; íconos de abajo en el estilo y color de la víbora ---------- */
:root { --maia: #6028F6; --maia-ink: #FFFFFF; --me: #2F7A21; --me-ink: #FFFFFF; --ic-v: #6028F6; --ic-d: #511A8F; --ic-c: #FFF4D8; --ic-r: #E5263A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --me: #8FE388; --me-ink: #0E2A13; --ic-d: #B9A2FF; } }
:root[data-theme="dark"] { --me: #8FE388; --me-ink: #0E2A13; --ic-d: #B9A2FF; }
.from-mia .bubble { background: var(--maia); color: var(--maia-ink); border-color: transparent; box-shadow: 0 8px 22px color-mix(in srgb, var(--maia) 28%, transparent); }
.from-mia .bubble .caret { background: var(--maia-ink); }
.from-me .bubble { background: var(--me); color: var(--me-ink); box-shadow: 0 8px 22px color-mix(in srgb, var(--me) 30%, transparent); }
.from-mia.typing .bubble { background: var(--surface); color: var(--muted); border: 1px solid var(--line); box-shadow: var(--float); }
.tab-svg .i-v { fill: var(--ic-v); } .tab-svg .i-d { fill: var(--ic-d); } .tab-svg .i-c { fill: var(--ic-c); } .tab-svg .i-r { fill: var(--ic-r); }
.tab-svg .i-cs { fill: none; stroke: var(--ic-c); } .tab-svg .i-rs { fill: none; stroke: var(--ic-r); }
.tab:not(.tab-main) .tab-ico { height: 36px; }
.tab:not(.tab-main):not(.is-on) .tab-svg { opacity: .78; }

/* ---------- v2.15.31: barra de abajo negra (elegida por Benjamín) para que resalte Maia ---------- */
.tabs { background: #0E1A12; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 12px 30px rgb(0 0 0 / .35); }
.tabs .tab { color: #D9D2F5; }
.tabs .tab.is-on { color: #B9A2FF; }
.tabs .tab-svg { --ic-d: #B9A2FF; }
.tabs .tab:not(.tab-main):not(.is-on) .tab-svg { opacity: .9; }

/* ---------- v2.15.34: mientras piensa, la viborita escribe con el lápiz del logo ---------- */
.snake-typing .snake-scribble { stroke: var(--ic-v); opacity: .55; stroke-dasharray: 30; stroke-dashoffset: 30; animation: snake-scribble 1.8s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .snake-typing .snake-scribble { stroke: #B9A2FF; } }
:root[data-theme="dark"] .snake-typing .snake-scribble { stroke: #B9A2FF; }
@keyframes snake-scribble { 0% { stroke-dashoffset: 30; opacity: .6; } 70% { stroke-dashoffset: 0; opacity: .6; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .snake-typing .snake-scribble { animation: none; stroke-dashoffset: 0; } }

/* ---------- v2.15.35: la viborita escribe las letras a medida que aparecen ---------- */
.snake-writer { display: inline-block; width: 1.85em; height: 1.25em; margin-left: 1px; vertical-align: -0.2em; line-height: 0; transform-origin: 3% 92%; animation: snake-writer .32s ease-in-out infinite alternate; }
.snake-writer svg { width: 100%; height: 100%; overflow: visible; }
@keyframes snake-writer { from { rotate: -7deg; translate: 0 0; } to { rotate: 5deg; translate: 0 -1px; } }
@media (prefers-reduced-motion: reduce) { .snake-writer { animation: none; } }

/* ---------- v2.15.37: escritura más lenta y elegante — la letra nueva aparece como tinta que se asienta ---------- */
.ink { transition: none; }
.ink-0 { opacity: .15; } .ink-1 { opacity: .35; } .ink-2 { opacity: .55; } .ink-3 { opacity: .78; } .ink-4 { opacity: .92; }
.snake-writer { animation: snake-writer 1.1s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes snake-writer { 0% { rotate: -4deg; translate: 0 0; } 25% { rotate: 2deg; translate: .5px -1px; } 50% { rotate: -2deg; translate: 1px 0; } 75% { rotate: 3deg; translate: .5px -1px; } 100% { rotate: -4deg; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) { .snake-writer { animation: none; } }

/* ---------- v2.15.38: Maia entera escribiendo (cuerpo, cola y la cabeza del logo), con borde crema para verse sobre el violeta ---------- */
.snake-writer { width: 3.9em; height: 1.4em; vertical-align: -0.12em; margin-left: 0; transform-origin: 2% 93%; }

/* ---------- v2.16.0: tipografía de pluma — títulos en caligrafía (Pinyon Script), todo lo demás en Garamond (EB Garamond); OFL ---------- */
@font-face { font-family: 'Pinyon Script'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/pinyon-script-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/eb-garamond-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/eb-garamond-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 600 800; font-display: swap; src: url('/fonts/eb-garamond-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/eb-garamond-latin-400-italic.woff2') format('woff2'); }
:root {
  --font-script: 'Pinyon Script', 'Snell Roundhand', 'Apple Chancery', cursive;
  --font-display: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --font-body: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
}
body { font-size-adjust: 0.47; }
.display, .day-head h2, .chat-name { font-family: var(--font-script); font-weight: 400; letter-spacing: 0; line-height: 1.3; font-size-adjust: 0.4; }
.display.step-title, .display.guide-title, .day.is-free .day-head h2 { font-family: var(--font-display); font-weight: 600; font-size-adjust: 0.47; line-height: 1.15; }
.startcard-task, .title-btn, .account-balance, .sheet-title, .pop-t { font-weight: 600; letter-spacing: 0; }
.login-claim.display { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size-adjust: 0.47; line-height: 1.3; }
.chat-name { font-size-adjust: 0.52; line-height: 1.2; }

/* ---------- v2.16.1: caligrafía más legible — Sacramento (trazo parejo, menos curvas) en vez de Pinyon; OFL ---------- */
@font-face { font-family: 'Sacramento'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/sacramento-latin-400-normal.woff2') format('woff2'); }
:root { --font-script: 'Sacramento', 'Snell Roundhand', cursive; }
.display, .day-head h2, .chat-name { font-size-adjust: 0.44; }
.chat-name { font-size-adjust: 0.56; }
.display.step-title, .display.guide-title, .day.is-free .day-head h2, .login-claim.display { font-size-adjust: 0.47; }
/* v2.16.2: la frase del cierre es larga — Garamond cursiva en vez de caligrafía */
.closing-line.display { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size-adjust: 0.47; line-height: 1.3; }
/* v2.16.3: mientras Maia piensa el consejo de Hoy */
.lede-wait { color: var(--muted); display: flex; align-items: center; gap: 8px; font-style: italic; }

/* ---------- v2.16.4: el sueño a la mañana y la sugerencia de acostarse temprano en el cierre ---------- */
.sleep-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 18px 14px; margin: 0 0 22px; box-shadow: var(--float); }
.sleep-q { font-family: var(--font-script); font-size: 30px; font-size-adjust: 0.44; line-height: 1.25; margin: 0 0 10px; }
.sleep-q2 { color: var(--muted); margin: 16px 0 8px; }
.sleep-card .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sleep-card .stack { margin-top: 14px; }
.bed-tip { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; margin: 18px 0; }
.bed-tip-k { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.sleep-q { font-family: var(--font-display); font-style: italic; font-size: 22px; font-size-adjust: 0.47; line-height: 1.3; }
.sleep-card .bed-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.sleep-card .bed-chips::-webkit-scrollbar { display: none; }
.sleep-card .bed-chips .chip { flex: none; }
.sleep-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

/* ---------- v2.17: Mercados en Hoy ---------- */
.mk-refresh { font-size: 15px; }
/* v2.20.8: Mercados se descubren de a poco — globo "Mercados" y, abajo, las categorías una debajo de la otra (v2.20.9: sin globitos,
   renglones finos con flechita); cada una baja sus precios ahí mismo, de a una */
.markets { margin: 0 0 22px; }
.mk-globo svg { transition: transform .25s ease; }
.mk-globo.is-open { border-color: var(--accent); color: var(--accent); }
.mk-globo.is-open svg { transform: rotate(180deg); }
.mk-cats { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); }
.mk-cat { border-bottom: 1px solid var(--line); scroll-margin: calc(var(--safe-t) + 12px) 0 calc(var(--tabbar) + var(--safe-b) + 16px); }
.mk-cat-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; padding: 0 4px 0 2px;
  background: none; border: 0; color: var(--ink); font: inherit; font-size: 18px; text-align: left; }
.mk-cat-btn svg { flex: none; color: var(--muted); transition: transform .25s ease; }
.mk-cat.is-open .mk-cat-btn { color: var(--accent); font-weight: 600; }
.mk-cat.is-open .mk-cat-btn svg { color: var(--accent); transform: rotate(180deg); }
.mk-cat .mk-drop { padding: 0 0 6px 14px; }
.mk-cat .mk-drop .mk-row { border-bottom-color: color-mix(in srgb, var(--line) 60%, transparent); }
.mk-foot { display: flex; justify-content: flex-end; }
.mk-empty { margin: 12px 2px 0; }
@keyframes mk-drop { from { opacity: 0; transform: translateY(-8px); } }
.mk-cats.is-fresh, .mk-drop.is-fresh { animation: mk-drop .28s ease-out both; } /* sin style en línea: la política de seguridad no lo deja */
@media (prefers-reduced-motion: reduce) { .mk-cats.is-fresh, .mk-drop.is-fresh { animation: none; } .mk-globo svg, .mk-cat-btn svg { transition: none; } }
.mk-list { list-style: none; margin: 0; padding: 0; }
.mk-row { display: grid; grid-template-columns: 1fr auto 74px; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.mk-row:last-child { border-bottom: 0; }
.mk-l { display: flex; flex-direction: column; line-height: 1.2; }
.mk-pos { font-size: 13px; color: var(--muted); }
.mk-when { font-size: 12.5px; color: var(--muted); }
.mk-v { text-align: right; display: flex; flex-direction: column; line-height: 1.2; font-variant-numeric: tabular-nums; }
.mk-sub { font-size: 12.5px; color: var(--muted); }
.mk-ch { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
.mk-ch.up { color: #2F9E44; }
.mk-ch.down { color: #E5263A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mk-ch.up { color: #8FE388; } :root:not([data-theme="light"]) .mk-ch.down { color: #FF8A95; } }
:root[data-theme="dark"] .mk-ch.up { color: #8FE388; }
:root[data-theme="dark"] .mk-ch.down { color: #FF8A95; }

/* ---------- v2.17.8: varias fotos de una a Maia ---------- */
.attach-chips { display: flex; gap: 8px; align-items: center; overflow-x: auto; max-width: 52vw; padding: 6px 4px 2px; flex: none; scrollbar-width: none; }
.attach-chips::-webkit-scrollbar { display: none; }
.attach-chips .attach-chip { width: 44px; height: 44px; }
.attach-chips .attach-chip img { width: 44px; height: 44px; }
.attach-more { flex: none; width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; color: var(--accent); border: 1.5px dashed var(--accent); cursor: pointer; }
.msg-photos { display: grid; gap: 6px; margin-bottom: 6px; justify-content: end; }
.msg-photos.n2 { grid-template-columns: repeat(2, 110px); }
.msg-photos.n3 { grid-template-columns: repeat(3, 84px); }
.msg-photos.n2 .msg-photo, .msg-photos.n3 .msg-photo { width: 100%; height: 110px; margin: 0; border-radius: 16px; }
.msg-photos.n3 .msg-photo { height: 84px; }
.composer:has(.attach-chips) { flex-wrap: wrap; }
.composer .attach-chips { flex-basis: 100%; max-width: none; order: -1; }

/* v2.17.12 — confirmar todas juntas */
.pop .pop-all { width: 100%; margin-top: 10px; }

/* Seguridad (v2.19) */
.code-big { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: .06em; text-align: center; padding: 14px 10px; margin: 8px 0; border-radius: 14px; background: var(--accent-soft); color: var(--ink); user-select: all; -webkit-user-select: all; word-break: break-all; }
.warn-box { border: 1px solid var(--danger); color: var(--danger); border-radius: 14px; padding: 12px 14px; margin: 8px 0 12px; font-size: 15px; }
.banner-warn { display: block; width: 100%; text-align: left; border: 1px solid var(--danger); color: var(--danger); background: var(--surface); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; font: inherit; font-size: 15px; cursor: pointer; }

/* ---------- v2.20.4: Maia en Hoy y en la Agenda (se le habla sin cambiar de pestaña) ---------- */
.ask { margin: 2px 0 24px; }
.ask-list { margin: 0 0 8px; }
.ask-links { display: flex; gap: 18px; justify-content: flex-end; margin: 0 4px 10px; font-size: 14px; }

/* ---------- v2.20.4: en la barra de abajo se nota cuál está elegida; las demás se apagan ---------- */
.tabs .tab:not(.is-on) .tab-label { color: #8C86A6; }
.tabs .tab:not(.tab-main):not(.is-on) .tab-svg { opacity: .4; filter: saturate(.35); }
.tabs .tab:not(.tab-main).is-on { background: rgb(185 162 255 / .17); border-radius: 22px; }
.tabs .tab.is-on .tab-label { color: #FFFFFF; font-weight: 700; }

/* ---------- v2.20.6: micrófono para dictar (cuadro de Maia y Capturar) ---------- */
.mic.is-rec { background: #E5263A; border-color: #E5263A; color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(229 38 58 / .45); } 50% { box-shadow: 0 0 0 10px rgb(229 38 58 / 0); } }
@media (prefers-reduced-motion: reduce) { .mic.is-rec { animation: none; } }
.pill .mic.is-rec, .ask-bar .mic.is-rec, .cap-foot .mic.is-rec { background: #E5263A; color: #fff; }
.cap-box { display: flex; flex-direction: column; border: 1.5px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cap-box:focus-within { border-color: var(--accent); }
.capture .cap-box textarea { min-height: 40dvh; border: 0; background: transparent; }
.cap-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 8px 8px 18px; font-size: 15px; }
.cap-foot .mic { width: 46px; height: 46px; border: 0; background: transparent; }

/* ---------- v2.20.11: en el iPhone, una sola vez, cómo dejar permitido el micrófono (arriba, fijo, hasta tocar Entendido) ---------- */
.mic-tip {
  position: fixed; z-index: 45; left: var(--gutter); right: var(--gutter);
  top: calc(var(--safe-t) + 10px); max-width: 528px; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: start;
  padding: 14px 16px 4px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--accent); box-shadow: var(--float);
  font-size: 16px; line-height: 1.4;
}
.mic-tip-ico { color: var(--accent); padding-top: 2px; }
.mic-tip p { margin: 0; }
.mic-tip .link { grid-column: 2; justify-self: end; padding: 8px 0; min-height: 0; }

/* v2.20.12: cuánto tardó la última vuelta del modo voz y qué voz habló (solo el dueño, para afinar) */
.voz-metrics { font-size: 12.5px; line-height: 1.35; color: var(--muted); max-width: 36ch; margin: 2px auto 0; text-align: center; opacity: .85; }

/* el <svg> de definiciones de index.html va sin style en línea (la política de seguridad no lo deja) */
.svg-defs { position: absolute; }
