:root {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f6f5f1; --ink: #1d2622; --ink-2: #47504a; --muted: #7b8179;
  --line: #e8e3d8; --line-2: #f0ece2; --brand: #1e3b31; --brand-2: #2c5646; --brand-tint: #e5efe9; --gold: #b48a3c;
  --wine: #8a2f3c; --ok: #2d7a4d; --warn: #b36b12; --bad: #b0343c; --blue: #2a65a0;
  --mine: #dcefe3; --shadow: 0 24px 60px rgba(20, 30, 25, .18); --shadow-sm: 0 1px 2px rgba(30, 40, 35, .08);
  --display: 'Plus Jakarta Sans', 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --sans: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12150f; --surface: #1b201b; --surface-2: #151915; --ink: #eef1ec; --ink-2: #c3cbc3; --muted: #8e988f; --line: #2b322b; --line-2: #232923;
    --brand: #5aa383; --brand-2: #78bb9d; --brand-tint: #1f3028; --mine: #254033; --gold: #d3ad5f; --wine: #d9808c; --shadow: 0 24px 60px rgba(0, 0, 0, .5); }
}
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); font-variant-numeric: tabular-nums; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, input:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }

.shell { max-width: 1120px; margin: 0 auto; padding: 32px 24px; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 56px; align-items: start; }

