/* UI kit de la app de Bēck. Es el mismo de la landing: papel cálido, verde, Plus Jakarta Sans y la marca en Manrope.
   Reglas del kit: ningún texto por debajo de 14px, botones de 44px de alto como mínimo, el color nunca es la única señal. */
:root {
  --bg: #F4F2EC; --card: #FFFEFB; --ink: #18201C; --muted: #5F665F; --line: #E1DED3; --neutral: #E9E6DC;
  --green: #0B6B43; --green-soft: #CDEFD9; --green-mid: #5CC98F; --cream: #FFF8EC;
  --danger: #A8442E; --danger-soft: #F6E1DA; --amber: #8A5A00; --amber-soft: #F7E9C4;
  --r-btn: 12px; --r-card: 20px; --r-sm: 10px;
  --shadow: 0 18px 44px rgba(24, 32, 28, .08);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --bar-h: 64px; --tab-h: 0px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ol, dl, dd { margin: 0; }
h1 { font-size: 36px; line-height: 1.08; font-weight: 700; letter-spacing: -.035em; text-wrap: balance; }
h2 { font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: 15px; }
.stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; } .row.end { justify-content: flex-end; }
.kicker { font-size: 14px; line-height: 1.3; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--green); }
.lead { font-size: 18px; line-height: 1.5; color: var(--muted); max-width: 560px; }
.fine { font-size: 14px; line-height: 1.4; color: var(--muted); }
.msg:empty { display: none; } .msg { color: var(--danger); font-size: 15px; font-weight: 500; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }

