:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b1220;
  color: #e8eef8;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #1b3151 0, #0b1220 46%); }
.shell { width: min(900px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 72px; }
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: #6fe3c1; font-weight: 800; letter-spacing: .15em; font-size: .78rem; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1; }
.subtitle { color: #aab8cc; margin: 14px 0 0; }
.card { background: rgba(16, 27, 46, .9); border: 1px solid #2a3b57; border-radius: 18px; padding: 22px; box-shadow: 0 18px 50px rgba(0, 0, 0, .18); margin-bottom: 18px; }
.setup { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { color: #aebbd0; font-size: .85rem; font-weight: 700; }
label small { font-weight: 500; }
input { width: 100%; margin-top: 7px; padding: 12px 13px; border-radius: 10px; border: 1px solid #344761; background: #09101c; color: white; font-size: 1rem; }
.actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
button { border: 1px solid #3a4d68; background: #1a2940; color: #eaf1fa; border-radius: 999px; padding: 11px 18px; cursor: pointer; font-weight: 750; }
button.primary { background: #62d6b5; color: #082019; border-color: #62d6b5; }
button:disabled { opacity: .45; cursor: not-allowed; }
.status { display: flex; align-items: center; gap: 8px; color: #b5c2d4; font-weight: 700; white-space: nowrap; }
.status span { width: 10px; height: 10px; border-radius: 50%; background: #718096; }
.status.online span { background: #5ee1b7; box-shadow: 0 0 0 5px rgba(94,225,183,.12); }
.status.listening span { background: #ffcb66; animation: pulse 1s infinite; }
.status.speaking span { background: #78a9ff; animation: pulse 1s infinite; }
.conversation { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.speaker { min-height: 130px; border-radius: 14px; padding: 17px; background: #0c1627; }
.speaker.assistant { background: #102238; }
.label, .history-title { color: #6fe3c1; font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.speaker p { font-size: 1.08rem; line-height: 1.55; }
.history { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.turn { padding: 12px 14px; border-left: 3px solid #465b78; background: #0c1627; border-radius: 0 10px 10px 0; }
.turn.carmen { border-color: #62d6b5; }
.turn strong { display: block; color: #8fa5c2; margin-bottom: 4px; font-size: .82rem; }
/* Misma forma que .turn, en ámbar: se lee como parte de la misma lista sin
   confundirse con lo que se dijo. El borde distingue quién decidió — el modelo
   por su cuenta, o un disparo del código. */
.accion { padding: 10px 14px; border-left: 3px solid #ffcb66; background: #0c1627; border-radius: 0 10px 10px 0; }
.accion.codigo { border-color: #ff9f5a; }
.accion strong { display: block; color: #ffcf70; font-size: .82rem; }
.accion div { color: #8fa5c2; font-size: .86rem; margin-top: 3px; word-break: break-word; }
/* El cartel de alerta clínica. Un solo elemento que cambia de color: rojo
   mientras la situación está abierta y la sesión no puede cerrarse, verde cuando
   terminó. No es una lista — se pisa, no se acumula. */
.alerta { padding: 16px 20px; border-radius: 14px; font-weight: 800; font-size: 1.05rem; margin-bottom: 18px; border: 1px solid transparent; }
.alerta.activa { background: rgba(255, 92, 92, .16); border-color: #ff5c5c; color: #ffb4b4; animation: pulse-alerta 1.6s ease-in-out infinite; }
.alerta.fin { background: rgba(94, 225, 183, .14); border-color: #5ee1b7; color: #8ff0d5; }
@keyframes pulse-alerta { 50% { background: rgba(255, 92, 92, .28); } }
@media (prefers-reduced-motion: reduce) { .alerta.activa { animation: none; } }
.hint { grid-column: 1 / -1; color: #ffcf70; margin: 0; font-size: .88rem; }
@keyframes pulse { 50% { transform: scale(1.35); opacity: .7; } }
@media (max-width: 680px) {
  header { flex-direction: column; }
  .setup, .conversation { grid-template-columns: 1fr; }
}