/* ---------- columna de presentación ---------- */
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--display); margin-bottom: 28px; }
.mark { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(145deg, #d9b765, #a67c2e); color: #1b2b24; display: grid; place-items: center; font: 700 20px/1 var(--display); }
.side h1 { font: 800 clamp(28px, 4vw, 40px)/1.1 var(--display); letter-spacing: -.025em; margin: 0 0 14px; }
.lead { color: var(--ink-2); font-size: 17px; margin: 0 0 22px; max-width: 52ch; }
.how { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 12px; }
.how li { display: flex; gap: 12px; align-items: flex-start; }
.how .i { font-size: 20px; color: var(--brand); background: var(--brand-tint); width: 36px; height: 36px; padding: 8px; border-radius: 11px; }
.how span { padding-top: 6px; }
.fine { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; max-width: 60ch; }

.team { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.team h2 { margin: 0 0 10px; font: 700 12px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.team .empty { color: var(--muted); margin: 0; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface-2); display: grid; gap: 8px; margin-bottom: 10px; }
.card:last-child { margin-bottom: 0; }
.card b.t { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { text-align: right; font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 12%, transparent); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { --c: var(--ok); } .pill.warn { --c: var(--warn); } .pill.bad { --c: var(--bad); } .pill.blue { --c: var(--blue); }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.chip.severa { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.chiprow { display: flex; gap: 6px; flex-wrap: wrap; }
.alert { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: color-mix(in srgb, var(--bad) 6%, var(--surface)); }
.alert b.t { color: var(--bad); }
.note { color: var(--ink-2); font-size: 13.5px; margin: 0; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 12px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0e1f1a; } }

/* ---------- teléfono ---------- */
.phone { position: sticky; top: 24px; width: 100%; height: min(760px, calc(100dvh - 48px)); min-height: 520px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; position: relative; }
.wa-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .wa-head { color: #0e1f1a; } }
.av { width: 40px; height: 40px; border-radius: 50%; background: #d9b765; color: #1b2b24; display: grid; place-items: center; font: 700 17px var(--display); flex: none; }
.av.big { width: 96px; height: 96px; font-size: 40px; }
.who { flex: 1; min-width: 0; line-height: 1.25; }
.who b { display: block; font: 700 16px var(--display); }
.who small { opacity: .8; font-size: 12.5px; }
.hbtn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: inherit; display: grid; place-items: center; font-size: 19px; }
.hbtn:hover { background: rgba(255, 255, 255, .24); }
.hbtn[aria-pressed="true"] { background: #fff; color: var(--brand); }
@media (prefers-color-scheme: dark) { .hbtn { background: rgba(0, 0, 0, .15); } .hbtn[aria-pressed="true"] { background: #0e1f1a; color: #fff; } }

.msgs { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 6px; background-image: radial-gradient(color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px); background-size: 18px 18px; }
.day, .sys { align-self: center; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 3px 12px; border-radius: 10px; margin: 6px 0; box-shadow: var(--shadow-sm); }
.b { max-width: 82%; padding: 8px 12px 6px; border-radius: 14px; box-shadow: var(--shadow-sm); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.b.new { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.b.bot, .b.staff { align-self: flex-start; background: var(--surface); border-top-left-radius: 4px; }
.b.staff { border-left: 3px solid var(--gold); }
.b.customer { align-self: flex-end; background: var(--mine); border-top-right-radius: 4px; }
.b .meta { display: flex; gap: 4px; align-items: center; justify-content: flex-end; font-size: 11px; color: var(--muted); margin-top: 2px; }
.b .meta .i { font-size: 14px; color: var(--blue); }
.b .tag { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ok); margin-bottom: 3px; }
.b.staff .tag { color: var(--gold); }
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 11px 14px; background: var(--surface); border-radius: 14px; border-top-left-radius: 4px; box-shadow: var(--shadow-sm); }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 5px 12px; font-size: 13px; color: var(--ink-2); }
.chips button:hover { border-color: var(--brand); color: var(--brand); }
.notice { margin: 8px 12px 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--ink); }
.composer { display: flex; gap: 8px; align-items: center; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.composer input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 22px; padding: 11px 16px; background: var(--surface); }
.composer input:focus { border-color: var(--brand); outline: none; }
.mic, .send { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 20px; flex: none; }
.mic { background: var(--brand-tint); color: var(--brand); }
.mic.on { background: var(--bad); color: #fff; animation: ring 1.2s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.send { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .send { color: #0e1f1a; } }

/* ---------- llamada ---------- */
.call { position: absolute; inset: 0; background: linear-gradient(180deg, #16302a, #0e1f1a); color: #fff; display: flex; flex-direction: column; align-items: center; padding: 40px 20px 24px; gap: 18px; z-index: 5; }
.call-top { display: grid; justify-items: center; gap: 4px; text-align: center; }
.call-top b { font: 700 22px var(--display); margin-top: 14px; }
.call-top small { opacity: .75; font-size: 14px; min-height: 20px; }
.pulse { border-radius: 50%; padding: 10px; }
.pulse.listen { animation: ring2 1.6s infinite; }
.pulse.speak { animation: ring3 1s infinite; }
@keyframes ring2 { 0% { box-shadow: 0 0 0 0 rgba(107, 209, 155, .5); } 100% { box-shadow: 0 0 0 28px transparent; } }
@keyframes ring3 { 0%, 100% { box-shadow: 0 0 0 6px rgba(217, 183, 101, .35); } 50% { box-shadow: 0 0 0 18px rgba(217, 183, 101, .12); } }
.transcript { flex: 1; width: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; justify-content: flex-end; font-size: 15px; }
.transcript p { margin: 0; padding: 8px 12px; border-radius: 12px; max-width: 88%; }
.transcript .bot { background: rgba(255, 255, 255, .1); align-self: flex-start; }
.transcript .me { background: rgba(217, 183, 101, .22); align-self: flex-end; }
.transcript .live { opacity: .6; font-style: italic; }
.call-type { display: flex; gap: 8px; width: 100%; }
.call-type input { flex: 1; min-width: 0; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; border-radius: 22px; padding: 10px 16px; }
.call-type input::placeholder { color: rgba(255, 255, 255, .55); }
.call-type .send { background: rgba(255, 255, 255, .16); color: #fff; width: 42px; height: 42px; }
.hangup { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 30px; background: #d6453d; color: #fff; padding: 13px 28px; font-weight: 700; }
.hangup:hover { background: #bf3a33; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 28px; padding: 16px; }
  .phone { order: -1; position: relative; top: 0; height: calc(100dvh - 32px); max-height: 760px; }
  .brand { margin-bottom: 18px; }
}
