:root {
  --fondo: #120a14;
  --fondo-2: #1a0f1d;
  --cristal: rgba(255, 255, 255, 0.045);
  --cristal-2: rgba(255, 255, 255, 0.08);
  --borde: rgba(255, 255, 255, 0.09);
  --borde-2: rgba(255, 255, 255, 0.16);
  --texto: #f7eef4;
  --texto-2: #c9b8c4;
  --texto-3: #8f7d8a;
  --frambuesa: #ff4f7b;
  --frambuesa-2: #e0245e;
  --arandano: #6d7cff;
  --hoja: #34d399;
  --hoja-2: #10b981;
  --ambar: #fbbf24;
  --rojo: #ef4444;
  --wa: #1f7a5a;
  --radio: 20px;
  --sombra: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  --letra: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --letra-serif: "Instrument Serif", Georgia, serif;
  --letra-mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--letra);
  background: var(--fondo);
  color: var(--texto);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* Fondo con manchas de color que se mueven despacio */
.fondo { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.mancha { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35; animation: flotar 26s ease-in-out infinite alternate; }
.m1 { width: 46vw; height: 46vw; background: #8a1640; top: -14vw; left: -10vw; }
.m2 { width: 40vw; height: 40vw; background: #2b2f8f; bottom: -16vw; right: -8vw; animation-delay: -9s; }
.m3 { width: 26vw; height: 26vw; background: #5a1a6e; top: 38%; left: 46%; opacity: 0.22; animation-delay: -17s; }
@keyframes flotar { to { transform: translate(4vw, 3vw) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .mancha { animation: none; } }

.cabecera, .rejilla, .pie { position: relative; z-index: 1; }

.cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px clamp(16px, 3vw, 40px);
  max-width: 1480px; margin: 0 auto;
}
.marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.marca-logo { width: 38px; height: 38px; stroke: none; }
.marca-logo.grande { width: 56px; height: 56px; }
.marca-nombre { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.marca-nombre span { font-family: var(--letra-serif); font-style: italic; font-weight: 400; font-size: 21px; color: var(--frambuesa); }
.marca-sub { font-size: 13px; color: var(--texto-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.boton-fantasma {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  background: var(--cristal); border: 1px solid var(--borde); font-size: 14px; color: var(--texto-2);
  transition: background .2s, color .2s, border-color .2s;
}
.boton-fantasma:hover { background: var(--cristal-2); color: var(--texto); border-color: var(--borde-2); }
.cabecera-acciones { display: flex; align-items: center; gap: 8px; flex: none; }
.boton-whatsapp { text-decoration: none; color: var(--texto); border-color: var(--borde-2); }
.boton-whatsapp svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.pie a { color: inherit; }
.boton-fantasma svg { width: 18px; height: 18px; }

.rejilla {
  display: grid; gap: 20px; max-width: 1480px; margin: 0 auto;
  padding: 4px clamp(16px, 3vw, 40px) 28px;
  grid-template-columns: minmax(340px, 1.05fr) minmax(320px, 1fr) minmax(300px, 0.9fr);
  align-items: start;
}
.columna { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.titulo {
  font-family: var(--letra-serif); font-weight: 400; font-size: clamp(30px, 3.1vw, 44px); line-height: 1.05;
  letter-spacing: -0.01em; margin: 4px 0 2px;
}
.titulo em { color: var(--frambuesa); }

.tarjeta {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025));
  border: 1px solid var(--borde); border-radius: var(--radio); padding: 20px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--sombra);
}
.tarjeta-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tarjeta-cabeza h2 { font-size: 14px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--texto-2); margin: 0; }
.sutil { font-size: 12.5px; color: var(--texto-3); }

/* Escenas */
.escenas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.escena {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  padding: 12px; border-radius: 16px; background: var(--cristal); border: 1px solid var(--borde);
  transition: background .2s, border-color .2s, transform .2s;
}
.escena:hover:not(:disabled) { background: var(--cristal-2); }
.escena:disabled { cursor: not-allowed; opacity: .55; }
.escena.activa { background: rgba(255, 79, 123, 0.12); border-color: rgba(255, 79, 123, 0.55); }
.escena svg { color: var(--frambuesa); }
.escena-texto { display: flex; flex-direction: column; gap: 3px; }
.escena-texto b { font-size: 14px; font-weight: 600; }
.escena-texto small { font-size: 12px; color: var(--texto-3); line-height: 1.3; }

/* Teléfono */
.telefono { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding-top: 18px; }
.contexto { min-height: 0; }
.contexto-candidato { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contexto-candidato .campo:first-child { grid-column: 1 / -1; }
.contexto-candidato .nota { grid-column: 1 / -1; }
.campo { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--texto-3); }
.campo input, .campo select {
  background: rgba(0,0,0,.25); border: 1px solid var(--borde); border-radius: 12px; padding: 10px 12px;
  font-size: 14.5px; color: var(--texto); outline: none; transition: border-color .2s; min-width: 0; width: 100%;
}
.campo input:focus, .campo select:focus { border-color: var(--frambuesa); }
.campo select option { background: var(--fondo-2); }
.nota { font-size: 13.5px; line-height: 1.5; color: var(--texto-2); margin: 0; text-align: justify; hyphens: auto; }

.orbe-zona { position: relative; width: min(100%, 250px); aspect-ratio: 1; margin: -4px auto -14px; }
#orbe { position: absolute; inset: 0; width: 100%; height: 100%; }
.orbe-centro { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.avatar {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--letra-serif); font-size: 46px; color: #fff;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.35), rgba(255,255,255,0) 55%), linear-gradient(140deg, var(--frambuesa), var(--arandano));
  box-shadow: 0 10px 40px -8px rgba(255, 79, 123, .65), inset 0 0 0 1px rgba(255,255,255,.25);
}
.identidad { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.identidad-nombre { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.identidad-rol { font-size: 13px; color: var(--texto-3); }
.estado {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 12px; border-radius: 999px;
  background: rgba(0,0,0,.25); border: 1px solid var(--borde); font-size: 13px; color: var(--texto-2);
}
.estado .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--texto-3); }
.estado[data-tipo="marcando"] .punto { background: var(--ambar); animation: latir 1s ease-in-out infinite; }
.estado[data-tipo="conectado"] .punto { background: var(--hoja); box-shadow: 0 0 0 4px rgba(52, 211, 153, .18); }
.estado[data-tipo="fin"] .punto { background: var(--frambuesa); }
.estado[data-tipo="error"] .punto { background: var(--rojo); }
.reloj { font-family: var(--letra-mono); color: var(--texto); }
@keyframes latir { 50% { opacity: .3; } }

.controles { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 16px 0 6px; }
.control {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cristal-2); border: 1px solid var(--borde); color: var(--texto-2); transition: background .2s, opacity .2s;
}
.control:hover:not(:disabled) { background: rgba(255,255,255,.14); color: var(--texto); }
.control:disabled { opacity: .35; cursor: default; }
.control .tachado { display: none; }
.control[aria-pressed="true"] { background: rgba(239, 68, 68, .18); color: #fecaca; border-color: rgba(239, 68, 68, .45); }
.control[aria-pressed="true"] .tachado { display: inline; }
.llamar {
  display: inline-flex; align-items: center; gap: 10px; height: 60px; padding: 0 30px; border-radius: 999px; border: 0;
  background: linear-gradient(135deg, var(--hoja), var(--hoja-2)); color: #052e1f; font-weight: 700; font-size: 16px;
  box-shadow: 0 14px 34px -12px rgba(16, 185, 129, .8); transition: transform .15s, box-shadow .2s, background .2s;
}
.llamar:hover { transform: translateY(-1px); }
.llamar:active { transform: translateY(1px); }
.llamar:disabled { opacity: .6; cursor: default; transform: none; }
.llamar svg { width: 22px; height: 22px; stroke-width: 2.2; }
.llamar .i-colgar { display: none; }
.llamar.colgar { background: linear-gradient(135deg, #f43f5e, #dc2626); color: #fff; box-shadow: 0 14px 34px -12px rgba(244, 63, 94, .8); }
.llamar.colgar .i-colgar { display: inline; fill: currentColor; stroke: none; }
.llamar.colgar .i-llamar { display: none; }
.pista { font-size: 12.5px; color: var(--texto-3); text-align: center; margin: 4px 0 0; }
.aviso-error {
  font-size: 13.5px; line-height: 1.45; color: #fecaca; background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .35);
  border-radius: 12px; padding: 10px 12px; margin: 10px 0 0; text-align: justify; hyphens: auto;
}

/* Conversación */
.conversacion { display: flex; flex-direction: column; min-height: 640px; max-height: calc(100dvh - 120px); position: sticky; top: 16px; }
.burbujas { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; scroll-behavior: smooth; }
.burbujas::-webkit-scrollbar { width: 6px; }
.burbujas::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.vacio { margin: auto; text-align: center; color: var(--texto-3); max-width: 280px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vacio svg { width: 34px; height: 34px; opacity: .6; }
.vacio p { margin: 0; font-size: 14px; line-height: 1.5; }
.burbuja {
  max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.45;
  animation: entrar .25s ease-out; white-space: pre-wrap; overflow-wrap: anywhere;
}
.burbuja .quien { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 3px; opacity: .75; }
.burbuja.agente { align-self: flex-start; background: rgba(255, 79, 123, .13); border: 1px solid rgba(255, 79, 123, .25); border-bottom-left-radius: 6px; }
.burbuja.agente .quien { color: #ffb3c6; }
.burbuja.persona { align-self: flex-end; background: rgba(109, 124, 255, .14); border: 1px solid rgba(109, 124, 255, .28); border-bottom-right-radius: 6px; }
.burbuja.persona .quien { color: #c5cbff; }
.burbuja.pendiente .texto::after { content: "…"; animation: latir 1s infinite; }
.burbuja.sistema { align-self: center; background: none; border: 0; font-size: 12.5px; color: var(--texto-3); padding: 4px 8px; display: flex; align-items: center; gap: 8px; }
.burbuja.sistema svg { width: 15px; height: 15px; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } }
.etiqueta-vivo { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #fecdd3; }
.etiqueta-vivo span { width: 8px; height: 8px; border-radius: 50%; background: var(--frambuesa); animation: latir 1.2s infinite; }

/* Ficha */
.ficha { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0; font-size: 14px; }
.ficha dt, .ficha dd { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); margin: 0; }
.ficha dt { color: var(--texto-3); padding-right: 14px; white-space: nowrap; }
.ficha dd { color: var(--texto); text-align: right; overflow-wrap: anywhere; transition: background .6s, color .6s; border-radius: 6px; }
.ficha dd.vacia { color: rgba(255,255,255,.22); }
.ficha dd.nueva { background: rgba(52, 211, 153, .16); color: #d1fae5; }
.ficha dt:nth-last-child(2), .ficha dd:last-child { border-bottom: 0; }

/* Acciones */
.acciones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.acciones:empty::before { content: "Las citas, cotizaciones, mensajes de WhatsApp y avisos al equipo aparecen aquí."; display: block; font-size: 13.5px; color: var(--texto-3); line-height: 1.5; }
.accion {
  display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; padding: 12px;
  border-radius: 14px; background: rgba(0,0,0,.22); border: 1px solid var(--borde); animation: entrar .3s ease-out;
}
.accion-icono { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.accion-icono svg { width: 18px; height: 18px; }
.accion[data-tipo="cita"] .accion-icono { background: rgba(52, 211, 153, .16); color: var(--hoja); }
.accion[data-tipo="whatsapp"] .accion-icono { background: rgba(37, 211, 102, .14); color: #4ade80; }
.accion[data-tipo="aviso"] .accion-icono { background: rgba(251, 191, 36, .15); color: var(--ambar); }
.accion[data-tipo="transferencia"] .accion-icono { background: rgba(109, 124, 255, .18); color: #a5b0ff; }
.accion[data-tipo="cotizacion"] .accion-icono { background: rgba(251, 191, 36, .15); color: var(--ambar); }
.accion[data-tipo="reserva"] .accion-icono { background: rgba(52, 211, 153, .16); color: var(--hoja); }
.accion[data-tipo="error"] .accion-icono { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.accion-titulo { font-size: 14px; font-weight: 600; }
.accion-detalle { font-size: 13px; color: var(--texto-2); margin-top: 2px; line-height: 1.45; }
.wa {
  margin-top: 8px; background: var(--wa); color: #e9fdf3; border-radius: 12px 12px 12px 4px; padding: 9px 11px;
  font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.wa .hora { display: block; text-align: right; font-size: 10.5px; opacity: .7; margin-top: 4px; }

/* Resumen */
.resumen { border-color: rgba(255, 79, 123, .35); order: -1; }
.resumen-titulo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.chip.positivo { background: rgba(52, 211, 153, .16); color: #6ee7b7; }
.chip.neutral { background: rgba(251, 191, 36, .14); color: #fcd34d; }
.chip.negativo { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.resumen-texto { font-size: 14.5px; line-height: 1.55; color: var(--texto); margin: 0 0 12px; text-align: justify; hyphens: auto; }
.resumen-paso { font-size: 13.5px; line-height: 1.5; color: var(--texto-2); padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.22); border: 1px solid var(--borde); text-align: justify; hyphens: auto; }
.resumen-paso b { color: var(--texto); }
.etiquetas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.etiquetas span { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--cristal-2); color: var(--texto-2); }
.cargando { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--texto-2); }
.cargando::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--frambuesa); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.pie { text-align: center; font-size: 12.5px; color: var(--texto-3); padding: 8px 16px 28px; }

/* Ajustes */
.ajustes {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border-radius: 22px;
  background: #1b1120; color: var(--texto); border: 1px solid var(--borde-2); box-shadow: 0 40px 120px -20px #000;
}
.ajustes::backdrop { background: rgba(8, 4, 10, .65); backdrop-filter: blur(4px); }
.ajustes form { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 16px; }
.ajustes-cabeza { display: flex; align-items: center; justify-content: space-between; }
.ajustes-cabeza h2 { margin: 0; font-size: 18px; }
.cerrar { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--texto-3); padding: 4px 8px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-size: 13px; font-weight: 600; color: var(--texto-2); margin-bottom: 8px; padding: 0; }
.opciones { display: flex; flex-wrap: wrap; gap: 8px; }
.opciones label { position: relative; }
.opciones input { position: absolute; opacity: 0; pointer-events: none; }
.opciones span {
  display: inline-flex; flex-direction: column; padding: 9px 14px; border-radius: 12px; background: var(--cristal);
  border: 1px solid var(--borde); font-size: 14px; cursor: pointer; transition: border-color .2s, background .2s;
}
.opciones small { font-size: 11.5px; color: var(--texto-3); }
.opciones input:checked + span { border-color: var(--frambuesa); background: rgba(255, 79, 123, .12); }
.opciones input:focus-visible + span { outline: 2px solid var(--arandano); outline-offset: 2px; }
.casillas { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.casillas label { display: flex; gap: 10px; align-items: center; }
.casillas input { accent-color: var(--frambuesa); width: 17px; height: 17px; }
textarea {
  width: 100%; background: rgba(0,0,0,.28); border: 1px solid var(--borde); border-radius: 12px; padding: 10px 12px;
  font-size: 13.5px; line-height: 1.55; resize: vertical; outline: none;
}
textarea:focus { border-color: var(--frambuesa); }
.boton-texto { align-self: flex-start; background: none; border: 0; padding: 2px 0; font-size: 13px; color: #ffb3c6; text-decoration: underline; text-underline-offset: 3px; }
.ajustes-pie { display: flex; justify-content: flex-end; }
.boton {
  padding: 11px 22px; border-radius: 999px; border: 0; font-weight: 600; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, var(--frambuesa), var(--frambuesa-2)); box-shadow: 0 12px 30px -12px rgba(224, 36, 94, .9);
}

/* Acceso */
.acceso { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(12, 6, 14, .82); backdrop-filter: blur(16px); }
.acceso-caja {
  width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: 30px 26px; border-radius: 24px; background: #1b1120; border: 1px solid var(--borde-2); box-shadow: 0 40px 120px -20px #000;
}
.acceso-caja h2 { margin: 4px 0 0; font-size: 22px; }
.acceso-caja p { margin: 0; color: var(--texto-2); font-size: 14px; }
.acceso-caja input {
  width: 100%; text-align: center; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.3);
  border: 1px solid var(--borde); outline: none; font-size: 16px; letter-spacing: .04em;
}
.acceso-caja input:focus { border-color: var(--frambuesa); }
.acceso-caja .boton { width: 100%; }

/* Tamaños */
@media (max-width: 1180px) {
  .rejilla { grid-template-columns: minmax(320px, 1fr) minmax(300px, 1fr); }
  .col-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
  .conversacion { position: static; max-height: 720px; }
}
@media (max-width: 760px) {
  .rejilla { grid-template-columns: 1fr; gap: 16px; }
  .col-panel { display: flex; align-items: stretch; }
  .conversacion { min-height: 380px; max-height: 70dvh; }
  .escenas { grid-template-columns: 1fr; }
  .escena { flex-direction: row; align-items: center; }
  .marca-sub { max-width: 52vw; }
  .boton-fantasma span { display: none; }
  .tarjeta { padding: 16px; }
  .contexto-candidato { grid-template-columns: 1fr; }
}

/* Hasta que el código trae a su cliente, la página no enseña nada (ni textos vacíos). */
body:not(.listo) .rejilla, body:not(.listo) #abrir-ajustes { visibility: hidden; }

/* Línea de la grabación, al pie del resumen */
.grabacion { margin: 14px 0 0; font-size: 13px; color: var(--texto-3); }
.grabacion a { color: var(--frambuesa); font-weight: 600; text-decoration: none; }
.grabacion a:hover { text-decoration: underline; }
