:root {
  --bg: #FBF6F4; --card: #FFFFFF; --ink: #3B2A35; --muted: #6E5564; --soft: #564450;
  --accent: #A24E6E; --accent-dk: #7E3A55; --pink: #F6D5DC; --lilac: #EADDE8;
  --green: #557565; --green-lt: #E3EDE4; --sand: #F3E6C8; --line: #DCC9CF; --line-lt: #EFE4E6;
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: 'Jost', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); } a:hover { color: var(--accent-dk); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }
.serif { font-family: var(--serif); font-weight: 600; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.top { padding: 22px 20px 12px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.top h1 { font-family: var(--serif); font-weight: 600; font-size: 36px; line-height: 1.05; }
.icon-btn { width: 44px; height: 44px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.main { flex: 1; padding: 4px 20px 110px; display: flex; flex-direction: column; gap: 18px; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card { background: var(--card); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.card.pink { background: var(--pink); } .card.lilac { background: var(--lilac); } .card.green { background: var(--green-lt); } .card.sand { background: var(--sand); }
.card h3 { font-size: 17px; font-weight: 700; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.item .t { font-weight: 600; }
.time { font-weight: 700; min-width: 48px; font-variant-numeric: tabular-nums; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--lilac); color: var(--ink); white-space: nowrap; }

.btn { min-height: 44px; padding: 0 18px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dk); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[disabled] { opacity: .5; cursor: default; }
.link-btn { background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--lilac); border-color: #B99DB4; }
.chip.dark[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.check { width: 30px; height: 30px; border-radius: 99px; border: 2px solid #B79AA6; background: var(--card); flex: none; display: grid; place-items: center; padding: 0; }
.check[aria-pressed="true"] { background: var(--green); border-color: var(--green); }
.check svg { width: 16px; height: 16px; stroke: #fff; }
.done-text { text-decoration: line-through; color: var(--muted); }

.bar { height: 8px; border-radius: 99px; background: var(--line-lt); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.bar > span.hot { background: var(--accent); }
.big { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line-lt); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
.nav-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(7, 1fr); }
.nav button { background: none; border: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 2px; }
.nav button svg { width: 22px; height: 22px; }
.nav button[aria-current="page"] { color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lab { font-weight: 600; font-size: 14px; }
.input { min-height: 46px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 10px 14px; width: 100%; }
textarea.input { min-height: 90px; resize: vertical; }
.form { display: flex; flex-direction: column; gap: 14px; }
.error { background: var(--pink); color: var(--accent-dk); border-radius: 14px; padding: 10px 14px; font-weight: 600; }

.sheet-bg { position: fixed; inset: 0; background: rgba(59, 42, 53, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.sheet h2 { font-family: var(--serif); font-weight: 600; font-size: 28px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 24px; } }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-grid .dow { font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.cal-day { min-height: 46px; border-radius: 12px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day[aria-pressed="true"] { background: var(--lilac); }
.cal-day .dots { height: 4px; border-radius: 99px; background: var(--accent); }

.auth { max-width: 420px; margin: 0 auto; padding: 48px 24px; display: flex; flex-direction: column; gap: 22px; min-height: 100dvh; justify-content: center; }
.auth h1 { font-family: var(--serif); font-weight: 600; font-size: 44px; line-height: 1; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 99px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); text-align: center; }
.empty { border: 1px dashed var(--line); border-radius: 16px; padding: 16px; color: var(--muted); text-align: center; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; background: var(--card); border-radius: 18px 18px 18px 4px; padding: 12px 14px; white-space: pre-line; align-self: flex-start; }
.bubble.me { align-self: flex-end; background: var(--green-lt); border-radius: 18px 18px 4px 18px; }
.bubble.alert { background: var(--pink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* Con una hoja abierta el toast sale arriba para no tapar sus botones. */
body:has(.sheet-bg) .toast { top: calc(16px + env(safe-area-inset-top, 0px)); bottom: auto; }

/* Expediente laboral en la hoja de la persona */
.row.two { align-items: flex-start; }
.row.two > .field { flex: 1; min-width: 0; }
@media (max-width: 420px) { .row.two { flex-direction: column; align-items: stretch; gap: 16px; } }
details.exp { background: var(--card); border-radius: 18px; border: 1px solid var(--line-lt); }
details.exp > summary { min-height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; cursor: pointer; list-style: none; }
details.exp > summary::-webkit-details-marker { display: none; }
details.exp > summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-top: -4px; transition: transform .15s; }
details.exp[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.exp-in { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.docs-box { display: flex; flex-direction: column; gap: 10px; }
.item.doc { border: 1px solid var(--line-lt); }
.doc-name { display: block; overflow-wrap: anywhere; color: var(--ink); }
.doc-act { display: flex; gap: 6px; flex: none; }
.doc-act .btn { min-height: 40px; padding: 0 12px; }
.upload-row select { flex: 1; min-width: 0; }
.upload-row .btn { flex: none; }
.file-in { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-in:focus-visible + label { outline: 3px solid var(--green); outline-offset: 2px; }
.docs-status:empty { display: none; }
.docs-status { color: var(--green); font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; align-items: center; }
.meta-doc { display: inline-flex; align-items: center; gap: 3px; }
.meta-doc svg { width: 15px; height: 15px; }

/* Entrevista de arranque */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.step { font-size: 12px; font-weight: 600; letter-spacing: .04em; padding: 5px 11px; border-radius: 99px; background: var(--line-lt); color: var(--muted); }
.step.done { background: var(--green-lt); color: var(--green); }
.step[aria-current="step"] { background: var(--accent); color: #fff; }
.q-card { background: var(--card); border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.q-text { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.08; outline: none; }
.sug { background: var(--lilac); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.thinking { min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 8px; color: var(--muted); font-weight: 600; }
.thinking .ind { height: 3px; border-radius: 99px; background: var(--line-lt); overflow: hidden; position: relative; }
.thinking .ind::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: 99px; background: var(--accent); animation: cas-fill 9s cubic-bezier(.1, .6, .3, 1) forwards; }
/* Se llena una sola vez mientras Claude contesta (no da vueltas). */
@keyframes cas-fill { to { width: 92%; } }
.preview { gap: 10px; }
.pv-row { display: flex; gap: 10px; align-items: baseline; border-radius: 10px; }
.pv-k { font-weight: 700; min-width: 64px; }
.new-in { animation: cas-new 1.6s ease-out; }
@keyframes cas-new { from { background: var(--sand); box-shadow: 0 0 0 6px var(--sand); } to { background: transparent; box-shadow: 0 0 0 6px transparent; } }
textarea.input { resize: vertical; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .new-in { animation: none; } .thinking .ind::after { animation: none; width: 50%; } }

/* Casa de ejemplo (/demo): aviso arriba con la salida para crear su casa */
.demo-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; margin: 10px 12px 0; border-radius: 14px; background: var(--pink); color: var(--ink); font-size: 14px; line-height: 1.35; }
.demo-strip .btn { flex: 0 0 auto; padding: 8px 14px; font-size: 14px; }
a.link-btn { display: inline-flex; align-items: center; justify-content: center; }
