:root {
  color-scheme: light;
  /* Marca Charlie's Motors: azul marino del logo + azul CTA y naranja acento de charliesmotors.com */
  --brand: #0071E3;
  --brand-deep: #0058B0;
  --brand-ink: #0A2A7A;
  --brand-soft: #E8F1FD;
  --night: #0A1440;
  --night-2: #12205A;

  --bg: #F3F4F6;
  --card: #FFFFFF;
  --ink: #111827;
  --slate: #4B5563;
  --muted: #8B95A3;
  --line: rgba(17, 24, 39, .08);
  --green: #16A34A;
  --green-soft: #E7F6EC;
  --amber: #D97706;
  --amber-soft: #FEF3E2;
  --blue: #2563EB;
  --blue-soft: #E8EFFD;
  --wa: #25D366;
  --wa-bubble: #D9FDD3;
  --wa-bg: #EFEAE2;
  --ig: linear-gradient(45deg, #F58529, #DD2A7B 55%, #8134AF);
  --fb: #1877F2;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-1: 0 1px 2px rgba(17, 24, 39, .05), 0 4px 14px rgba(17, 24, 39, .06);
  --shadow-2: 0 2px 6px rgba(17, 24, 39, .06), 0 18px 40px rgba(17, 24, 39, .14);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 .95rem/1.5 var(--font); color: var(--slate); background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100dvh; overflow-x: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; font-weight: 600; letter-spacing: -.01em; }
b, strong { font-weight: 600; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 50%, transparent); outline-offset: 2px; border-radius: 10px; }

