/* =========================================================
   Partes interactivas: demo del CRM, taller de Claude Code
   y asistente flotante.
   ========================================================= */
.btn-sm { padding: .6rem 1.1rem; min-height: 2.5rem; font-size: .9rem; }
.fx .fxr { opacity: 0; transform: translateY(30px); }
.fxr { transition: opacity .9s var(--ease), transform 1.1s var(--ease); }
.fxr.in { opacity: 1; transform: none; }

/* ---------- Demo del CRM ---------- */
.demo-grid { display: grid; grid-template-columns: minmax(0, .5fr) minmax(0, 1.5fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.demo-controls fieldset { border: 0; padding: 0; margin: 0 0 1.8rem; min-width: 0; }
.demo-controls legend { padding: 0; margin-bottom: .8rem; font: 500 .78rem var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--mute); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { font: 600 .95rem var(--font-body); padding: .55rem 1rem; min-height: 2.6rem; border: 1px solid var(--line-strong); border-radius: 999px; background: none; color: var(--ink); cursor: pointer; transition: background .25s, color .25s, border-color .25s, transform .3s var(--ease); }
.chip:hover { border-color: var(--accent); transform: translateY(-2px); }
.chip[aria-checked="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.mods { border-top: 1px solid var(--line-strong); }
.tog { position: relative; display: flex; align-items: center; gap: .85rem; padding: .7rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.tog input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tog-track { position: relative; flex: none; width: 2.7rem; height: 1.55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong); transition: background .3s, border-color .3s; }
.tog-track i { position: absolute; top: 2px; left: 2px; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--mute); transition: transform .4s var(--ease), background .3s; }
.tog input:checked + .tog-track { background: var(--accent); border-color: var(--accent); }
.tog input:checked + .tog-track i { transform: translateX(1.15rem); background: var(--on-accent); }
.tog input:focus-visible + .tog-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.tog-label { font-weight: 500; }
.demo-hint { color: var(--mute); font-size: .95rem; margin: 0 0 1.1rem; }

.app { position: relative; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); min-height: 31rem; }
.app-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.app-top b { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; }
.badge { font: 500 .7rem var(--font-mono); padding: .22rem .65rem; border: 1px dashed var(--line-strong); border-radius: 999px; color: var(--mute); white-space: nowrap; }
.app-grid { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); }
.app-grid.has-side { grid-template-columns: 9.5rem minmax(0, 1fr) 15.5rem; }
.side { padding: 1rem .8rem; border-right: 1px solid var(--line); display: grid; gap: .2rem; align-content: start; }
.side li { padding: .5rem .7rem; border-radius: 8px; font-size: .9rem; color: var(--mute); }
.side li.on { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.main { padding: 1.1rem; display: grid; gap: 1rem; align-content: start; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; display: grid; gap: .1rem; }
.kpi span { font-size: .8rem; color: var(--mute); }
.kpi b { font: 700 1.9rem/1.1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.rows { display: grid; gap: .55rem; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .8rem; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; cursor: pointer; transition: border-color .25s, background .25s; }
.row:hover { border-color: var(--line-strong); }
.row.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.row.flash { animation: flash 1.1s var(--ease); }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 30%, transparent); } }
.row-main b { display: block; font-size: .95rem; }
.row-main span { font-size: .82rem; color: var(--mute); }
.row-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.tag { font: 500 .7rem var(--font-mono); padding: .2rem .55rem; border: 1px solid var(--line-strong); border-radius: 999px; white-space: nowrap; animation: pop .5s var(--ease); }
.tag.st1 { color: var(--accent); border-color: var(--accent); }
.tag.st2 { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tag.st3 { border-color: #4fb36f; background: color-mix(in srgb, #4fb36f 20%, transparent); }
.tag.inv { border-style: dashed; }
.tag.portal { color: var(--mute); }
.adv { font: 600 .8rem var(--font-body); border: 1px solid var(--line-strong); background: none; color: var(--ink); padding: .5rem .85rem; min-height: 2.4rem; border-radius: 8px; cursor: pointer; transition: background .25s, color .25s, border-color .25s, transform .25s var(--ease); white-space: nowrap; }
.adv:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); border-color: var(--accent); transform: translateY(-1px); }
.adv:disabled { opacity: .5; cursor: default; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }

.aside { padding: 1rem; border-left: 1px solid var(--line); display: grid; gap: 1rem; align-content: start; min-width: 0; }
.phone { border: 1.5px solid var(--line-strong); border-radius: 22px; padding: .6rem; background: var(--bg); }
.phone-cap, .feed-cap, .ai-cap { font: 500 .68rem var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--mute); margin: 0; }
.phone-cap { text-align: center; margin: .3rem 0 .6rem; }
.phone-body { background: var(--surface); border-radius: 14px; padding: .9rem; display: grid; gap: .15rem; }
.phone-biz { font-size: .75rem; color: var(--mute); margin: 0; }
.phone-body b { font-family: var(--font-display); }
.phone-body > span { font-size: .85rem; color: var(--mute); }
.tl2 { margin-top: .6rem; display: grid; gap: .45rem; }
.tl2 li { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--mute); }
.tl2 i { width: .7rem; height: .7rem; border-radius: 50%; border: 1.5px solid var(--line-strong); transition: background .4s, box-shadow .4s; }
.tl2 .ok, .tl2 .cur { color: var(--ink); }
.tl2 .cur { font-weight: 600; }
.tl2 .ok i, .tl2 .cur i { background: var(--accent); border-color: var(--accent); }
.tl2 .cur i { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); }
.feed { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; }
.feed ul { display: grid; gap: .4rem; margin-top: .55rem; }
.bub { background: var(--surface-2); border-radius: 10px; padding: .5rem .7rem; font-size: .82rem; animation: pop .5s var(--ease); }
.empty { font-size: .82rem; color: var(--mute); }
.ai { border-top: 1px dashed var(--line-strong); padding-top: .9rem; display: grid; gap: .6rem; }
.ai-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.ai-chips button { font: 500 .8rem var(--font-body); border: 1px solid var(--line-strong); background: none; color: var(--ink); padding: .4rem .75rem; min-height: 2.2rem; border-radius: 999px; cursor: pointer; transition: border-color .2s, color .2s; }
.ai-chips button:hover { border-color: var(--accent); color: var(--accent); }
.ai-ans { background: var(--surface-2); border-radius: 10px; padding: .7rem .9rem; font-size: .9rem; animation: pop .5s var(--ease); }
.toasts { position: absolute; right: 1rem; top: 3.7rem; display: grid; gap: .5rem; z-index: 3; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: .6rem .9rem; border-radius: 12px; font-size: .82rem; display: grid; gap: .1rem; max-width: 17rem; animation: toastIn .55s var(--ease); box-shadow: 0 12px 20px -12px rgba(0, 0, 0, .6); transition: opacity .4s, transform .4s; }
.toast b { font: 600 .68rem var(--font-mono); letter-spacing: .05em; text-transform: uppercase; opacity: .7; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } }

/* ---------- Taller de Claude Code ---------- */
.claude-grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr); }
.ws { border: 1px solid #2c3543; border-radius: 14px; overflow: hidden; background: #0a0d12; color: #d8d6cf; box-shadow: var(--shadow); min-width: 0; }
.ws-bar { display: flex; align-items: center; gap: .45rem; padding: .7rem 1rem; background: #1a2029; border-bottom: 1px solid #2c3543; }
.ws-bar i { width: .65rem; height: .65rem; border-radius: 50%; background: #3a4454; }
.ws-bar span { margin-left: .6rem; font: 500 .78rem var(--font-mono); color: #8b93a1; }
.ws-bar em { margin-left: auto; font: 500 .72rem var(--font-mono); color: #8b93a1; font-style: normal; }
.ws-panes { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); min-height: 21rem; }
.ws-term { padding: 1.1rem; font: 400 .82rem/1.7 var(--font-mono); overflow: auto; max-height: 24rem; border-right: 1px solid #2c3543; }
.ws-prev { background: #e9ecf1; padding: 1.1rem; display: grid; place-items: center; overflow: hidden; }
.pv { width: 100%; max-width: 19rem; color: #11151c; display: grid; gap: .6rem; font-family: var(--font-body); }
.pv h4 { margin: 0; font: 700 1.15rem var(--font-display); letter-spacing: -.02em; }
.pv-s { opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .5s, transform .7s var(--ease); }
.pv-s.on { opacity: 1; transform: none; }
.pv-row { display: flex; justify-content: space-between; gap: .6rem; background: #fff; border: 1px solid #d3d8e0; border-radius: 10px; padding: .6rem .8rem; font-size: .82rem; }
.pv-row em { font: 600 .68rem var(--font-mono); font-style: normal; color: #1c6e3a; background: #dff2e5; padding: .15rem .55rem; border-radius: 999px; align-self: center; white-space: nowrap; }
.pv-row em.warn { color: #8a5200; background: #fcebc8; }
.pv-btn { border: 0; background: #3a3fd6; color: #fff; font: 600 .85rem var(--font-body); padding: .7rem 1rem; border-radius: 999px; pointer-events: none; }
.pv-btn.wa { background: #178a47; }
.pv-nav { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid #c8cdd7; padding-bottom: .5rem; }
.pv-nav b { margin-right: auto; font-size: .85rem; }
.pv-nav span { width: 2rem; height: .4rem; background: #c1c7d3; border-radius: 9px; }
.pv-land h4 { font: 800 1.7rem/1 var(--font-display); letter-spacing: -.03em; margin: .3rem 0 0; }
.pv-land p { margin: 0; font-size: .82rem; color: #485160; }
.pv-in { background: #fff; border: 1px solid #c1c7d3; border-radius: 8px; padding: .55rem .7rem; font-size: .8rem; color: #667080; }
.pv-phone { width: 12.5rem; margin: auto; border: 3px solid #11151c; border-radius: 28px; background: #d9deea; padding: 1rem .7rem 3.2rem; display: grid; gap: .8rem; }
.pv-time { font: 700 2.1rem var(--font-display); text-align: center; letter-spacing: -.03em; }
.pv-notif { background: #fff; border-radius: 14px; padding: .65rem .75rem; box-shadow: 0 10px 16px -12px rgba(0, 0, 0, .5); font-size: .78rem; }
.pv-notif-top { display: flex; justify-content: space-between; color: #667080; font-size: .68rem; margin-bottom: .2rem; }
.pv-notif-top i { font-style: normal; }
.pv-notif b { display: block; font-size: .85rem; }
.pv-notif p { margin: .15rem 0 0; color: #485160; }
.pv-card { background: #fff; border: 1px solid #d3d8e0; border-radius: 10px; padding: .8rem; display: grid; gap: .4rem; }
.pv-card i { height: .5rem; border-radius: 9px; background: #d3d8e0; }
.pv-card i:first-child { width: 60%; }
.ws-form { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-top: 1px solid #2c3543; }
.ws-form:focus-within { box-shadow: inset 0 0 0 1.5px #e8d57a; }
.ws-p { color: #e8d57a; font: 500 .9rem var(--font-mono); }
.ws-form input { flex: 1; min-width: 0; background: none; border: 0; color: #f2efe6; font: 400 .88rem var(--font-mono); min-height: 2.3rem; outline: none; caret-color: #e8d57a; }
.ws-form input::placeholder { color: #6b7483; }
.ws-form button { font: 600 .78rem var(--font-body); background: #e8d57a; color: #17140a; border: 0; padding: .5rem .95rem; min-height: 2.3rem; border-radius: 999px; cursor: pointer; }
.ws-chips { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1rem 1rem; }
.ws-chips button { font: 500 .8rem var(--font-body); color: #d8d6cf; border: 1px solid #3a4454; background: none; padding: .45rem .85rem; min-height: 2.2rem; border-radius: 999px; cursor: pointer; transition: border-color .2s, color .2s; }
.ws-chips button:hover, .ws-chips button.on { border-color: #e8d57a; color: #e8d57a; }
.ws-note { margin: 0; padding: 0 1rem 1rem; font: 500 .72rem var(--font-mono); color: #8b93a1; }

/* ---------- Asistente flotante ---------- */
.assistant { position: fixed; right: clamp(1rem, 2.5vw, 1.8rem); bottom: clamp(1rem, 2.5vw, 1.8rem); z-index: 110; }
.fab { display: flex; align-items: center; gap: .6rem; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 999px; padding: .85rem 1.2rem; min-height: 3rem; font: 600 .95rem var(--font-body); cursor: pointer; box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .65); transition: transform .3s var(--ease); }
.fab:hover { transform: translateY(-3px); }
.as-panel { position: absolute; right: 0; bottom: calc(100% + .8rem); width: min(24rem, calc(100vw - 2rem)); max-height: min(34rem, 72vh); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; overflow: hidden; box-shadow: 0 28px 44px -28px rgba(0, 0, 0, .75); transform-origin: bottom right; animation: panelIn .5s var(--ease); }
.as-panel[hidden] { display: none; }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.as-panel header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.as-panel header b { display: block; font: 700 1rem var(--font-display); }
.as-panel header span { font: 500 .7rem var(--font-mono); color: var(--mute); }
.as-panel header button { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; background: none; border: 1px solid var(--line-strong); color: var(--ink); border-radius: 999px; cursor: pointer; }
.as-msgs { flex: 1; overflow: auto; padding: 1rem; display: grid; gap: .6rem; align-content: start; min-height: 11rem; }
.msg p { margin: 0; padding: .6rem .85rem; border-radius: 14px; font-size: .92rem; line-height: 1.45; max-width: 90%; }
.msg { display: grid; animation: pop .45s var(--ease); }
.msg.bot { justify-items: start; }
.msg.bot p { background: var(--surface-2); }
.msg.me { justify-items: end; }
.msg.me p { background: var(--accent); color: var(--on-accent); }
.msg.typing p { animation: pulse 1s infinite; letter-spacing: .2em; }
@keyframes pulse { 50% { opacity: .4; } }
.msg-wa { margin-top: .45rem; font-weight: 600; font-size: .85rem; color: var(--accent); text-underline-offset: .2em; }
.as-chips { display: flex; gap: .4rem; overflow-x: auto; padding: 0 1rem .8rem; scrollbar-width: none; }
.as-chips button { flex: none; font: 500 .8rem var(--font-body); border: 1px solid var(--line-strong); background: none; color: var(--ink); padding: .4rem .8rem; min-height: 2.3rem; border-radius: 999px; cursor: pointer; transition: border-color .2s, color .2s; }
.as-chips button:hover { border-color: var(--accent); color: var(--accent); }
.as-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); }
.as-form input { flex: 1; min-width: 0; font: inherit; font-size: .92rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 999px; padding: .6rem 1rem; min-height: 2.6rem; }
.as-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.as-form button { font: 600 .85rem var(--font-body); background: var(--accent); color: var(--on-accent); border: 0; padding: .55rem 1rem; border-radius: 999px; cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .demo-grid, .claude-grid { grid-template-columns: minmax(0, 1fr); }
  .demo-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; }
  .demo-hint, #demo-reset { grid-column: 1 / -1; }
  #demo-reset { justify-self: start; }
}
@media (max-width: 860px) {
  .app-grid, .app-grid.has-side { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .aside { border-left: 0; border-top: 1px solid var(--line); grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aside > :only-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .demo-controls { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .row-tags { justify-content: flex-start; }
  .adv { justify-self: start; }
  .aside { grid-template-columns: minmax(0, 1fr); }
  .ws-panes { grid-template-columns: minmax(0, 1fr); }
  .ws-term { border-right: 0; border-bottom: 1px solid #2c3543; max-height: 14rem; }
  .fab span { display: none; }
  .fab { padding: .9rem; }
  .toasts { left: 1rem; right: 1rem; }
  .toast { max-width: none; }
  .as-panel { width: calc(100vw - 2rem); }
}
@media (prefers-reduced-motion: reduce) {
  .fx .fxr { opacity: 1 !important; transform: none !important; }
  .pv-s { opacity: 1; transform: none; }
}

/* Con panel lateral, la fila usa dos renglones para respirar */
.has-side .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "m m" "t b"; align-items: center; }
.has-side .row-main { grid-area: m; }
.has-side .row-tags { grid-area: t; justify-content: flex-start; }
.has-side .adv { grid-area: b; justify-self: end; }
@media (max-width: 860px) { .has-side .row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "m" "t" "b"; } .has-side .row-tags { justify-content: flex-start; } }
@media (max-width: 860px) { .has-side .adv { justify-self: start; } }
