/*
 * ReadOS — pantalla en vivo.
 * Pensada para leer de reojo mientras se habla (pantalla dedicada, ~1512×982):
 *  - la respuesta sugerida es lo dominante (columna izquierda, tipografía grande, alto contraste);
 *  - lead, dolores, guion y transcripción van a la derecha, legibles pero secundarios;
 *  - todo lo que hay que leer en la llamada va a 15 px o más;
 *  - las cajas tienen alto fijo: cuando llega o se actualiza una respuesta no se mueve nada.
 */
:root {
  --bg: #0d0f13;
  --panel: #151820;
  --panel-2: #1c2029;
  --border: #2a303c;
  --text: #eef1f6;
  --text-2: #c9cfd9;
  --muted: #9aa3b2;
  --seller: #6cb6ff;
  --prospect: #ffd166;
  --accent: #3ddc97;
  --danger: #ff6b6b;
  --warn: #ffb454;
  --buying: #a78bfa;
  --radius: 10px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

[hidden] {
  display: none !important;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  border-color: #3b4352;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06140e;
}
.btn.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn.ghost {
  background: transparent;
  color: var(--text-2);
}
.btn.small {
  padding: 3px 8px;
  font-size: 13px;
}

input[type='text'],
input[type='url'],
input[type='password'],
select,
textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
}
input:focus,
select:focus,
textarea:focus,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  text-align: center;
  font: 700 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 6px;
  opacity: 0.8;
}
.btn.pressed {
  transform: scale(0.97);
}

/* ---------- layout ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  /* Alto real de la ventana (app instalada, pantalla completa): sin barras de scroll de la página. */
  height: 100dvh;
  overflow: hidden;
}
html:has(> body.app) {
  overflow: hidden;
}
/* Pantalla completa (Fullscreen API sobre toda la página): mismo fondo, sin bordes ni saltos. */
html:fullscreen {
  width: 100%;
  height: 100%;
  background: var(--bg);
}
html:fullscreen::backdrop {
  background: var(--bg);
}
.fs-toggle {
  padding-inline: 9px;
}

.topbar {
  padding: 8px 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}
.topbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
}
.bot-form {
  display: flex;
  gap: 6px;
  flex: 0 1 460px;
  min-width: 0;
}
.bot-form:has(#meet-url[hidden]) {
  flex: none;
}
.bot-form input {
  flex: 1;
  min-width: 180px;
}
.spacer {
  flex: 1;
}

/* Línea de avisos: alto fijo, una sola fila. Aparezca o no algo, el contenido de abajo no se mueve. */
.infoline {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  font-size: 14px;
}
.infoline::-webkit-scrollbar {
  display: none;
}
.infoline > * {
  flex: none;
}

/* Chips de estado: punto de color + texto (se distinguen sin leer). */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px 2px 8px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}
.chip::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.chip[data-phase='starting'],
.chip[data-phase='waiting_admission'] {
  color: var(--warn);
  border-color: var(--warn);
}
.chip[data-phase='in_call'],
.chip[data-ok='true'] {
  color: var(--accent);
  border-color: var(--accent);
}
.chip[data-phase='error'],
.chip[data-ok='false'],
.chip[data-state='error'] {
  color: var(--danger);
  border-color: var(--danger);
}
.chip[data-phase='waiting_admission'] {
  font-weight: 700;
  animation: pulse 1.4s ease-in-out infinite;
}
.chip[data-state='ok'] {
  color: var(--accent);
  border-color: var(--accent);
}
.chip[data-state='connecting'],
.chip[data-state='reconnecting'],
.chip[data-ok='slow'] {
  color: var(--warn);
  border-color: var(--warn);
}
@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.participants {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 14px;
}
.participants .hint {
  color: var(--muted);
}
.pchip {
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  border-radius: 999px;
  padding: 1px 9px;
  border: 1px solid var(--border);
}
.pchip.seller {
  color: var(--seller);
  border-color: var(--seller);
}
.pchip.prospect {
  color: var(--prospect);
  border-color: var(--prospect);
}
.pchip.notetaker {
  color: var(--muted);
  border-style: dashed;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: min(560px, 92vw);
  background: var(--panel-2);
  border: 1px solid var(--danger);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  z-index: 10;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
.toast[data-kind='ok'] {
  border-color: var(--accent);
}
.hint {
  color: var(--muted);
  font-size: 14px;
}

/* Selectores segmentados (tipo de llamada, guion, Manual | Automático) */
.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  background: var(--panel);
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.segmented button:hover:not(.on) {
  color: var(--text);
}
.segmented button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.segmented button.on[data-mode='auto'] {
  background: var(--accent);
  color: #06140e;
}
.segmented button.on[data-mode='manual'] {
  background: var(--seller);
  color: #06101e;
}
.segmented button.on[data-call='first'] {
  background: var(--prospect);
  color: #1a1300;
}
.segmented button.on[data-call='second'] {
  background: var(--buying);
  color: #120a24;
}
.segmented button.on[data-script] {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}
#script-switch button {
  padding: 4px 10px;
}
.mode-wrap {
  display: inline-flex;
  align-items: center;
}
.key-hint {
  color: var(--muted);
}