/* barra superior y navegación */
.bar { flex: none; height: var(--bar-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 0 24px; background: rgba(244, 242, 236, .86); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid rgba(24, 32, 28, .07); position: relative; z-index: 5; }
.wm { justify-self: start; font-family: 'Manrope', system-ui, sans-serif; font-weight: 700; font-size: 26px; letter-spacing: -.04em; line-height: 1; text-decoration: none; }
.bar-right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 4px; }
.nav button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; background: transparent; border-radius: 999px; font-size: 15px; font-weight: 600; color: var(--muted); }
.nav button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav button:hover { color: var(--ink); }
.nav button.on { background: var(--ink); color: var(--cream); }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 14px; font-weight: 700; display: inline-grid; place-items: center; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-btn); border: 1px solid transparent; font-size: 15px; font-weight: 600; text-decoration: none; background: transparent; }
.btn.lg { min-height: 52px; padding: 0 26px; font-size: 16px; }
.btn.sm { min-height: 44px; padding: 0 14px; }
.btn.primary { background: var(--green); color: var(--cream); }
.btn.primary:hover { background: #095a38; }
.btn.outline { border-color: var(--ink); }
.btn.ghost { color: var(--muted); } .btn.ghost:hover { color: var(--ink); background: var(--neutral); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.outline-danger { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }

/* entrada y alta */
.center { flex: 1; display: grid; place-items: center; padding: 32px 20px; overflow: auto; }
.intro { width: 100%; max-width: 520px; padding: 40px; display: flex; flex-direction: column; gap: 20px; box-shadow: var(--shadow); }
.intro .btn.lg, .intro .gsi-material-button { align-self: flex-start; }
.facts { list-style: none; padding: 0; display: flex; flex-direction: column; counter-reset: f; }
.facts li { counter-increment: f; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.facts li::before { content: counter(f); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 14px; font-weight: 700; display: grid; place-items: center; }
.facts li b { font-size: 16px; } .facts li span { grid-column: 2; font-size: 15px; color: var(--muted); }
.facts.plain { display: flex; flex-direction: column; }
.facts.plain > div { padding: 16px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.facts.plain dt { font-size: 16px; font-weight: 700; } .facts.plain dd { font-size: 16px; color: var(--muted); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; line-height: 1.4; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--green); flex: none; }

/* botón de Google, tema claro según sus pautas */
.gsi-material-button { position: relative; box-sizing: border-box; height: 48px; padding: 0 16px; border: 1px solid #747775; border-radius: var(--r-btn); background: #fff; color: #1f1f1f; font-family: 'Roboto', arial, sans-serif; font-size: 15px; font-weight: 500; letter-spacing: .25px; overflow: hidden; cursor: pointer; }
.gsi-material-button .gsi-material-button-icon { height: 20px; width: 20px; min-width: 20px; margin-right: 12px; }
.gsi-material-button .gsi-material-button-content-wrapper { position: relative; display: flex; align-items: center; height: 100%; }
.gsi-material-button .gsi-material-button-state { position: absolute; inset: 0; opacity: 0; background: #303030; transition: opacity .2s; }
.gsi-material-button:hover .gsi-material-button-state { opacity: .08; }
.gsi-material-button:active .gsi-material-button-state, .gsi-material-button:focus .gsi-material-button-state { opacity: .12; }

/* la app: una vista a la vez */
.app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; }
.page > *, .chat > * { flex-shrink: 0; }
.page { overflow: auto; padding: 56px 24px 72px; display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 728px; margin: 0 auto; }
.page.wide { max-width: 920px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.list { display: flex; flex-direction: column; gap: 12px; }
.empty { padding: 28px; border: 1px dashed var(--line); border-radius: var(--r-card); color: var(--muted); font-size: 16px; text-align: center; }

/* chat */
.chatview { display: flex; flex-direction: column; }
.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 32px 24px 16px; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 728px; margin: 0 auto; }
.bub { max-width: 84%; padding: 12px 16px; font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; animation: pop .28s both; }
.bub p { margin: 0; } .bub p + p { margin-top: 10px; }
.bub.ai { align-self: flex-start; background: var(--neutral); border-radius: 16px 16px 16px 4px; }
.bub.me { align-self: flex-end; background: var(--ink); color: var(--cream); border-radius: 16px 16px 4px 16px; }
.bub.typing { display: inline-flex; gap: 5px; align-items: center; padding: 16px; }
.bub.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.bub.typing i:nth-child(2) { animation-delay: .15s; } .bub.typing i:nth-child(3) { animation-delay: .3s; }
.sys { align-self: center; text-align: center; font-size: 15px; color: var(--muted); max-width: 90%; padding: 6px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.welcome { margin: auto 0; display: flex; flex-direction: column; gap: 18px; padding: 24px 0; }
.welcome h1 { font-size: 34px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; font-size: 15px; font-weight: 500; text-align: left; }
.chip:hover { border-color: var(--ink); }
.dock { flex: none; width: 100%; max-width: 728px; margin: 0 auto; padding: 8px 24px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--green); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: 16px; line-height: 1.5; color: var(--ink); padding: 10px 0; max-height: 120px; }
.composer textarea::placeholder { color: var(--muted); }
.send { flex: none; width: 44px; height: 44px; border-radius: var(--r-btn); border: 0; background: var(--green); color: var(--cream); display: grid; place-items: center; }
.send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dock .fine { text-align: center; }

/* tu hilo */
.cm { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cm .txt { font-size: 17px; font-weight: 600; }
.cm .when { font-size: 15px; color: var(--muted); }
.cm.done .txt { color: var(--muted); text-decoration: line-through; }
.tag { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; background: var(--neutral); color: var(--ink); }
.tag.go { background: var(--green-soft); color: var(--green); }
.tag.now { background: var(--amber-soft); color: var(--amber); }

/* tus datos */
.danger-zone, .demo { padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.demo { background: var(--green-soft); border-color: rgba(11, 107, 67, .25); }

/* equipo */
.live { flex: none; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--green); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-mid); animation: blink 1.6s infinite both; }
.seg { display: inline-flex; align-self: flex-start; gap: 4px; padding: 4px; background: var(--neutral); border-radius: 14px; max-width: 100%; overflow-x: auto; }
.seg button { min-height: 44px; padding: 0 16px; border: 0; background: transparent; border-radius: var(--r-sm); font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(24, 32, 28, .08); }
.alert { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.alert.p1 { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.alert-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pchip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--neutral); }
.pchip.c1 { background: var(--danger); color: #fff; } .pchip.c2 { background: var(--danger-soft); color: var(--danger); }
.pchip.c3 { background: var(--amber-soft); color: var(--amber); } .pchip.c4, .pchip.c0 { background: var(--green-soft); color: var(--green); }
.case { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--muted); }
.what { font-size: 17px; line-height: 1.4; font-weight: 600; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv b { font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kv span { font-size: 16px; }
.conv { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--bg); border-radius: var(--r-sm); max-height: 360px; overflow: auto; }
.conv .bub { font-size: 15px; padding: 9px 13px; animation: none; }
.alert textarea { width: 100%; min-height: 88px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font: inherit; font-size: 16px; color: var(--ink); resize: vertical; }
.alert textarea:focus { outline: 0; border-color: var(--green); }
.bbtn { align-self: flex-start; min-height: 44px; padding: 0 16px; border-radius: var(--r-btn); border: 1px solid var(--ink); background: transparent; font-size: 15px; font-weight: 600; }
.bbtn.solid { background: var(--green); border-color: var(--green); color: var(--cream); }
.bbtn:disabled { opacity: .45; cursor: default; }
.feed-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 16px; }
.feed-item time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.feed-item.sig span { font-weight: 600; }

dialog { border: 1px solid var(--line); border-radius: var(--r-card); padding: 28px; max-width: 460px; width: calc(100% - 32px); background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(24, 32, 28, .45); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 12px; } dialog p { color: var(--muted); margin-bottom: 18px; }
/* ventana de entrada: aparece al enviar el primer mensaje; en teléfono sube desde abajo */
dialog.sheet { max-width: 480px; max-height: calc(100dvh - 24px); overflow: auto; }
dialog.sheet[open] { display: flex; flex-direction: column; gap: 14px; }
dialog.sheet h2, dialog.sheet p { margin-bottom: 0; }
dialog.sheet .facts li { padding: 10px 0; }
dialog.sheet .check { min-height: 0; font-size: 15px; }
dialog.sheet .gsi-material-button { align-self: stretch; }
dialog.sheet .gsi-material-button-content-wrapper { justify-content: center; }

@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* teléfono: la navegación baja a una barra inferior */
@media (max-width: 760px) {
  :root { --bar-h: 56px; }
  h1 { font-size: 30px; }
  /* sin desenfoque en la barra: si lo tiene, la navegación fija queda atada a ella y no baja */
  .bar { padding: 0 16px; background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .wm { font-size: 24px; }
  .who { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; justify-content: space-around; gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(255, 254, 251, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .nav button { flex: 1; flex-direction: column; gap: 2px; min-height: 52px; padding: 4px 2px; border-radius: 12px; font-size: 14px; position: relative; }
  .nav button.on { background: transparent; color: var(--green); }
  .nav button .count { position: absolute; top: 2px; left: calc(50% + 6px); }
  .app { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .app.guest { padding-bottom: 0; }
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: none; max-height: 92dvh; border-radius: 24px 24px 0 0; border-width: 1px 0 0; padding: 22px 18px calc(16px + env(safe-area-inset-bottom)); }
  .page { padding: 32px 20px 40px; }
  .chat { padding: 20px 16px 12px; }
  .dock { padding: 6px 16px 10px; }
  .bub { max-width: 88%; }
  .welcome h1 { font-size: 28px; }
  .intro { padding: 28px 22px; }
  .intro .btn.lg, .intro .gsi-material-button { align-self: stretch; }
  .cm { flex-direction: column; align-items: flex-start; gap: 10px; }
  .danger-zone .btn, .demo .btn { width: 100%; }
  .st { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .bub, .dot, .bub.typing i { animation: none !important; opacity: 1; } }