.btn { border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 8px; transition: transform .15s ease, background .2s ease, box-shadow .2s ease; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { background: var(--brand-deep); }
.btn-ghost { background: rgba(17, 24, 39, .06); color: var(--ink); }
.btn-ghost:hover { background: rgba(17, 24, 39, .1); }
.btn-green { background: var(--green); color: #fff; }
.btn-lg { padding: 15px 28px; font-size: 1.02rem; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 6px; font-size: .85rem; }

/* ================= Portada ================= */
.intro { min-height: 100dvh; background: radial-gradient(1200px 600px at 50% -10%, #1B2C78 0%, var(--night) 60%); color: #C9CED6; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 48px var(--gutter); }
.intro-inner { max-width: 980px; width: 100%; min-width: 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.intro-logo { height: 64px; width: auto; filter: drop-shadow(0 4px 20px rgba(0,0,0,.4)); }
.eyebrow { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: #8C94A1; }
.intro h1 { color: #fff; font-size: clamp(1.7rem, 4.2vw, 3rem); line-height: 1.12; max-width: 860px; }
.intro h1 em { font-style: normal; color: #FF6B35; }
.intro-lead { font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 720px; color: #AEB5C0; }
.proof { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; width: 100%; max-width: 760px; margin: 10px 0 4px; text-align: left; }
.phone { min-width: 0; background: var(--wa-bg); border-radius: 22px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.45); border: 6px solid #1B2230; }
.phone-top { background: #075E54; color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: .86rem; }
.phone-top .av { width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.phone-top .av img { width: 26px; }
.phone-top small { display: block; opacity: .75; font-size: .72rem; }
.phone-body { padding: 14px 12px 18px; display: flex; flex-direction: column; gap: 8px; min-height: 170px; }
.phone-day { align-self: center; background: #fff; color: #54656F; font-size: .7rem; padding: 3px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.phone .bub { align-self: flex-end; background: var(--wa-bubble); color: #111B21; font-size: .86rem; padding: 7px 10px 5px; border-radius: 10px 10px 2px 10px; max-width: 88%; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.phone .bub small { display: block; text-align: right; color: #667781; font-size: .68rem; }
.phone .tick { color: #8696A0; letter-spacing: -3px; }
.phone-silence { align-self: center; margin-top: auto; font-size: .76rem; color: #8A5560; background: #FDECEE; border-radius: 8px; padding: 5px 10px; font-weight: 500; }
.intro-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; width: 100%; max-width: 860px; margin: 6px 0 10px; }
.istat { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 16px; text-align: left; }
.istat b { display: block; color: #fff; font-size: 1.7rem; line-height: 1.1; }
.istat span { font-size: .84rem; color: #9AA2AE; }
.istat small { display: block; margin-top: 6px; font-size: .7rem; color: #6C7480; }

/* ================= Barra superior ================= */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(10, 20, 64, .94); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand img { height: 34px; width: auto; }
.brand-sub { font-size: .7rem; font-weight: 600; letter-spacing: .12em; color: #9AA2AE; border-left: 1px solid rgba(255,255,255,.18); padding-left: 10px; }
.tabs { display: flex; gap: 4px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; color: #AEB5C0; padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: .88rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; transition: background .2s, color .2s; }
.tabs button i { font-style: normal; font-size: .7rem; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); }
.tabs button:hover { color: #fff; }
.tabs button[aria-selected="true"] { background: rgba(255,255,255,.1); color: #fff; }
.tabs button[aria-selected="true"] i { background: var(--brand); color: #fff; }
.badge { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .7rem; line-height: 19px; text-align: center; font-weight: 600; }
.badge.warn { background: var(--amber); }
.badge.zero { background: var(--green); }
.demo-badge { flex: none; font-size: .66rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #fff; background: rgba(255,255,255,.12); padding: 5px 10px; border-radius: 999px; }

main { max-width: 1320px; margin: 0 auto; padding: 20px var(--gutter) 150px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.view-head h2 { font-size: 1.45rem; }
.view-head p { max-width: 640px; font-size: .9rem; margin-top: 2px; }
.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi { background: var(--card); border-radius: 14px; padding: 9px 14px; box-shadow: var(--shadow-1); min-width: 112px; }
.kpi b { display: block; color: var(--ink); font-size: 1.25rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .72rem; color: var(--muted); }
.kpi.good b { color: var(--green); }
.kpi.bad b { color: var(--brand); }

/* ================= Bandeja ================= */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 14px; height: calc(100dvh - 220px); min-height: 560px; }
.inbox-list, .chat, .leadcard { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.filters { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.filters button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: .76rem; white-space: nowrap; color: var(--slate); }
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
#convList { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; transition: background .15s; animation: slideIn .45s cubic-bezier(.2,.9,.3,1.2) both; }
.conv:hover { background: #F9FAFB; }
.conv[aria-current="true"] { background: var(--brand-soft); }
.conv[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--brand); }
.conv-av { position: relative; flex: none; }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; font-size: .9rem; }
.chan { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; }
.chan svg { width: 10px; height: 10px; fill: #fff; }
.chan.wa { background: var(--wa); } .chan.ig, .chan.igc { background: var(--ig); } .chan.fb { background: var(--fb); }
.conv-main { min-width: 0; flex: 1; }
.conv-top { display: flex; justify-content: space-between; gap: 6px; }
.conv-top b { color: var(--ink); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-top time { font-size: .7rem; color: var(--muted); flex: none; }
.conv-prev { font-size: .8rem; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.tag { font-size: .66rem; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: #F1F2F4; color: var(--slate); white-space: nowrap; }
.tag.new { background: var(--brand); color: #fff; }
.tag.done { background: var(--green-soft); color: #15803D; }
.tag.feria { background: #E6F0FF; color: #1D4ED8; }
.tag.chan-tag { background: #F4F0FA; color: #6B21A8; }
.unread { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); position: absolute; right: 12px; top: 34px; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
.chat-head b { color: var(--ink); display: block; line-height: 1.2; }
.chat-head small { color: var(--muted); font-size: .76rem; }
.chat-head .spacer { flex: 1; }
.resp-time { font-size: .74rem; font-weight: 600; color: #15803D; background: var(--green-soft); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.coach { margin: 10px 12px 0; padding: 10px 14px; border-radius: 14px; background: var(--night); color: #D5DAE1; font-size: .82rem; display: grid; gap: 4px; animation: pop .35s cubic-bezier(.2,.9,.3,1.3) both; flex: none; }
.coach b { color: #fff; }
.coach .c-hace b { color: #FFB089; }
.coach .c-res b { color: #6EE7A0; }
.coach.static { margin: 0 0 14px; font-size: .86rem; padding: 12px 16px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--wa-bg); background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 18px 18px; }
.chat-body.ig { background: #fff; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 320px; font-size: .9rem; }
.empty b { color: var(--ink); display: block; font-size: 1rem; margin-bottom: 4px; }
.msg { max-width: 76%; padding: 7px 11px 5px; border-radius: 12px; font-size: .88rem; line-height: 1.42; color: #111B21; box-shadow: 0 1px 1px rgba(0,0,0,.07); animation: msgIn .3s cubic-bezier(.2,.9,.3,1.2) both; white-space: pre-line; }
.msg small { display: block; text-align: right; font-size: .66rem; color: #667781; margin-top: 1px; }
.msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.msg.out { align-self: flex-end; background: var(--wa-bubble); border-top-right-radius: 3px; }
.msg .who { display: block; font-size: .68rem; font-weight: 600; color: var(--brand-ink); margin-bottom: 2px; }
.msg.out.human .who { color: #1D4ED8; }
.chat-body.ig .msg.in { background: #EFEFEF; box-shadow: none; border-radius: 18px; }
.chat-body.ig .msg.out { background: linear-gradient(135deg, #7B3FE4, #DD2A7B); color: #fff; box-shadow: none; border-radius: 18px; }
.chat-body.ig .msg.out small, .chat-body.ig .msg.out .who { color: rgba(255,255,255,.8); }
.msg.sys { align-self: center; background: rgba(255,255,255,.92); color: #54656F; font-size: .74rem; border-radius: 8px; padding: 4px 10px; max-width: 90%; text-align: center; }
.msg.sys.ok { background: var(--green-soft); color: #166534; font-weight: 500; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.post { align-self: stretch; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; gap: 10px; padding: 8px; align-items: center; animation: msgIn .3s both; }
.post img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.post small { color: var(--muted); font-size: .72rem; display: block; }
.post b { font-size: .82rem; color: var(--ink); }
.comment { align-self: flex-start; display: flex; gap: 8px; max-width: 92%; animation: msgIn .3s both; font-size: .86rem; }
.comment .cav { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-size: .72rem; font-weight: 600; }
.comment p b { color: var(--ink); margin-right: 6px; }
.comment small { display: block; color: var(--muted); font-size: .7rem; }
.comment.reply { margin-left: 34px; }
.fichamsg { align-self: flex-end; width: 270px; background: var(--wa-bubble); border-radius: 12px; border-top-right-radius: 3px; padding: 4px; box-shadow: 0 1px 1px rgba(0,0,0,.07); animation: msgIn .3s both; cursor: pointer; }
.chat-body.ig .fichamsg { background: linear-gradient(135deg, #7B3FE4, #DD2A7B); }
.fichamsg .thumb { background: #fff; border-radius: 9px; height: 128px; display: grid; place-items: center; overflow: hidden; }
.fichamsg .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.fichamsg .doc { display: flex; align-items: center; gap: 8px; padding: 8px 6px 4px; font-size: .8rem; color: #111B21; }
.chat-body.ig .fichamsg .doc { color: #fff; }
.fichamsg .doc i { font-style: normal; background: #E5484D; color: #fff; font-size: .62rem; font-weight: 600; padding: 3px 5px; border-radius: 4px; }
.fichamsg .doc span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.fichamsg small { display: block; text-align: right; font-size: .66rem; color: #667781; padding: 0 6px 2px; }
.typing { align-self: flex-start; background: #fff; border-radius: 12px; padding: 10px 14px; display: flex; gap: 4px; box-shadow: 0 1px 1px rgba(0,0,0,.07); }
.typing.out { align-self: flex-end; background: var(--wa-bubble); }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #9AA4AE; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.chat-foot { flex: none; border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-foot .hint { font-size: .8rem; color: var(--muted); flex: 1; min-width: 160px; }
.speed { display: inline-flex; gap: 2px; background: rgba(17,24,39,.06); border-radius: 999px; padding: 2px; }
.speed button { border: 0; background: none; border-radius: 999px; padding: 4px 9px; font-size: .74rem; color: var(--slate); }
.speed button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); font-weight: 600; }

/* Ficha del lead (CRM) */
.lc-head { padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none; }
.lc-head h3 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.lc-head p { font-size: .76rem; color: var(--muted); }
.lc-stage { margin-top: 10px; display: flex; gap: 3px; }
.lc-stage span { flex: 1; height: 5px; border-radius: 3px; background: #E5E7EB; transition: background .4s; }
.lc-stage span.on { background: var(--brand); }
.lc-stage-label { font-size: .74rem; margin-top: 5px; color: var(--ink); font-weight: 600; }
.lc-fields { position: relative; overflow-y: auto; padding: 6px 16px 16px; flex: 1; }
.lc-group { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 12px 0 4px; }
.field { display: grid; grid-template-columns: 112px 1fr; gap: 8px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; font-size: .8rem; align-items: start; transition: background .6s; }
.field dt { color: var(--muted); }
.field dd { margin: 0; color: var(--ink); font-weight: 500; min-height: 1.2em; word-break: break-word; }
.field dd:empty::after { content: "—"; color: #C7CCD3; font-weight: 400; }
.field.flash { background: #FFF6D6; animation: flash 1.8s ease both; }
.field .ai { display: inline-block; font-size: .6rem; font-weight: 600; color: #7C3AED; background: #F3EEFE; border-radius: 999px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }
@keyframes flash { 0% { background: #FFE58A; } 100% { background: #FFF9E8; } }
.lc-note { margin: 12px 0 0; font-size: .74rem; color: var(--muted); background: #F9FAFB; border-radius: 10px; padding: 8px 10px; }

/* ================= Pipeline ================= */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(172px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #E9EBEF; border-radius: var(--radius); padding: 10px; min-height: 380px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; }
.col-head b { color: var(--ink); font-size: .84rem; }
.col-head span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.col-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, #9CA3AF); margin-right: 6px; flex: none; }
.col-head { justify-content: flex-start; } .col-head span { margin-left: auto; }
.kcard { background: #fff; border-radius: 12px; padding: 10px; box-shadow: var(--shadow-1); margin-bottom: 8px; font-size: .78rem; cursor: pointer; animation: msgIn .35s both; }
.kcard b { color: var(--ink); font-size: .84rem; display: flex; align-items: center; gap: 6px; }
.kcard .veh { color: var(--slate); margin: 2px 0 6px; }
.kcard .row { display: flex; gap: 4px; flex-wrap: wrap; }
.kcard .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.kcard.moved { box-shadow: 0 0 0 2px var(--brand), var(--shadow-2); }
.minichan { width: 14px; height: 14px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; }
.minichan svg { width: 8px; height: 8px; fill: #fff; }

/* ================= Seguimiento ================= */
.seg { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 14px; }
.seg-list { display: flex; flex-direction: column; gap: 8px; }
.sitem { background: #fff; border-radius: 14px; padding: 12px; box-shadow: var(--shadow-1); display: flex; gap: 10px; cursor: pointer; border: 2px solid transparent; transition: border-color .2s, opacity .3s; }
.sitem[aria-current="true"] { border-color: var(--brand); }
.sitem.sent { opacity: .62; }
.sitem .s-main { flex: 1; min-width: 0; }
.sitem b { color: var(--ink); font-size: .88rem; }
.sitem p { font-size: .78rem; }
.sitem .s-why { margin-top: 5px; display: flex; gap: 4px; flex-wrap: wrap; }
.cold { font-size: .66rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--amber-soft); color: #B45309; }
.cold.hot { background: var(--green-soft); color: #15803D; }
.seg-detail { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.sd-left h3 { font-size: 1.1rem; }
.sd-left .sub { font-size: .82rem; color: var(--muted); }
.sd-why { margin: 14px 0; background: #F9FAFB; border-radius: 12px; padding: 12px 14px; font-size: .84rem; }
.sd-why b { color: var(--ink); }
.sd-why ul { margin-top: 6px; display: grid; gap: 3px; }
.sd-why li::before { content: "• "; color: var(--brand); }
.tpl-label { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.tpl { background: var(--wa-bubble); border-radius: 12px; padding: 12px 14px; color: #111B21; font-size: .9rem; white-space: pre-line; position: relative; }
.tpl mark { background: rgba(37, 211, 102, .25); border-radius: 4px; padding: 0 2px; color: inherit; }
.tpl-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.sd-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mini.phone { min-width: 0; background: var(--wa-bg); border-radius: 18px; border: 5px solid #1B2230; overflow: hidden; display: flex; flex-direction: column; height: 460px; }
.mini-phone .phone-top { flex: none; }
.mini-phone .chat-body { padding: 12px; }
.mini-phone .msg { max-width: 88%; font-size: .82rem; }

/* ================= Fichas ================= */
.fichas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.fcard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; cursor: pointer; transition: transform .2s, box-shadow .2s; border: 0; text-align: left; padding: 0; display: flex; flex-direction: column; }
.fcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.fcard .fimg { aspect-ratio: 4 / 3; background: #F6F7F9; display: grid; place-items: center; overflow: hidden; }
.fcard .fimg img { width: 100%; height: 100%; object-fit: cover; }
.fcard .fbody { padding: 12px 14px 14px; }
.fcard small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.fcard b { display: block; color: var(--ink); font-size: .98rem; }
.fcard .price { color: var(--brand-ink); font-weight: 600; font-size: .9rem; margin-top: 2px; }
.fcard .pdfbadge { display: inline-flex; gap: 6px; align-items: center; font-size: .72rem; color: var(--slate); margin-top: 8px; }
.fcard .pdfbadge i { font-style: normal; background: #E5484D; color: #fff; font-size: .6rem; font-weight: 600; padding: 2px 5px; border-radius: 4px; }

/* ================= Recorrido guiado ================= */
.tour { position: relative; z-index: 20; max-width: 1320px; margin: 14px auto 0; width: calc(100% - 2 * var(--gutter)); background: var(--night); color: #D5DAE1; border-radius: 18px; padding: 12px 16px; box-shadow: var(--shadow-2); display: grid; grid-template-columns: auto 1fr auto; gap: 6px 14px; align-items: center; animation: pop .35s both; }
.tour-step { width: 46px; height: 46px; border-radius: 14px; background: var(--brand); color: #fff; font-weight: 600; display: grid; place-items: center; font-size: .82rem; text-align: center; line-height: 1.05; }
.tour-body { display: grid; gap: 4px; font-size: .88rem; }
.tour-body p { display: grid; grid-template-columns: 84px 1fr; gap: 8px; }
.tour-hace b { color: #FFB089; } .tour-resuelve b { color: #6EE7A0; }
.tour-nav { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding-right: 22px; }
.tour-sound { background: rgba(255,255,255,.1); border: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 1rem; }
.tour-sound[aria-pressed="true"] { opacity: .55; }
.tour-nav .btn-ghost { background: rgba(255,255,255,.1); color: #fff; }
.tour-close { position: absolute; top: 6px; right: 10px; background: none; border: 0; color: #8C94A1; font-size: 1.3rem; }

.pdf { position: fixed; inset: 0; z-index: 80; background: rgba(10,20,64,.7); display: flex; flex-direction: column; padding: 24px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pdf-bar { display: flex; align-items: center; gap: 12px; color: #fff; max-width: 900px; width: 100%; margin: 0 auto 10px; }
.pdf-bar b { flex: 1; }
.pdf-bar a { color: #fff; font-size: .85rem; }
.pdf-bar button { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%; font-size: 1.2rem; }
.pdf-scroll { flex: 1; overflow-y: auto; width: 100%; max-width: 760px; margin: 0 auto; border-radius: 12px; }
.pdf-scroll img { width: 100%; height: auto; border-radius: 12px; background: #fff; }
.pdf-bar a { background: #0071E3; padding: 7px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; }

.toasts { position: fixed; bottom: 16px; right: max(16px, calc((100vw - 1320px) / 2 + 16px)); width: 300px; z-index: 70; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--night); color: #fff; padding: 9px 12px; border-radius: 12px; font-size: .8rem; box-shadow: var(--shadow-2); display: flex; gap: 8px; align-items: center; animation: toastIn .4s cubic-bezier(.2,.9,.3,1.2) both; max-width: 340px; }
.toast.out { animation: toastOut .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

.foot { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter) 30px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }

/* ================= Responsive ================= */
@media (max-width: 1180px) {
  .inbox { grid-template-columns: 260px minmax(0, 1fr); height: auto; }
  .inbox-list, .chat { height: 640px; }
  .leadcard { grid-column: 1 / -1; }
  .seg-detail { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { height: 280px; }
  .chat { height: 600px; }
  .seg { grid-template-columns: 1fr; }
  .brand-sub, .demo-badge { display: none; }
  .tabs button { padding: 7px 10px; font-size: .8rem; }
  .tabs button i { display: none; }
  .tour { grid-template-columns: 1fr; }
  .tour-step { display: none; }
  .tour-body p { grid-template-columns: 1fr; gap: 0; }
  .msg { max-width: 88%; }
  .toasts { display: none; } /* en celular la lista ya muestra cada lead entrando; los avisos taparían el chat */
  .toast { font-size: .76rem; padding: 8px 12px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Notas educativas dentro del chat: aparecen después del mensaje, nunca lo tapan */
.note { align-self: center; max-width: 92%; margin: 6px 0; padding: 9px 12px; border-radius: 12px; background: rgba(10, 20, 64, .92); color: #D5DAE1; font-size: .78rem; line-height: 1.45; display: grid; gap: 3px; animation: msgIn .45s cubic-bezier(.2,.9,.3,1.2) both; box-shadow: 0 4px 14px rgba(10,20,64,.18); }
.note b { color: #fff; }
.note .n-hace b { color: #FFB089; }
.note .n-res b { color: #6EE7A0; }
.chat-body.ig .note { background: rgba(10, 20, 64, .92); }
#coach { display: none !important; }
/* Recorrido: barra dentro de la página (nunca flota sobre el chat); se encoge mientras corre la conversación */
.tour-mini { display: none; }
.tour.mini { grid-template-columns: 1fr auto; padding: 8px 14px; }
.tour.mini .tour-step, .tour.mini .tour-body, .tour.mini #tourPrev, .tour.mini .tour-close { display: none; }
.tour.mini .tour-mini { display: block; font-size: .82rem; color: #C9CED6; margin: 0; }
.tour.mini .tour-mini b { color: #fff; }
.tour.mini .btn { padding: 7px 14px; font-size: .82rem; }
.tour.mini .tour-sound { width: 32px; height: 32px; font-size: .85rem; }
body.tour-on main { padding-top: 14px; }
body.tour-on .view-head p { display: none; }
@media (min-width: 1181px) { body.tour-on .inbox { height: calc(100dvh - 330px); min-height: 460px; } }
@media (max-width: 820px) {
  .tour { grid-template-columns: 1fr; }
  .tour.mini { grid-template-columns: 1fr auto; }
  .tour-nav { padding-right: 0; }
}

/* Subtítulos de la voz: arriba a la derecha, sobre la columna del CRM (nunca sobre el chat) */
.caption { position: fixed; z-index: 65; top: 76px; right: max(16px, calc((100vw - 1320px) / 2 + 16px)); width: 300px; background: rgba(10, 20, 64, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: #8D96AE; border-radius: 16px; padding: 10px 14px 12px; box-shadow: 0 18px 40px rgba(10, 20, 64, .3); animation: pop .3s both; pointer-events: none; }
.cap-head { display: flex; align-items: center; gap: 3px; font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: #6EA8FF; font-weight: 600; margin-bottom: 4px; }
.cap-head i { width: 3px; height: 10px; border-radius: 2px; background: #6EA8FF; animation: eq .9s ease-in-out infinite; }
.cap-head i:nth-child(2) { animation-delay: .15s; } .cap-head i:nth-child(3) { animation-delay: .3s; margin-right: 5px; }
@keyframes eq { 0%, 100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }
#capText { font-size: .92rem; line-height: 1.5; margin: 0; }
#capText span { transition: color .15s; }
#capText .said { color: #E6E9F0; }
#capText .now { color: #fff; text-decoration: underline; text-decoration-color: #FF6B35; text-decoration-thickness: 2px; text-underline-offset: 4px; background: rgba(255, 107, 53, .18); border-radius: 4px; }
.caption.inline { position: static; grid-column: 1 / -1; width: auto; margin-top: 4px; padding: 8px 12px; background: rgba(255, 255, 255, .07); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.caption.inline #capText { font-size: .86rem; }

/* Tablet/celular: la barra del recorrido se queda pegada bajo el menú y se compacta al pegarse */
@media (max-width: 1180px) {
  .tour { position: sticky; top: var(--topbar-h, 56px); z-index: 25; }
  .tour.stuck { border-radius: 0 0 16px 16px; padding: 8px 12px; gap: 6px 10px; grid-template-columns: 1fr auto; box-shadow: 0 10px 24px rgba(10, 20, 64, .28); }
  .tour.stuck .tour-body, .tour.stuck .tour-step, .tour.stuck .tour-close, .tour.stuck #tourPrev { display: none; }
  .tour.stuck .tour-mini { display: block; font-size: .78rem; color: #C9CED6; margin: 0; }
  .tour.stuck .tour-mini b { color: #fff; }
  .tour.stuck:not(.mini) .mini-msg, .tour.stuck .mini-long { display: none; }
  .tour.stuck .tour-nav { grid-column: 2; grid-row: 1; }
  .tour.stuck .btn { padding: 7px 14px; font-size: .82rem; }
  .tour.stuck .tour-sound { width: 32px; height: 32px; font-size: .85rem; }
  .tour.stuck .caption.inline { margin-top: 0; padding: 6px 10px; }
  .tour.stuck #capText { font-size: .8rem; line-height: 1.4; }
}

/* Celular/tablet: la ficha del lead queda debajo del chat → cada dato guardado se ve dentro del chat */
.crmchip, .to-lead { display: none; }
@media (max-width: 1180px) {
  .crmchip { display: grid; gap: 1px; align-self: center; max-width: 92%; margin: 2px 0; padding: 6px 10px; border-radius: 10px; background: #F3EEFE; border: 1px solid #DDD0FB; color: #4C1D95; font-size: .74rem; line-height: 1.4; animation: msgIn .35s both; }
  .crmchip .cc-head { font-size: .64rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #7C3AED; }
  .crmchip b { font-weight: 600; }
  .to-lead { display: inline-flex; border: 1px solid #DDD0FB; background: #F3EEFE; color: #6D28D9; font-size: .72rem; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
  .chat-head { flex-wrap: wrap; row-gap: 6px; }
  body.tour-on .leadcard { scroll-margin-top: 130px; }
}

/* Celular: sin subtítulos de la narración (solo voz); en tablet y computadora sí se muestran */
@media (max-width: 820px) { .caption { display: none !important; } }

/* ===== Celular: la conversación es lo principal ===== */
.m-back, .lc-close { display: none; }
@media (max-width: 820px) {
  .m-back { display: grid; place-items: center; width: 32px; height: 32px; margin-left: -6px; border: 0; background: none; font-size: 1.9rem; line-height: 1; color: var(--ink); }
  .leadcard { display: none; }
  .resp-time { display: none; }
  .chat-head { flex-wrap: nowrap; padding: 8px 10px; gap: 8px; }
  .chat-head b { font-size: .92rem; }
  .chat-head small { font-size: .7rem; }
  /* modo conversación: sin lista ni encabezado; el chat llena la pantalla */
  body.m-chat #view-bandeja .view-head, body.m-chat #view-bandeja .inbox-list, body.m-chat .foot { display: none; }
  body.m-chat main { padding: 8px 8px 0; }
  body.m-chat .inbox { display: block; height: auto; min-height: 0; }
  body.m-chat .chat { height: calc(100dvh - var(--topbar-h, 56px) - var(--tour-h, 0px) - 16px); min-height: 360px; border-radius: 14px; }
  body.m-chat .tour { margin-top: 8px; }
  .chat-body { padding: 12px 10px; }
  .chat-foot { padding: 8px 10px; gap: 6px; flex-wrap: nowrap; }
  .chat-foot .hint { display: none; }
  .chat-foot .btn { padding: 8px 12px; font-size: .8rem; }
  .chat-foot .speed { margin-right: auto; }
  .chat-foot #replayConv { margin-right: auto; }
  /* datos del lead: hoja que sube desde abajo, solo al pedirla */
  body.m-lead .leadcard { display: flex; position: fixed; left: 0; right: 0; bottom: 0; max-height: 78dvh; z-index: 90; border-radius: 20px 20px 0 0; box-shadow: 0 -20px 60px rgba(10, 20, 64, .35); animation: sheetUp .3s cubic-bezier(.2,.9,.3,1) both; }
  body.m-lead::after { content: ""; position: fixed; inset: 0; background: rgba(10, 20, 64, .45); z-index: 89; }
  .lc-close { display: inline-flex; float: right; border: 0; background: rgba(17,24,39,.07); border-radius: 999px; padding: 6px 12px; font-size: .78rem; font-weight: 600; color: var(--ink); }
  body:not(.m-chat) .chat { display: none; }
  .inbox-list { height: auto; max-height: none; }
  #convList { overflow: visible; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

/* Celular: el chat queda limpio; la explicación la da la voz del recorrido */
@media (max-width: 820px) { .chat-body .note { display: none; } }

/* Resaltado de la parte que la voz está explicando */
.focus-ring { animation: focusRing 2.6s ease both; border-radius: 14px; }
@keyframes focusRing {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
  15% { box-shadow: 0 0 0 4px rgba(255, 107, 53, .75); }
  75% { box-shadow: 0 0 0 4px rgba(255, 107, 53, .55); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
}