.missing {
  font-size: 14px;
  color: var(--warn);
  background: rgba(255, 180, 84, 0.08);
  border: 1px solid rgba(255, 180, 84, 0.3);
  border-radius: 8px;
  padding: 2px 8px;
}
.missing::before {
  content: '⚠ ';
}
.missing .hint {
  color: var(--muted);
}
.bot-message {
  font-size: 14px;
  color: var(--muted);
}
/* Modo «Un micro» (llamada de WhatsApp): botón y aviso. */
.mic-toggle {
  border-radius: 999px;
}
.mic-toggle.on {
  background: #25d366;
  border-color: #25d366;
  color: #04170b;
  font-weight: 700;
}
.segmented button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.mic-hint {
  font-size: 14px;
  color: var(--warn);
}
.mic-hint .linkish {
  margin-left: 6px;
}
.bot-message[data-phase='error'] {
  color: var(--danger);
  font-weight: 600;
}
.bot-message[data-phase='error']::before {
  content: '✕ ';
}

/* Dos columnas: a la izquierda la respuesta (dominante), a la derecha el contexto. */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(380px, 1fr);
  gap: 14px;
  padding: 10px 14px 12px;
}
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.4fr) minmax(0, 1fr);
  }
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}
.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.section-head .count {
  font-weight: 400;
}
.meta {
  font-size: 14px;
  color: var(--muted);
}

/* ---------- sugerencias (columna principal) ---------- */
.assist {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.assist-head {
  flex: none;
  gap: 8px;
  margin-bottom: 10px;
}
.disc-tools {
  flex: none;
  display: flex;
  gap: 6px;
}
.disc-tools .btn {
  padding: 4px 10px;
}
/* Ancho fijo: que cambiar de «Lista» a «Generando…» no corra los botones. */
.assist-head .sugg-state {
  width: 150px;
}
.btn.ghost kbd,
.btn.demo-btn kbd {
  color: var(--muted);
}
.btn.toggle[aria-pressed='true'] {
  color: var(--prospect);
  border-color: var(--prospect);
}
.btn.toggle[aria-pressed='true'] kbd {
  color: var(--prospect);
}
/* En Manual, «Responder ahora» es la acción principal. */
#suggest-now.big {
  padding: 9px 18px;
  font-size: 17px;
}

/* Estado de la respuesta: ícono + color + texto. */
.sugg-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--muted);
  white-space: nowrap;
}
.sugg-state::before {
  display: inline-block;
  width: 1.1em;
  text-align: center;
}
.sugg-state[data-state='listening'] {
  color: var(--seller);
}
.sugg-state[data-state='listening']::before {
  content: '●';
  animation: pulse 2s ease-in-out infinite;
}
.sugg-state[data-state='streaming'] {
  color: var(--warn);
  background: rgba(255, 180, 84, 0.1);
}
.sugg-state[data-state='streaming']::before {
  content: '◌';
  animation: spin 1s linear infinite;
}
.sugg-state[data-state='done'] {
  color: var(--accent);
}
.sugg-state[data-state='done']::before {
  content: '✓';
}
.sugg-state[data-state='incomplete'],
.sugg-state[data-state='fallback'] {
  color: var(--warn);
  border-style: dashed;
}
.sugg-state[data-state='incomplete']::before,
.sugg-state[data-state='fallback']::before {
  content: '⚠';
}
.sugg-state[data-state='error'] {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
}
.sugg-state[data-state='error']::before {
  content: '✕';
}

/* La caja de la respuesta y el historial se reparten el alto en una proporción fija (2:1), así
   ninguna cambia de tamaño con el contenido (no salta nada al llegar una respuesta) y no queda un
   hueco grande bajo la sugerencia. Con el historial plegado, la respuesta se queda con todo. */
.suggestion {
  position: relative;
  flex: 66 1 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 24px 20px;
}
.suggestion.streaming {
  border-left-color: var(--warn);
}
/* Barra que corre arriba mientras se genera (se nota de reojo). */
.suggestion.streaming::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--warn), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: sweep 1.2s linear infinite;
}
@keyframes sweep {
  from {
    background-position: -40% 0;
  }
  to {
    background-position: 140% 0;
  }
}
.suggestion.error {
  border-left-color: var(--danger);
}
.suggestion.incomplete,
.suggestion.fallback {
  border-left-color: var(--warn);
  border-left-style: dashed;
}
.suggestion.empty {
  border-left-color: var(--border);
  display: flex;
  align-items: center;
}
.suggestion.empty .placeholder {
  font-size: 19px;
  line-height: 1.5;
  max-width: 46ch;
  margin: 0 auto;
  text-align: center;
}
.suggestion.buying {
  border-left-color: var(--buying);
}
.suggestion.buying .tag {
  background: var(--buying);
}
.placeholder {
  color: var(--muted);
  margin: 0;
}
.sugg-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin-bottom: 14px;
  min-width: 0;
}
.tag {
  flex: none;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #06140e;
  background: var(--prospect);
  border-radius: 5px;
  padding: 1px 8px;
}
/* La cita del prospecto va entera (hasta 2–3 renglones), sin «…» a mitad de frase: si no entra
   al lado de la etiqueta, baja a su propio renglón. app.js ya la recorta en un límite de frase. */
.quote {
  flex: 1 1 22em;
  min-width: 0;
  font-size: 16px;
  line-height: 1.4;
  color: var(--muted);
  font-style: italic;
  text-wrap: pretty;
}
.block {
  margin-top: 14px;
}
.block:first-child {
  margin-top: 0;
}
.block .k {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.block .v {
  margin: 4px 0 0;
}
/* Lo que hay que decir: lo más grande y con más contraste de la pantalla. */
.answer .v {
  font-size: 34px;
  line-height: 1.3;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.question .v {
  font-size: 25px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--seller);
  text-wrap: pretty;
}
.suggestion.long .answer .v {
  font-size: 29px;
}
.suggestion.long .question .v {
  font-size: 22px;
}
.points {
  margin-top: 18px;
}
.points ul {
  margin: 4px 0 0;
  padding-left: 20px;
}
.points li {
  margin: 3px 0;
  font-size: 18px;
  line-height: 1.4;
  color: var(--text-2);
}
.sugg-head .num,
.hhead .num {
  flex: none;
  font: 700 15px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}
.fallback-note,
.incomplete-note {
  margin: 0 0 10px;
  padding: 6px 10px;
  font-size: 15px;
  color: var(--warn);
  background: rgba(255, 180, 84, 0.08);
  border: 1px dashed rgba(255, 180, 84, 0.5);
  border-radius: 8px;
}
.fallback-note::before,
.incomplete-note::before {
  content: '⚠ ';
}
.error {
  color: var(--danger);
}
.suggestion > .error {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
}
.suggestion > .error::before {
  content: '✕ ';
}

/* Debajo de la respuesta: tiempos (una línea fija) e historial (un tercio del alto, plegable). */
.sugg-meta {
  flex: none;
  height: 24px;
  line-height: 24px;
  margin-top: 4px;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history {
  flex: 34 1 0;
  min-height: 0;
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
}
/* Sin respuestas todavía: el lugar queda reservado (que no salte la caja de arriba al llegar la primera). */
.history[hidden] {
  display: flex !important;
  visibility: hidden;
}
/* Plegado: queda solo la línea del título y la respuesta usa ese alto. */
.history:not([open]) {
  flex: 0 0 30px;
}
.history summary {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  list-style: none;
  user-select: none;
}
.history summary::-webkit-details-marker {
  display: none;
}
/* Flecha propia (▾ abierto / ▸ plegado) y una pista a la derecha: que se vea que se pliega. */
.history summary::before {
  content: '▾';
  display: inline-block;
  width: 1em;
  text-align: center;
}
.history:not([open]) summary::before {
  content: '▸';
}
.history summary .fold-hint {
  margin-left: auto;
  font-weight: 400;
  font-size: 13px;
}
.history summary:hover {
  color: var(--text);
}
.history summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 4px;
}
.history ol {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hitem {
  cursor: pointer;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
}
.hitem:hover,
.hitem:focus-visible {
  border-color: #3b4352;
  outline: none;
}
.hitem.current {
  border-left-color: var(--accent);
  background: var(--panel-2);
}
.hitem.buying {
  border-left-color: var(--buying);
}
.hitem.fallback,
.hitem.incomplete {
  opacity: 0.7;
  border-left-color: var(--warn);
}
.hitem.incomplete {
  border-left-style: dashed;
}
.hhead {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.htag {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--prospect);
}
.hmeta {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}
.hanswer {
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hquestion {
  color: var(--seller);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- columna de contexto ---------- */
.side {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/*
 * Condiciones comerciales: alto fijo (dos filas de campos), arriba de la columna. Plegado queda solo
 * la línea del título con el resumen de las cifras; la transcripción toma el alto liberado.
 */
.terms {
  flex: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 4px 10px 6px;
  font-size: 14px;
  color: var(--muted);
}
.terms summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  list-style: none;
  user-select: none;
  white-space: nowrap;
  min-width: 0;
}
.terms summary::-webkit-details-marker {
  display: none;
}
.terms summary::before {
  content: '▾';
  display: inline-block;
  width: 1em;
  text-align: center;
}
.terms:not([open]) summary::before {
  content: '▸';
}
.terms summary:hover {
  color: var(--text);
}
.terms summary .fold-hint {
  margin-left: auto;
  font-weight: 400;
  font-size: 13px;
}
.terms-summary {
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.terms[open] .terms-summary {
  display: none;
}
.terms-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 8px;
  margin-top: 4px;
}
.term {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.term-label {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term.edited .term-label::after {
  content: ' •';
  color: var(--warn);
}
input.term-input {
  width: 100%;
  min-width: 0;
  padding: 2px 6px;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: text;
}
.terms-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  min-height: 24px;
}
.terms-foot .meta {
  font-size: 13px;
}
.terms-foot .btn {
  margin-left: auto;
}
/* Tilde «Congelar con seña»: excepción que decide Mariano (apagada por defecto). */
.terms-deposit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  cursor: pointer;
}
.terms-deposit.on {
  color: var(--warn);
  font-weight: 600;
}
/* Precio dicho distinto del panel: aviso discreto (no es un error), una línea por precio. */
.price-notices {
  flex: none;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.price-notices[hidden] {
  display: none;
}
.price-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 13px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.price-notice-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.price-notice-close {
  padding: 0 6px;
}

/* «Qué quiere el lead»: alto fijo mientras está prendida (las viñetas nuevas no empujan nada). */
.lead-panel {
  flex: 0 0 27%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.lead-panel .section-head {
  margin-bottom: 4px;
}
.lead-panel .section-head .btn {
  margin-left: auto;
}
.lead-list {
  flex: 1;
  margin: 0;
  padding: 8px 12px 8px 30px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--prospect);
  border-radius: var(--radius);
  overflow-y: auto;
  min-height: 0;
}
.lead-item {
  font-size: 16px;
  line-height: 1.4;
  margin: 2px 0;
  border-radius: 4px;
  transition: background-color 1.2s ease;
}
.lead-item .rm {
  appearance: none;
  border: 0;
  background: none;
  padding: 0 4px;
  margin-left: 4px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  opacity: 0;
}
.lead-item:hover .rm,
.lead-item .rm:focus-visible {
  opacity: 1;
}
.lead-item .rm:hover {
  color: var(--danger);
}
.lead-item.fresh {
  background-color: rgba(255, 209, 102, 0.16);
  transition: none;
}
.lead-panel .placeholder {
  flex: 1;
  font-size: 15px;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.lead-list:empty {
  display: none;
}

/* ---------- discovery (primera llamada) ---------- */
.why {
  margin: 12px 0 0;
  font-size: 18px;
  color: var(--text-2);
}
.disc-new {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--muted);
}
.linkish {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--seller);
  text-decoration: underline;
  cursor: pointer;
}
.suggestion.discovery {
  border-left-color: var(--prospect);
}
.suggestion.discovery.streaming {
  border-left-color: var(--warn);
}
.suggestion.discovery.incomplete,
.suggestion.discovery.fallback {
  border-left-color: var(--warn);
}
.suggestion.discovery .tag {
  background: var(--prospect);
}
/* Alto fijo: dolores y guion se actualizan adentro, sin mover la transcripción. */
.discovery {
  flex: 0 0 44%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.disc-reminder {
  flex: none;
  margin: 0;
  font-size: 15px;
  color: var(--warn);
}
.disc-reminder::before {
  content: '⚠ ';
}
.touch {
  flex: 0 1 auto;
  max-height: 38%;
  overflow-y: auto;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.touch h3,
.disc-pains h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}
.touch ol {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tp {
  font-size: 16px;
  line-height: 1.4;
}
.tp-impact {
  margin-left: 8px;
  font-weight: 700;
  color: var(--warn);
  cursor: help;
}
.tp-origin {
  display: block;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
}
/* Dolores y guion apilados: los dolores usan todo el ancho de la columna (la cita entra entera,
   en varias líneas si hace falta) y el guion queda abajo como una tira compacta. */
.disc-cols {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.disc-pains {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.disc-pains ul {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pain {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 15px;
  line-height: 1.4;
}
.pain .cat {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
  color: var(--muted);
}
.pain .cat[data-cat='problema'],
.pain .cat[data-cat='impacto'] {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.5);
}
.pain .cat[data-cat='presupuesto'],
.pain .cat[data-cat='decisores'],
.pain .cat[data-cat='urgencia'],
.pain .cat[data-cat='plazos'] {
  color: var(--accent);
  border-color: rgba(61, 220, 151, 0.5);
}
.pain .body {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}
/* La frase del prospecto va completa: corta línea entre palabras, nunca con «…». */
.pain .pq {
  display: block;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  white-space: normal;
  text-wrap: pretty;
}
.pain .rm {
  margin-left: auto;
  flex: none;
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  font: inherit;
}
.pain:hover .rm,
.pain .rm:focus-visible {
  opacity: 1;
}
.disc-pains .placeholder {
  font-size: 15px;
}
/* El guion es una guía discreta, no un examen. */
.disc-guide {
  flex: none;
  min-width: 0;
  font-size: 14px;
  color: var(--muted);
}
.disc-guide summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}
.disc-guide .count {
  font-weight: 400;
}
/* Tira de preguntas que hace wrap (2–3 renglones); si el guion es largo, scrollea adentro. */
.disc-guide ol {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  max-height: 4.4em;
  overflow-y: auto;
}
.gq {
  cursor: pointer;
  padding: 1px 0;
  line-height: 1.4;
  white-space: nowrap;
}
.gq::before {
  content: '○ ';
  opacity: 0.6;
}
.gq.done {
  opacity: 0.55;
}
.gq.done::before {
  content: '✓ ';
  color: var(--accent);
  opacity: 1;
}
.gq:hover {
  color: var(--text);
}
.script-dialog {
  width: min(760px, 96vw);
  max-height: 86vh;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.script-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.script-dialog .kb-head h2 {
  margin: 0;
  font-size: 16px;
}
.script-body p {
  font-size: 21px;
  line-height: 1.5;
  margin: 10px 0;
}

/* ---------- Seteo de marco guiado (pantalla completa, para leer a distancia) ---------- */
/* Mientras se ve, el resto de la UI de la llamada no está: ni barra, ni sugerencias, ni transcripción. */
body[data-framing='on'] > .topbar,
body[data-framing='on'] > .layout {
  display: none;
}
.framing {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: 20px 40px 16px;
}
.framing-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.framing-head h1 {
  margin: 0;
  font-size: 22px;
  color: var(--text-2);
}
.framing-progress {
  font-size: 18px;
  color: var(--muted);
}
.framing-head .btn {
  font-size: 17px;
  padding: 9px 16px;
}
.framing-steps {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 18px 0 30vh;
}
.fstep {
  display: flex;
  gap: 18px;
  align-items: baseline;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
.fstep:hover {
  background: var(--panel);
}
.fmark {
  flex: none;
  min-width: 1.4em;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}
.fbody {
  min-width: 0;
}
.ftitle {
  display: block;
  font-weight: 700;
}
.ftext {
  margin: 6px 0 0;
}
/* Los que ya salieron: una línea, tildados. */
.fstep.done,
.fstep.skipped {
  font-size: 20px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.fstep.done .fmark,
.fstep.done .ftitle {
  color: var(--accent);
}
.fstep.done .ftitle {
  text-decoration: line-through;
  text-decoration-color: rgba(61, 220, 151, 0.5);
  opacity: 0.8;
}
.fstep.skipped .fmark,
.fstep.skipped .ftitle {
  color: var(--warn);
  opacity: 0.75;
}
/* El actual: grande, lo único que hay que leer. */
.fstep.current {
  margin: 14px 0;
  padding: 22px 26px;
  background: var(--panel);
  border: 2px solid var(--accent);
}
.fstep.current .fmark {
  font-size: 44px;
  color: var(--accent);
}
.fstep.current .ftitle {
  font-size: 30px;
  color: var(--accent);
}
.fstep.current .ftext {
  font-size: 40px;
  line-height: 1.35;
  color: var(--text);
}
/* Los que faltan: más chicos, para anticipar el siguiente. */
.fstep.next {
  font-size: 20px;
  color: var(--muted);
}
.fstep.next .ftext {
  font-size: 19px;
  color: var(--muted);
}
.fstep.next .ftitle {
  color: var(--text-2);
}
.framing-hint {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* ---------- «Crear demo» (AutoCode demos en vivo) ---------- */
.btn.demo-btn {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn.demo-btn.off {
  border-color: var(--warn);
  border-style: dashed;
  color: var(--warn);
  cursor: help;
}
.btn.demo-btn.off::before {
  content: '⚠ ';
}
.demo-status {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
}
.demo-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 2px 4px 2px 10px;
  border: 1px solid var(--warn);
  border-radius: 999px;
  background: rgba(255, 180, 84, 0.08);
}
.demo-item .demo-st {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: var(--warn);
}
.demo-item .demo-st::before {
  content: '◌';
  display: inline-block;
  animation: spin 1s linear infinite;
}
.demo-item.published {
  border-color: var(--accent);
  background: rgba(61, 220, 151, 0.1);
}
.demo-item.published .demo-st {
  color: var(--accent);
}
.demo-item.published .demo-st::before {
  content: '✓';
  animation: none;
}
.demo-item.failed {
  border-color: var(--danger);
  background: rgba(255, 107, 107, 0.08);
}
.demo-item.failed .demo-st,
.demo-item .demo-err {
  color: var(--danger);
}
.demo-item.failed .demo-st::before {
  content: '✕';
  animation: none;
}
.demo-item .demo-err {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.demo-item .demo-link {
  color: var(--seller);
  font-weight: 700;
}
.demo-item .rm {
  appearance: none;
  border: 0;
  background: none;
  padding: 0 6px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.demo-item .rm:hover {
  color: var(--danger);
}
.demo-dialog {
  width: min(720px, 96vw);
  max-height: 90vh;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.demo-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.demo-dialog .kb-head h2 {
  margin: 0;
  font-size: 16px;
}
.demo-form .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
  font-size: 13px;
  color: var(--muted);
}
.demo-form input[type='text'],
.demo-form textarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
}
.demo-form textarea {
  resize: vertical;
  min-height: 140px;
  font-size: 12.5px;
  line-height: 1.4;
}
.demo-dup {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid var(--warn);
  border-radius: 6px;
  color: var(--warn);
  font-size: 13px;
}
.demo-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- transcript ---------- */
.transcript-panel {
  flex: 1 1 0;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.legend {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
}
.dot.seller {
  background: var(--seller);
}
.dot.prospect {
  background: var(--prospect);
}
.transcript {
  flex: 1;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.seg {
  padding: 4px 0 4px 10px;
  border-left: 3px solid transparent;
  margin: 2px 0;
}
.seg.seller {
  border-left-color: var(--seller);
}
.seg.prospect {
  border-left-color: var(--prospect);
}
.seg .who {
  font-size: 14px;
  font-weight: 700;
  margin-right: 6px;
}
.seg.seller .who {
  color: var(--seller);
}
.seg.prospect .who {
  color: var(--prospect);
}
.seg.seller .text {
  color: var(--muted);
}
.seg.partial .text {
  opacity: 0.65;
}
/* «Un micro» (WhatsApp): una sola voz, sin vendedor ni prospecto. */
.seg.mixed {
  border-left-color: #25d366;
}
.seg.mixed .who {
  color: #25d366;
}
.seg.sim .who::after {
  content: ' · sim';
  font-weight: 400;
  color: var(--muted);
}
/* Separador de contexto: desde acá lee ReadOS en la próxima respuesta. */
.cp-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 6px;
  font-size: 13px;
  color: var(--accent);
}
.cp-sep::before,
.cp-sep::after {
  content: '';
  flex: 1;
  border-top: 1px dashed rgba(61, 220, 151, 0.45);
}
.cp-sep.idle {
  color: var(--muted);
}
.cp-sep.idle::before,
.cp-sep.idle::after {
  border-top-color: var(--border);
}
.jump {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #06140e;
  border: 0;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- simulación ---------- */
.sim {
  flex: none;
  font-size: 14px;
  color: var(--muted);
}
.sim summary {
  cursor: pointer;
}
.sim-form {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
#kb-size[data-dirty='true'] {
  color: var(--warn);
}
.sim-form input {
  flex: 1;
  min-width: 0;
}

/* ---------- Llamadas pasadas ---------- */
.calls-dialog {
  width: min(1100px, 96vw);
  height: 90vh;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.calls-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.calls-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.calls-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 10px;
}
.calls-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.calls-list li {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.calls-list li[aria-selected='true'] {
  background: rgba(255, 255, 255, 0.08);
}
.calls-list li .meta {
  display: block;
  font-size: 12px;
}
.calls-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.calls-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.calls-text {
  flex: 1;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

/* ---------- KB ---------- */
.kb-dialog {
  width: min(960px, 96vw);
  height: 90vh;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.kb-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kb-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.kb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kb-head h2 {
  margin: 0;
  font-size: 16px;
}
.kb-head select {
  max-width: 240px;
}
#kb-text {
  flex: 1;
  width: 100%;
  resize: none;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.kb-msg {
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
}
.kb-msg[data-kind='ok'] {
  color: var(--accent);
}
.kb-msg[data-kind='error'] {
  color: var(--danger);
}

/* ---------- login ---------- */
.login-page {
  display: grid;
  place-items: center;
}
.login-card {
  width: min(340px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 20px;
}
.login-card label {
  font-size: 13px;
  color: var(--muted);
}
.login-card .error {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
}

/* ---------- lead del dashboard: «Dolores del lead» (abierto desde la ficha del lead) ---------- */
.lead-link {
  flex: 0 1 auto;
  max-height: 30%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.lead-link .section-head {
  margin-bottom: 4px;
}
.lead-link #ll-retry {
  margin-left: auto;
}
.lead-link #ll-unlink {
  margin-left: auto;
}
.lead-link #ll-retry:not([hidden]) + #ll-unlink {
  margin-left: 4px;
}
#ll-load[data-kind='error'],
#ll-load[data-kind='warn'] {
  color: var(--warn);
}
.ll-pains {
  margin: 0;
  padding: 8px 12px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--prospect);
  border-radius: var(--radius);
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ll-pains:empty {
  display: none;
}
.ll-pains .pd {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.lead-link .placeholder {
  font-size: 15px;
  margin: 0;
}
.ll-save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
.ll-save[data-kind='ok'] {
  color: var(--accent);
}
.ll-save[data-kind='warn'],
.ll-save[data-kind='error'] {
  color: var(--warn);
}

/* ---------- Etapas de la llamada (arriba de la sugerencia) ---------- */
.stage-bar {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 14px;
}
.stage-call {
  font-weight: 700;
}
.stage-list {
  display: inline-flex;
  list-style: none;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}
.stage-list button.stage {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.stage-list button.stage:hover:not(.current) {
  color: var(--text);
}
.stage-list button.stage.current {
  background: var(--accent);
  color: #06140e;
}
.stage-outcome {
  display: inline-flex;
  gap: 4px;
}
.stage-outcome .btn.toggle.on {
  color: var(--accent);
  border-color: var(--accent);
}
.stage-goal {
  color: var(--muted);
}
.stage-warning {
  color: #1a0a00;
  background: var(--warn);
  border-radius: 6px;
  padding: 2px 10px;
}

/* ---------- Oferta (A medida | Producto base) y recorrido del prototipo ---------- */
.offer-row {
  flex: none;
}
.segmented button.on[data-offer='custom'] {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}
.segmented button.on[data-offer='base'] {
  background: var(--prospect);
  color: #1a1300;
}
.tour {
  flex: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--prospect);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.tour h3 {
  margin: 0 0 4px;
  font-size: 14px;
}
.tour-advice {
  margin: 0 0 6px;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 13px;
}
.tour-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tour-step {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tour-tick {
  flex: 1;
  text-align: left;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.tour-step.current .tour-tick {
  border-color: var(--prospect);
}
.tour-step.done .tour-tick {
  color: var(--muted);
  text-decoration: line-through;
}

/* ---------- Celu: diálogo del QR en la compu ---------- */
.btn.celu-linked {
  border-color: var(--accent);
  color: var(--accent);
}
.celu-dialog {
  width: min(420px, 94vw);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px 16px;
}
.celu-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.celu-dialog .kb-head h2 {
  margin: 0;
  font-size: 16px;
}
.celu-qr {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 10px auto;
  image-rendering: pixelated;
  border-radius: 6px;
}
.celu-url {
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  word-break: break-all;
  margin: 0 0 8px;
}
.celu-dialog-msg {
  color: var(--text-2);
  font-size: 14px;
  margin: 6px 0;
}
.celu-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ---------- Celu: vista del iPhone (vertical, una mano, sin scroll en lo principal) ----------
 * Instalada como app (standalone) se respetan las zonas seguras (notch o Dynamic Island, barra de inicio)
 * aunque iOS dibuje la barra de estado encima: van en variables para poder simularlas en el preview.
 * Arriba lo que se toca (etapa, paso, Objeción); después los números, compactos; el pie, pegado abajo.
 * Todo con alto fijo: no depende de 100dvh, que en standalone del iPhone dejaba un hueco abajo. */
html:has(> body.celu) {
  overflow: hidden;
}
body.celu {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  user-select: none;
}
.celu-main {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(var(--safe-top) + 10px) calc(var(--safe-right) + 12px) 0 calc(var(--safe-left) + 12px);
  overflow-y: auto;
  overscroll-behavior: none;
}
.celu-main > * {
  flex-shrink: 0;
}
.celu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  background: var(--bg);
}
.celu-call {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.celu-conn {
  flex: none;
  font-size: 12px;
  color: var(--danger);
}
.celu-conn[data-ok='true'] {
  color: var(--accent);
}
/* Alto de los controles: cómodos en un Android chico y algo más holgados en un iPhone alto, nunca gigantes. */
.celu-controls {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 12px);
}
.celu-stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.celu-stages button {
  appearance: none;
  height: clamp(40px, 5.4vh, 46px);
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
  border-radius: 8px;
  font-family: inherit;
  font-size: clamp(12px, 3.7vw, 15px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.celu-stages button.on {
  background: var(--seller);
  border-color: var(--seller);
  color: #07121f;
}
.celu-k {
  font-size: 13px;
  color: var(--muted);
}

/* Condiciones: compactas (renglón por dato); «Ampliar» agranda los números. */
.celu-terms {
  /* Crece con el alto que sobra, hasta ~un tercio de la pantalla (los renglones se reparten adentro);
     si sobra más, queda entre los controles y los números: números y pie siempre pegados abajo. */
  flex: 1 0 auto;
  max-height: 32%;
  margin-top: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 12px 10px;
}
.celu-terms[data-open='true'] {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}
.celu-terms-head {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
}
.celu-terms-title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.celu-terms-more {
  flex: none;
  color: var(--seller);
  font-weight: 600;
}
.celu-tl {
  flex: 1 0 auto;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: space-evenly;
  gap: 6px 14px;
}
.celu-tr {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.celu-tr.wide {
  grid-column: 1 / -1;
}
.celu-tr dt {
  flex: none;
  font-size: 14px;
  color: var(--muted);
}
.celu-tr dt small {
  display: none;
}
.celu-tr dd {
  margin: 0;
  min-width: 0;
  text-align: right;
  font-size: clamp(18px, 2.4vh, 21px);
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.celu-alt {
  white-space: nowrap;
}
/* «Solo web» al lado de su número: etiqueta chica, el número sigue grande. */
.celu-alt-k {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.celu-tr.pp {
  flex-wrap: wrap;
  row-gap: 0;
}
.celu-tr.pp strong {
  color: var(--accent);
}
.celu-tr .celu-due {
  flex-basis: 100%;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--warn);
}
/* Tilde «Congelar con seña»: última fila de las condiciones, de ancho completo y alta para el dedo. */
.celu-deposit {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.celu-deposit input {
  width: 24px;
  height: 24px;
  margin: 0;
  flex: none;
}
.celu-deposit:has(input:checked) {
  color: var(--warn);
}
.celu-terms[data-open='true'] .celu-tr {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.celu-terms[data-open='true'] .celu-tr dt small {
  display: inline;
}
.celu-terms[data-open='true'] .celu-tr dd {
  text-align: left;
  font-size: clamp(24px, 8vw, 34px);
  line-height: 1.15;
}
.celu-terms[data-open='true'] .celu-tr .celu-due {
  font-size: 16px;
}

.celu-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: clamp(64px, 9vh, 80px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 8px 12px;
}
.celu-step-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.celu-step-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.celu-step-btns {
  flex: none;
  display: flex;
  gap: 6px;
}
.celu-btn {
  appearance: none;
  min-height: 48px;
  min-width: 64px;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  padding: 6px 12px;
}
.celu-btn.ok {
  background: var(--accent);
  border-color: var(--accent);
  color: #06140e;
}
.celu-btn.ghost {
  background: transparent;
  color: var(--text-2);
}
.celu-btn.wide {
  width: 100%;
  min-height: 56px;
  font-size: 18px;
}
.celu-btn:disabled,
.celu-big:disabled {
  opacity: 0.4;
}
.celu-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Fila principal (Objeción y «Responder ahora»): se reparten el ancho y comparten el alto. */
.celu-actions-main {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}
.celu-actions-more {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.celu-big {
  appearance: none;
  min-width: 0;
  height: clamp(52px, 6.8vh, 60px);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
  font: inherit;
  font-size: clamp(14px, 3.9vw, 16px);
  font-weight: 700;
  line-height: 1.15;
  padding: 0 6px;
  overflow: hidden;
  text-wrap: balance;
}
/* En la fila principal Objeción toma el alto de «Responder ahora» (84 px): los dos, grandes para el pulgar. */
.celu-actions-main .celu-big {
  height: auto;
  min-height: 84px;
  font-size: 19px;
}
.celu-big:active:not(:disabled),
.celu-btn:active:not(:disabled),
.celu-stages button:active {
  transform: scale(0.97);
}
.celu-big.on {
  border-color: var(--seller);
  color: var(--seller);
}
.celu-big.warn {
  border-color: var(--warn);
  background: rgba(255, 180, 84, 0.1);
  color: var(--warn);
}
.celu-big.demo {
  border-color: var(--buying);
  color: var(--buying);
}
/* «Responder ahora»: la acción principal, relleno lleno (Objeción es solo borde ámbar), en la fila principal a la
   derecha de Objeción, a mano del pulgar. Marca el alto de la fila: Objeción se estira a la par. */
.celu-responder {
  appearance: none;
  min-width: 0;
  width: 100%;
  min-height: 84px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #06140e;
  border-radius: 16px;
  font: inherit;
  font-size: clamp(19px, 5.4vw, 22px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
  padding: 0 8px;
  text-wrap: balance;
}
.celu-responder:active {
  transform: scale(0.98);
}
.celu-responder[data-state='sending'] {
  opacity: 0.75;
}
.celu-responder[data-state='sent'] {
  background: var(--panel-2);
  color: var(--accent);
}
/* Entre llamadas sigue a mano, apagado: al tocarlo avisa «Esperando llamada». */
.celu-responder[data-idle='true'] {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--muted);
}
.celu-toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--safe-bottom) + 64px);
  background: var(--panel-2);
  border: 1px solid var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  text-align: center;
}
.celu-toast[data-kind='ok'] {
  border-color: var(--accent);
}
.celu-sheet {
  position: fixed;
  inset: 0;
  background: var(--bg);
  padding: calc(var(--safe-top) + 10px) calc(var(--safe-right) + 14px) calc(var(--safe-bottom) + 14px) calc(var(--safe-left) + 14px);
  overflow-y: auto;
  user-select: text;
}
.celu-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 17px;
}
.celu-sheet-body p {
  font-size: 21px;
  line-height: 1.5;
  margin: 10px 0;
}
.celu-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
  color: var(--text-2);
}
.celu-field input {
  font-size: 18px;
  min-height: 48px;
}
.celu-hint {
  color: var(--muted);
  font-size: 15px;
}
.celu-warn {
  color: var(--warn);
  font-weight: 600;
}
.celu-waiting {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.celu-waiting strong {
  font-size: 24px;
}
/* Pie de vinculación: pegado abajo (encima de la barra de inicio), chico y discreto. */
.celu-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 calc(-12px - var(--safe-right)) 0 calc(-12px - var(--safe-left));
  padding: 6px calc(var(--safe-right) + 12px) calc(var(--safe-bottom) + 6px) calc(var(--safe-left) + 12px);
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.celu-foot .celu-hint {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}
/* Consumo de Claude: renglón propio, más chico, debajo del vínculo. */
.celu-foot {
  flex-wrap: wrap;
}
.celu-foot .celu-usage {
  order: 3;
  flex-basis: 100%;
  font-size: 11px;
  opacity: 0.75;
}
.celu-foot .celu-usage:empty {
  display: none;
}
.usage-meta {
  white-space: nowrap;
  cursor: help;
}
.celu-foot .celu-btn {
  min-height: 34px;
  min-width: 0;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.celu-end {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}
.celu-end h1 {
  margin: 0 0 8px;
  font-size: 30px;
}
