:root {
  color-scheme: light;
  --bg: #eef0f3;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #d2262c;
  --accent-dark: #b01f24;
  --navy: #16181d;
  --stage: #0f1115;
  --stage-2: #191c22;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #18794e;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;
  /* Sistema tipográfico único del producto (mismo par del repaso de consola). */
  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  color: var(--ink);
}

.brand-band {
  height: 4px;
  background: var(--accent);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

#endCallBtn:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Command shell ---------- */
.command-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 40px;
}

.command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(20, 24, 29, 0.05);
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.atisa-logo {
  height: 28px;
  width: auto;
  display: block;
}

.brand-div {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.brand-sub {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.command-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfbfc;
}

.status-card small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
  font-size: 0.82rem;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #9ca3af;
  box-shadow: 0 0 0 4px rgba(156, 163, 175, 0.18);
}

.dot.connected {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(24, 121, 78, 0.2);
}

.dot.connecting {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.2);
}

.dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.2);
}

.live-clock {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.back-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 8px 15px;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Command grid ---------- */
.command-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(28, 39, 52, 0.05);
  padding: 18px;
}

.rail {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.config-panel {
  display: grid;
  gap: 14px;
}

.button-row {
  display: flex;
  gap: 10px;
}

.button-row button {
  flex: 1;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch input {
  width: 18px;
  height: 18px;
}

/* ---------- Stage (dark) ---------- */
.stage-col {
  display: grid;
  gap: 16px;
}

.stage {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  padding: 18px 20px 20px;
  background:
    radial-gradient(120% 80% at 50% 0%, #22262f 0%, var(--stage) 60%);
  border: 1px solid #23272f;
  box-shadow: 0 18px 44px rgba(10, 12, 16, 0.35);
  color: #e8eaee;
}

.stage-glow {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 340px;
  height: 340px;
  transform: translate(-50%, -50%) scale(0.7);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(210, 38, 44, 0.28) 0%, rgba(210, 38, 44, 0) 68%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.stage-glow.active {
  opacity: 0.6;
}

.stage-glow.speaking {
  opacity: 1;
  animation: glowPulse 1.4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.72); }
  50% { transform: translate(-50%, -50%) scale(0.92); }
}

.stage-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1;
}

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b8bdc7;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(210, 38, 44, 0.6);
  animation: liveBlink 1.6s ease-in-out infinite;
}

@keyframes liveBlink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210, 38, 44, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(210, 38, 44, 0); }
}

.stage-timer {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.voice-viz {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 196px;
  margin: 12px 0 8px;
}

.stage-hint {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto 16px;
  text-align: center;
  color: #aeb4bf;
  font-size: 0.95rem;
  line-height: 1.5;
}

.stage-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stage-foot-label {
  font-size: 0.8rem;
  color: #aeb4bf;
  min-width: 74px;
}

.stage .meter {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.stage-foot small {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: #8b9099;
  min-width: 150px;
  text-align: right;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f0454b);
  transition: width 120ms ease;
}

/* ---------- Transcript ---------- */
.transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.transcript-panel h2 {
  margin-bottom: 0;
}

.transcript {
  height: 320px;
  overflow: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  padding: 12px;
}

.transcript:empty::before {
  content: "La conversación aparecerá aquí en tiempo real.";
  color: var(--muted);
  font-size: 0.9rem;
}

.message {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #eef2f7;
  color: var(--ink);
  line-height: 1.45;
}

.message strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.message.user {
  background: #e0f2fe;
}

.message.user strong {
  color: #0369a1;
}

.message.error {
  background: #fee2e2;
}

.message.error strong {
  color: var(--danger);
}

.message.event {
  background: #f4f5f7;
}

.message.event strong {
  color: var(--muted);
}

/* ---------- Telemetry ---------- */
.tele-list {
  margin: 0;
  display: grid;
  gap: 2px;
}

.tele-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.tele-list > div:last-child {
  border-bottom: none;
}

.tele-list dt {
  color: var(--muted);
  font-size: 0.86rem;
}

.tele-list dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.result-panel {
  border-top: 3px solid var(--accent);
}

dd.ok {
  color: var(--ok);
}

dd.pending {
  color: var(--warn);
}

dd.fail {
  color: var(--danger);
}

/* ---------- Panel de carga de inventario ---------- */
.upload-wrap {
  max-width: 520px;
}

.upload-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0;
}

.upload-result {
  margin: 4px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  min-height: 1.2em;
}

.upload-result.ok {
  color: var(--ok);
}

.upload-result.fail {
  color: var(--danger);
}

/* ---------- Panel de inventario ---------- */
.inv-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.inv-stat {
  position: sticky;
  top: 18px;
  border-radius: 16px;
  padding: 26px 24px 28px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(210, 38, 44, 0.12) 0%, rgba(210, 38, 44, 0) 55%),
    #f6f7f9;
  box-shadow: 0 12px 30px rgba(28, 39, 52, 0.06);
}

.inv-eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.inv-stat-num {
  font-family: var(--display);
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  margin: 14px 0 6px;
}

.inv-stat-sub {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  max-width: 26ch;
}

.inv-card {
  display: grid;
  gap: 15px;
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(28, 39, 52, 0.06);
}

.inv-drop {
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: #f4f6f9;
  outline: 2px dashed #cfd5df;
  outline-offset: -8px;
  transition: background 0.15s ease, outline-color 0.15s ease;
}

.inv-drop:hover {
  background: #eef1f6;
}

.inv-drop.drag,
.inv-drop.has-file {
  background: rgba(210, 38, 44, 0.06);
  outline-color: var(--accent);
}

.inv-drop-inner {
  display: grid;
  gap: 5px;
}

.inv-drop-inner strong {
  font-size: 1.02rem;
  color: var(--ink);
  word-break: break-word;
}

.inv-drop-inner span {
  font-size: 0.88rem;
  color: var(--muted);
}

.inv-force {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(210, 38, 44, 0.06);
}

.inv-force[hidden] {
  display: none;
}

.inv-force button.ghost {
  justify-self: start;
  background: var(--surface);
  color: var(--accent);
}

@media (max-width: 720px) {
  .inv-grid {
    grid-template-columns: 1fr;
  }
  .inv-stat {
    position: static;
  }
  .inv-stat-num {
    font-size: 3.2rem;
  }
}

/* ---------- Dashboard de métricas ---------- */
.token-input {
  width: 200px;
  padding: 8px 12px;
}

.metrics-state {
  color: var(--muted);
  padding: 40px 4px;
  text-align: center;
}

.metrics-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 0;
}


.chart-bar {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--accent), #f0454b);
}

.chart-n {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.chart-x {
  font-size: 0.68rem;
  color: var(--muted);
}

.table-scroll {
  overflow-x: auto;
  margin-top: 14px;
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.metrics-table th,
.metrics-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.metrics-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metrics-table td.ok {
  color: var(--ok);
  font-weight: 600;
}

.metrics-table td.muted {
  color: var(--muted);
}

/* ---------- Consola journey (2 columnas) ---------- */
.journey-grid {
  grid-template-columns: 280px minmax(0, 1fr) 260px;
}
.tele-panel h2 { margin-bottom: 10px; }
.twilio-next {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.twilio-eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.twilio-next h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.twilio-next ol {
  margin: 0 0 12px;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.twilio-next code {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink);
  background: #f4f2ef;
  padding: 1px 4px;
  border-radius: 4px;
}
.twilio-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  line-height: 42px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.15s ease;
}
.twilio-btn:hover { background: var(--accent-dark); }

.tech-panel {
  border-top: 3px solid var(--accent);
  display: grid;
  gap: 14px;
  align-content: start;
}

.tele-list.compact {
  display: grid;
  gap: 0;
}
.tele-list.compact > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}
.tele-list.compact dt { color: var(--muted); }
.tele-list.compact dd {
  margin: 0;
  font-family: var(--mono);
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.tech-phone {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}
.tech-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.journey-col {
  display: grid;
  gap: 16px;
}
.journey-panel { border-top: 3px solid var(--accent); }

/* ---- Flowmap del recorrido (read-only, se ilumina en vivo) ---- */
.journey.jflow {
  position: relative;
  display: block;
  margin-top: 10px;
  padding: 4px 2px 2px;
}
.jedges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.jedge {
  fill: none;
  stroke: #c1c5cd;
  stroke-width: 2;
  opacity: 0.7;
  transition: stroke 0.35s ease, opacity 0.35s ease, stroke-width 0.35s ease;
}
.jedge.hot {
  stroke: var(--accent);
  stroke-width: 2.5;
  opacity: 1;
}
.jnodes {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(80px, auto);
  gap: 34px 22px;
  padding: 10px 8px 8px;
}
/* Serpiente: fila 1 izq→der, fila 2 der→izq */
.jnodes .jnode:nth-child(1) { grid-column: 1; grid-row: 1; }
.jnodes .jnode:nth-child(2) { grid-column: 2; grid-row: 1; }
.jnodes .jnode:nth-child(3) { grid-column: 3; grid-row: 1; }
.jnodes .jnode:nth-child(4) { grid-column: 4; grid-row: 1; }
.jnodes .jnode:nth-child(5) { grid-column: 4; grid-row: 2; }
.jnodes .jnode:nth-child(6) { grid-column: 3; grid-row: 2; }
.jnodes .jnode:nth-child(7) { grid-column: 2; grid-row: 2; }
.jnodes .jnode:nth-child(8) { grid-column: 1; grid-row: 2; }

.jnode {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px 13px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  transition: opacity 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.jn-ic {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.jn-nm {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.15;
  color: var(--ink);
}
.jn-sl {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: var(--muted);
  animation: jfade 0.35s ease;
}

/* pendiente: apagado */
.jnode.pending { opacity: 0.5; }
.jnode.pending .jn-nm { color: var(--muted); }

/* fallo: el registro terminó pero NO quedó en Zoho (el KPI). Debe gritar, no verse ok. */
.jnode.fail {
  border-top-color: var(--danger);
  background: linear-gradient(180deg, rgba(185, 28, 28, 0.08), var(--surface) 60%);
}
.jnode.fail .jn-ic {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 700;
}
.jnode.fail .jn-nm { color: var(--danger); }

/* no aplica: neutro, ni pendiente ni cubierto (no bloquea el avance) */
.jnode.skip { opacity: 0.7; border-top-color: var(--line); }
.jnode.skip .jn-nm { color: var(--muted); }
.jnode.skip .jn-ic {
  background: transparent;
  border-style: dashed;
  border-color: var(--line);
  color: var(--muted);
}

/* cubierto: verde sólido + check */
.jnode.done {
  border-top-color: var(--ok);
  background: linear-gradient(180deg, rgba(24, 121, 78, 0.07), var(--surface) 60%);
}
.jnode.done .jn-ic {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

/* on-deck: rojo tenue, anticipa */
.jnode.ondeck {
  border-top-color: rgba(210, 38, 44, 0.5);
  box-shadow: 0 0 0 1px rgba(210, 38, 44, 0.14);
}
.jnode.ondeck .jn-ic {
  border-color: rgba(210, 38, 44, 0.55);
  color: var(--accent);
}

/* actual: el más prominente, halo pulsante grande */
.jnode.actual {
  z-index: 3;
  border-top-color: var(--accent);
  border-color: rgba(210, 38, 44, 0.55);
  animation: jglow 3s ease-in-out infinite;
}
.jnode.actual .jn-ic {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(210, 38, 44, 0.08);
}
@keyframes jglow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210, 38, 44, 0.42), 0 0 0 3px rgba(210, 38, 44, 0.16); }
  50% { box-shadow: 0 0 0 12px rgba(210, 38, 44, 0), 0 0 0 3px rgba(210, 38, 44, 0.24); }
}

@keyframes jfade {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .jnodes {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 6px 2px;
  }
  .jnodes .jnode {
    grid-column: 1 !important;
    grid-row: auto !important;
    border-top: 1px solid var(--line);
    border-left: 3px solid var(--line);
  }
  .jnode.done { border-left-color: var(--ok); }
  .jnode.actual { border-left-color: var(--accent); }
  .jnode.ondeck { border-left-color: rgba(210, 38, 44, 0.5); }
  .jnode.skip { border-left-color: var(--line); }
  .jedges { display: none; }
}

.wave-strip {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  gap: 18px;
  border-radius: 12px;
  padding: 16px 20px;
  background: radial-gradient(120% 200% at 50% 0%, #22262f 0%, var(--stage) 70%);
  border: 1px solid #23272f;
}
.wave-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 196px;
  padding-right: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.wave-sub {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: #9aa0ac;
}
.wave-mic {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 2px;
}
.wave-mic-label {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7f8794;
}
.wave-mic .meter {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.voice-viz.small {
  height: 92px;
  flex: 1;
  margin: 0;
}

/* ---------- Mini-CRM (leads) ---------- */
.lead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.lead-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 15px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lead-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.lead-card h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-transform: none;
}

.lead-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.lead-row b {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.lead-row.cita b { color: var(--accent); }

.lead-note {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.lead-card footer {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
}
.lead-card footer.ok { color: #16794c; }
.lead-card footer.muted { color: var(--muted); }

.temp {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.temp-caliente { background: rgba(210, 38, 44, 0.14); color: #c0242a; }
.temp-tibio { background: rgba(214, 158, 46, 0.18); color: #9a6b12; }
.temp-frio { background: rgba(59, 130, 200, 0.16); color: #2f6aa8; }
.temp-na { background: var(--soft); color: var(--muted); }

/* ---------- Gate de acceso ---------- */
.gate[hidden] {
  display: none;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 17, 21, 0.55);
  backdrop-filter: blur(4px);
}

.gate-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 14px;
  padding: 28px 26px;
  box-shadow: 0 30px 70px rgba(10, 12, 16, 0.35);
  display: grid;
  gap: 12px;
  text-align: center;
}

.gate-eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gate-card h2 {
  margin: 0;
  font-size: 1.3rem;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.gate-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.gate-card input {
  margin-top: 4px;
}

.gate-err {
  min-height: 1em;
  color: var(--danger) !important;
  font-weight: 600;
  font-size: 0.86rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .command-grid {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
  }

  .rail-right {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .command-shell {
    width: calc(100% - 20px);
  }

  .command-bar {
    align-items: flex-start;
  }

  .command-status {
    flex-wrap: wrap;
    gap: 10px;
  }

  .rail-right {
    grid-template-columns: 1fr;
  }

  .wave-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .wave-info {
    min-width: 0;
    padding: 0 0 10px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .button-row {
    flex-direction: column;
  }

  .stage-foot {
    flex-wrap: wrap;
  }

  .stage-foot small {
    text-align: left;
  }
}

/* ========== Métricas · Sala de control ========== */
.metrics-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  background: #f7f6f4;
}

.m-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.m-brand { display: block; margin-bottom: 18px; }
.m-brand .atisa-logo { height: 26px; width: auto; }
.m-nav { display: grid; gap: 2px; }
.m-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.m-nav a:hover { background: #f4f2ef; color: var(--ink); }
.m-nav a.is-current { background: #fbeaea; color: var(--accent); font-weight: 600; }
.m-console-cta {
  margin-top: auto;
  display: block;
  text-align: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.m-console-cta:hover { border-color: var(--accent); color: var(--accent); }

.m-main {
  padding: 26px 30px 60px;
  display: grid;
  gap: 20px;
  align-content: start;
  min-width: 0;
}
.m-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.m-topbar h1 { margin: 0; font-size: 1.55rem; font-weight: 700; letter-spacing: -0.01em; }
.m-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.m-topbar-right { display: flex; gap: 8px; }

/* Hero: banda oscura */
.m-hero {
  display: grid;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 28px;
  align-items: center;
  padding: 28px 32px;
  border-radius: 16px;
  margin-bottom: 0;
  background: radial-gradient(130% 130% at 12% 0%, #23272f 0%, var(--stage) 62%);
  border: 1px solid #23272f;
  box-shadow: 0 16px 34px rgba(10, 12, 16, 0.22);
  color: #e8eaee;
}
.m-hero-kpi { display: grid; gap: 6px; }
.m-hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9aa0ac;
}
.m-hero-figure { display: flex; align-items: baseline; gap: 14px; }
.m-hero-num {
  font-family: var(--mono);
  font-size: 4rem;
  line-height: 0.95;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.m-spark-slot { display: inline-flex; width: 132px; }
.m-spark { width: 100%; height: 36px; }
.m-spark path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.m-hero-note { color: #aeb4bf; font-size: 0.85rem; }

.m-strip {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
}
.m-strip > div {
  padding: 11px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}
.m-strip dt { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: #9aa0ac; }
.m-strip dd {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.m-strip dd.hot { color: #ff6b6b; }

/* Gráficas */
.m-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
.m-line-panel { display: flex; flex-direction: column; }
.m-line-panel .m-chart { flex: 1; display: flex; align-items: center; }
.m-line-panel .m-chart > svg { width: 100%; }
.m-legend-inline { display: flex; gap: 14px; }
.m-lk { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); font-family: var(--mono); }
.m-lk::before { content: ""; width: 14px; height: 2px; border-radius: 2px; }
.m-lk.calls::before { background: #2e4a5a; }
.m-lk.leads::before { background: var(--accent); }
.m-chart { margin-top: 8px; }
.m-line { width: 100%; height: auto; display: block; }
.m-grid { stroke: var(--line); stroke-width: 1; }
.m-axl { font-family: var(--mono); font-size: 13px; fill: var(--muted); }
.m-axl-y { text-anchor: end; }
.m-area { fill: rgba(46, 74, 90, 0.07); stroke: none; }
.m-l-calls { fill: none; stroke: #2e4a5a; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.m-l-leads { fill: none; stroke: var(--accent); stroke-width: 2.8; stroke-linejoin: round; stroke-linecap: round; }
.m-dot-calls { fill: #2e4a5a; stroke: #fff; stroke-width: 1.5; }
.m-dot-leads { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }

.m-donut-wrap { display: grid; gap: 14px; margin-top: 6px; }
.m-donut { width: 148px; height: 148px; margin: 0 auto; display: block; }
.m-donut-n { font-family: var(--mono); font-size: 26px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.m-donut-l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; fill: var(--muted); text-anchor: middle; }
.m-legend { display: grid; gap: 7px; }
.m-leg { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; font-size: 0.85rem; }
.m-leg-dot { width: 10px; height: 10px; border-radius: 3px; }
.m-leg b { font-family: var(--mono); font-weight: 700; }
.m-subhead { margin: 18px 0 8px; font-size: 0.95rem; }

.m-main > section.panel { padding: 20px 22px; }

/* Hover de la gráfica de línea */
.m-chart { position: relative; }
.m-hit { fill: transparent; cursor: crosshair; }
.m-guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; transition: opacity 0.12s ease; pointer-events: none; }
.m-hi { opacity: 0; transition: opacity 0.12s ease; pointer-events: none; stroke: #fff; stroke-width: 1.5; }
.m-hi-calls { fill: #2e4a5a; }
.m-hi-leads { fill: var(--accent); }
.m-tip {
  position: absolute;
  top: 6px;
  z-index: 5;
  pointer-events: none;
  background: var(--stage);
  color: #fff;
  border: 1px solid #23272f;
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 0.78rem;
  line-height: 1.5;
  box-shadow: 0 10px 24px rgba(10, 12, 16, 0.28);
  white-space: nowrap;
}
.m-tip b { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; color: #c9ccd2; margin-bottom: 4px; }
.m-tip span { display: flex; align-items: center; gap: 7px; }
.m-tip em { margin-left: auto; font-style: normal; font-family: var(--mono); font-weight: 700; padding-left: 12px; }
.m-tip i { width: 10px; height: 2px; border-radius: 2px; display: inline-block; }
.m-tip i.tc { background: #8b9bb0; }
.m-tip i.tl { background: #ff6b6b; }

/* Vistas / pestañas */
#dash:not([hidden]) { display: grid; gap: 20px; }
.m-view { display: grid; gap: 20px; align-content: start; }
.m-view[hidden] { display: none; }
.m-collapse-count {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: #fbeaea;
  border-radius: 999px;
  padding: 2px 9px;
}

/* Resumen: leads recientes */
.m-recent .transcript-head { align-items: center; }
.m-seeall {
  font-size: 0.82rem; font-weight: 600; color: var(--accent);
  text-decoration: none; white-space: nowrap;
}
.m-seeall:hover { text-decoration: underline; }
.m-recent-list { display: grid; gap: 2px; }
.m-recent-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 11px 6px;
  border-top: 1px solid var(--line);
}
.m-recent-item:first-child { border-top: none; }
.m-recent-main { display: grid; gap: 2px; min-width: 0; }
.m-recent-main strong { font-size: 0.95rem; }
.m-recent-main small { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-recent-cita { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

/* Leads: Resumen CRM (tabla + detalle) */
.m-crm { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.m-crm-list { padding: 20px 22px; min-width: 0; }
.m-crm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.m-crm-head h2 { margin: 0; }
.m-crm-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.m-filters { display: flex; gap: 6px; }
.m-chip {
  min-height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.m-chip:hover { border-color: var(--accent); color: var(--accent); }
.m-chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-search { max-width: 260px; min-height: 36px; padding: 8px 12px; }
.m-crm-table th, .m-crm-table td { padding: 9px 8px; vertical-align: middle; }
.m-crm-row { cursor: pointer; transition: background 0.12s ease; }
.m-crm-row:hover { background: #fafafb; }
.m-crm-row.is-sel { background: #fbeaea; }
.m-cell-name { font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-cell-int { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

.m-crm-detail { padding: 20px 22px; position: sticky; top: 26px; align-self: start; }
.m-detail-empty { color: var(--muted); font-size: 0.9rem; margin: 0; }
.m-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.m-detail-head h3 { margin: 0; font-size: 1.05rem; }
.m-crm-detail .lead-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.9rem;
}
.m-crm-detail .lead-row span { color: var(--muted); }
.m-crm-detail .lead-row b { text-align: right; }
.m-crm-detail .lead-row.cita b { color: var(--accent); }
.m-crm-detail .lead-note {
  margin: 12px 0 0; padding: 11px 13px; border-radius: 10px;
  background: var(--soft); color: var(--ink); font-size: 0.86rem; line-height: 1.5;
}
.m-crm-detail footer { margin-top: 14px; font-size: 0.85rem; font-weight: 600; }
.m-crm-detail footer.ok { color: #16794c; }
.m-crm-detail footer.muted { color: var(--muted); }

@media (max-width: 1000px) {
  .m-crm { grid-template-columns: minmax(0, 1fr); }
  .m-crm-detail { position: static; }
  .metrics-shell { grid-template-columns: 1fr; }
  .m-sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 14px; border-right: none; border-bottom: 1px solid var(--line);
  }
  .m-brand { margin-bottom: 0; }
  .m-nav { grid-auto-flow: column; }
  .m-console-cta { margin: 0 0 0 auto; }
  .m-hero { grid-template-columns: 1fr; gap: 20px; }
  .m-charts { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .m-main { padding: 18px 16px 44px; }
  .m-strip { grid-template-columns: repeat(2, 1fr); }
  .m-hero-num { font-size: 3rem; }
  .m-nav a { padding: 7px 9px; font-size: 0.82rem; }
  /* Evita el overflow horizontal: la barra superior envuelve y el input ocupa el ancho. */
  .m-topbar { flex-wrap: wrap; }
  .m-topbar-right { width: 100%; }
  .token-input { width: 100%; }
  /* Causa raíz del overflow: el sidebar en banda horizontal no cabe en 390px.
     Que envuelva y la nav + CTA ocupen el ancho completo. */
  .m-sidebar { flex-wrap: wrap; height: auto; }
  .m-nav { grid-auto-flow: row; grid-template-columns: 1fr 1fr; width: 100%; }
  .m-console-cta { margin: 0; width: 100%; }
}

/* ==========================================================================
   Algoritmo · Cómo razona Navi  (página /algoritmo.html)
   Todas las clases con prefijo .alg- para no pisar nada existente.
   ========================================================================== */
.alg-body {
  background: #fff;
}

/* ---- Nav sticky ---- */
.alg-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 13px 24px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.alg-nav .brandmark { gap: 12px; }
.alg-nav .brand-sub { font-size: 0.9rem; }
.alg-nav-links { display: flex; gap: 8px; }

/* ---- Layout base ---- */
.alg-wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 24px;
}
.alg-section { padding: 88px 0; }
.alg-section + .alg-section { border-top: 1px solid var(--line); }
.alg-dark {
  background: radial-gradient(130% 120% at 15% 0%, #23272f 0%, var(--stage) 62%);
  color: #e8eaee;
  border-top: none !important;
}
.alg-tint { background: #faf9f8; }

.alg-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 18px;
}
.alg-eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--accent);
}
.alg-dark .alg-eyebrow { color: #ff8a8f; }
.alg-dark .alg-eyebrow::before { background: var(--accent); }

.alg-h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-transform: none;
  color: var(--ink);
  margin: 0 0 16px;
}
.alg-dark .alg-h2 { color: #fff; }
.alg-h3 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 6px;
}
.alg-lead {
  font-size: 1.06rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 34px;
}
.alg-lead b { color: var(--ink); font-weight: 600; }
.alg-dark .alg-lead { color: #b6bcc7; }
.alg-dark .alg-lead b { color: #fff; }
.alg-mono { font-family: var(--mono); }

/* ---- Hero ---- */
.alg-hero { padding: 92px 0 72px; }
.alg-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff8a8f;
  border: 1px solid rgba(210, 38, 44, 0.4);
  background: rgba(210, 38, 44, 0.1);
  padding: 7px 13px;
  border-radius: 999px;
  margin-bottom: 26px;
}
.alg-hero-tag .live-dot { background: var(--accent); }
.alg-display {
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: #fff;
  margin: 0 0 22px;
  max-width: 16ch;
}
.alg-display em {
  font-style: normal;
  color: var(--accent);
  display: block;
}
.alg-hero-lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.55;
  color: #b6bcc7;
  max-width: 52ch;
  margin: 0 0 40px;
}
.alg-hero-lead b { color: #fff; font-weight: 600; }

.alg-souls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 40px;
}
.alg-soul {
  position: relative;
  padding: 22px 22px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.alg-soul:hover {
  transform: translateY(-3px);
  border-color: rgba(210, 38, 44, 0.5);
  background: rgba(210, 38, 44, 0.06);
}
.alg-soul-k {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ff8a8f;
  margin-bottom: 12px;
}
.alg-soul-k svg { width: 17px; height: 17px; }
.alg-soul h3 { font-size: 1.15rem; font-weight: 700; color: #fff; margin: 0 0 7px; letter-spacing: -0.01em; }
.alg-soul p { margin: 0; font-size: 0.94rem; line-height: 1.5; color: #aab0bb; }

.alg-herostrip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
}
.alg-herostrip > div {
  flex: 1 1 0;
  min-width: 150px;
  padding: 16px 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
}
.alg-herostrip > div:last-child { border-right: none; }
.alg-herostrip dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8b9099;
  margin-bottom: 6px;
}
.alg-herostrip dd {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #eef0f3;
}

/* ---- Sección Escucha: diálogo + ficha ---- */
.alg-listen {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.alg-dialog {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  background: var(--surface);
}
.alg-turn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 82%;
}
.alg-turn.navi { align-self: flex-start; }
.alg-turn.cli { align-self: flex-end; align-items: flex-end; }
.alg-who {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.alg-turn.navi .alg-who { color: var(--accent); }
.alg-bubble {
  padding: 11px 14px;
  border-radius: 13px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.alg-turn.navi .alg-bubble {
  background: #fbeaea;
  border: 1px solid #f2d3d4;
  border-top-left-radius: 4px;
  color: var(--ink);
}
.alg-turn.cli .alg-bubble {
  background: #eef2f7;
  border: 1px solid var(--line);
  border-top-right-radius: 4px;
  color: var(--ink);
}
.alg-rule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 4px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(210, 38, 44, 0.08);
  border: 1px solid rgba(210, 38, 44, 0.25);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.alg-ficha {
  position: sticky;
  top: 78px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 18px 20px;
  box-shadow: 0 10px 28px rgba(28, 39, 52, 0.06);
}
.alg-ficha-head {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.alg-ficha-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.alg-ficha-row:last-child { border-bottom: none; }
.alg-ficha-row .k { color: var(--muted); }
.alg-ficha-row .v { font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 7px; }
.alg-ficha-row.wait .v { color: var(--muted); font-weight: 500; }
.alg-check {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--ok); color: #fff;
  display: inline-grid; place-items: center;
  font-size: 0.62rem; flex: 0 0 auto;
}
.alg-dots { color: var(--muted); font-family: var(--mono); letter-spacing: 0.1em; }
.alg-signal {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f4f5f7;
  border-left: 3px solid var(--accent);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink);
}
.alg-signal b { color: var(--accent); }

/* ---- Sección Motor de afinidad ---- */
.alg-example {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  margin-bottom: 30px;
}
.alg-example .ask {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-right: 1px solid var(--line);
  padding-right: 18px;
}
.alg-example p { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--ink); }
.alg-example .no { color: var(--accent); font-weight: 700; }
.alg-example b { font-weight: 600; }

.alg-pipe {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 26px;
}
.alg-pipe-col { display: grid; gap: 10px; align-content: start; }
.alg-pipe-cap {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.alg-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.alg-chip {
  font-family: var(--mono);
  font-size: 0.76rem;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.alg-chip.hard {
  border-color: rgba(46, 74, 90, 0.35);
  background: rgba(46, 74, 90, 0.08);
  color: #294555;
  font-weight: 600;
}
.alg-hard-note { font-size: 0.82rem; color: var(--muted); line-height: 1.45; margin: 4px 0 0; }
.alg-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 1.4rem;
}
@media (max-width: 720px) { .alg-arrow { transform: rotate(90deg); } }

/* Panel oscuro con la fórmula de score */
.alg-formula {
  border-radius: 16px;
  background: radial-gradient(130% 130% at 10% 0%, #23272f 0%, var(--stage) 65%);
  border: 1px solid #23272f;
  color: #e8eaee;
  padding: 26px 28px;
  box-shadow: 0 16px 34px rgba(10, 12, 16, 0.2);
  margin-bottom: 30px;
}
.alg-formula-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.alg-formula-head .t {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff8a8f;
}
.alg-formula-head .s { font-family: var(--mono); font-size: 0.76rem; color: #9aa0ac; }
.alg-terms { display: grid; gap: 8px; }
.alg-term {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.alg-term .op { font-family: var(--mono); color: #ff8a8f; font-weight: 700; text-align: center; }
.alg-term .expr { font-family: var(--mono); font-size: 0.86rem; color: #eef0f3; }
.alg-term .expr small { color: #9aa0ac; font-size: 0.78rem; }
.alg-term .w {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: rgba(210, 38, 44, 0.25);
  border: 1px solid rgba(210, 38, 44, 0.4);
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
}
.alg-formula-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #c5cad2;
}
.alg-formula-foot .sep { color: var(--accent); }
.alg-formula-foot b { color: #fff; }

/* Umbral / 3 casos */
.alg-meter {
  position: relative;
  height: 8px;
  border-radius: 999px;
  margin: 8px 0 28px;
  background: linear-gradient(90deg, var(--ok) 0%, var(--ok) 16%, var(--accent) 16%, var(--accent) 62%, #8892a0 62%, #8892a0 100%);
}
.alg-meter-mark {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  text-align: center;
}
.alg-meter-mark::before {
  content: "";
  display: block;
  width: 2px;
  height: 20px;
  margin: 0 auto;
  background: var(--ink);
  opacity: 0.55;
}
.alg-meter-mark span {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}
.alg-cases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.alg-case {
  border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  border-radius: 13px;
  padding: 18px 18px 20px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.alg-case.exacto { border-top-color: var(--ok); }
.alg-case.cercano { border-top-color: var(--accent); }
.alg-case.lejano { border-top-color: #8892a0; }
.alg-case-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.alg-case-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.alg-case.exacto .alg-case-name { color: var(--ok); }
.alg-case.cercano .alg-case-name { color: var(--accent); }
.alg-case.lejano .alg-case-name { color: #5c6470; }
.alg-case-range {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f4f5f7;
  color: var(--muted);
}
.alg-case p { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--muted); }
.alg-case p b { color: var(--ink); font-weight: 600; }
.alg-quote {
  margin-top: 4px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #fbeaea;
  border-left: 3px solid var(--accent);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink);
  font-style: italic;
}

/* ---- Sección Cierre (timeline) ---- */
.alg-timeline {
  display: grid;
  gap: 0;
  position: relative;
  max-width: 720px;
}
.alg-step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 18px;
  padding-bottom: 26px;
  position: relative;
}
.alg-step:last-child { padding-bottom: 0; }
.alg-step::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(210, 38, 44, 0.18));
}
.alg-step:last-child::before { display: none; }
.alg-step-n {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  background: #fbeaea;
  border: 1.5px solid rgba(210, 38, 44, 0.4);
  z-index: 1;
}
.alg-step-body { padding-top: 5px; }
.alg-step-body p { margin: 0; font-size: 0.94rem; line-height: 1.55; color: var(--muted); }
.alg-step-body p b { color: var(--ink); font-weight: 600; }

/* ---- Sección Registra (cierre oscuro) ---- */
.alg-outcomes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 34px;
}
.alg-outcome {
  padding: 22px 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}
.alg-outcome-k {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ff8a8f;
  margin-bottom: 12px;
}
.alg-outcome-k svg { width: 16px; height: 16px; }
.alg-outcome h3 { font-size: 1.05rem; color: #fff; margin: 0 0 8px; font-weight: 700; }
.alg-outcome p { margin: 0; font-size: 0.9rem; line-height: 1.5; color: #aab0bb; }
.alg-temps { display: flex; gap: 7px; margin-top: 12px; }
.alg-outcome .alg-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.alg-outcome .alg-fields span {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cdd2da;
}
.alg-cta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.alg-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.alg-cta:hover { background: var(--accent-dark); transform: translateY(-1px); }
.alg-cta-note { font-size: 0.86rem; color: #9aa0ac; max-width: 34ch; line-height: 1.45; }

/* ---- Footer ---- */
.alg-foot {
  padding: 26px 24px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ---- Motion: reveal on scroll ---- */
.alg-rv {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.6, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.alg-rv.in { opacity: 1; transform: none; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .alg-listen { grid-template-columns: 1fr; }
  .alg-ficha { position: static; }
  .alg-pipe { grid-template-columns: 1fr; }
  .alg-cases { grid-template-columns: 1fr; }
  .alg-outcomes { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .alg-section { padding: 60px 0; }
  .alg-hero { padding: 66px 0 54px; }
  .alg-souls { grid-template-columns: 1fr; }
  .alg-herostrip > div { min-width: 50%; }
  .alg-example { grid-template-columns: 1fr; gap: 12px; }
  .alg-example .ask { border-right: none; border-bottom: 1px solid var(--line); padding: 0 0 12px; }
  .alg-turn { max-width: 92%; }
  .alg-formula { padding: 20px; }
  .alg-term { grid-template-columns: 18px 1fr; }
  .alg-term .w { grid-column: 2; justify-self: start; margin-top: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .alg-rv { opacity: 1; transform: none; transition: none; }
  .alg-soul:hover, .alg-cta:hover { transform: none; }
}

/* ============================================================
   Repaso premium — Consola de voz (scopeado a .console-body).
   No toca métricas, análisis ni "¿Cómo funciona?".
   Principio: superficies tonales + sombra en vez de bordes 1px;
   rojo ATISA como acento con propósito, no línea en cada caja;
   titulares con Space Grotesk; el escenario en vivo manda.
   ============================================================ */
.console-body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(130% 70% at 50% -12%, #ffffff 0%, #eceef2 58%, #e7e9ee 100%);
}

/* Titulares con carácter */
.console-body .brand-sub {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.005em;
}

/* Encabezados de sección: etiqueta de centro de control, limpia */
.console-body .transcript-head h2,
.console-body .tele-panel h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* --- Superficies tonales: fuera bordes 1px y las líneas rojas repetidas --- */
.console-body .panel {
  border: none;
  box-shadow: 0 1px 2px rgba(20, 24, 29, 0.04), 0 14px 34px rgba(20, 24, 29, 0.06);
}
.console-body .journey-panel,
.console-body .tech-panel,
.console-body .config-panel {
  border-top: none;
}
.console-body .command-bar {
  border: none;
  box-shadow: 0 1px 2px rgba(20, 24, 29, 0.04), 0 12px 30px rgba(20, 24, 29, 0.06);
}
.console-body .status-card {
  border: none;
  background: #f3f4f7;
}
.console-body .transcript {
  border: none;
  background: #f6f7f9;
}
.console-body .tele-list.compact > div {
  border-bottom-color: #eef0f3;
}

/* --- El escenario en vivo es el héroe: más alto y cinematográfico --- */
.console-body .wave-strip {
  padding: 22px 24px;
  min-height: 132px;
  border: none;
  background:
    radial-gradient(140% 220% at 22% 0%, #262b34 0%, var(--stage) 68%);
  box-shadow: 0 22px 50px rgba(10, 12, 16, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.console-body .live-tag {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* --- Botones y chips: acabado más premium --- */
.console-body button {
  border-radius: 10px;
  min-height: 44px;
}
.console-body .back-link {
  border: none;
  background: #f0f1f4;
  color: var(--muted);
}
.console-body .back-link:hover {
  background: #e7e9ee;
  color: var(--accent);
}

/* --- Disclosure de ajustes: separado por tono, no por borde --- */
.console-body .advanced {
  margin-top: 4px;
  border-top: 1px solid #eef0f3;
  padding-top: 12px;
}
.console-body .advanced summary {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  cursor: pointer;
}

/* --- Twilio: quitar el borde superior, separar por tono --- */
.console-body .twilio-next {
  border-top: none;
  background: #f6f7f9;
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
}

/* Titulares con carácter (Space Grotesk) en las páginas fuera de consola,
   coherente con el repaso de la consola. El número mono de conversión no se toca. */
.m-topbar h1,
.alg-display,
.alg-h2 { font-family: var(--display); }

/* ---------- Detalle de llamada (drawer con transcript) ---------- */
.call-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.call-drawer[hidden] {
  display: none;
}

.call-drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(16, 18, 22, 0.5);
  backdrop-filter: blur(2px);
}

.call-drawer-panel {
  position: relative;
  width: min(560px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  box-shadow: -18px 0 44px rgba(16, 18, 22, 0.2);
  padding: 26px 26px 40px;
  animation: call-slide 0.22s ease;
}

@keyframes call-slide {
  from { transform: translateX(24px); opacity: 0.4; }
  to { transform: translateX(0); opacity: 1; }
}

.call-drawer-x {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  background: #f4f6f9;
  color: var(--muted);
  font-size: 0.9rem;
}

.call-drawer-x:hover { background: #e9edf3; color: var(--ink); }

.call-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-right: 34px;
  margin-bottom: 18px;
}

.call-detail-head h3 {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 2px;
}

.call-detail-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.call-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.call-metric {
  background: #f6f7f9;
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
}

.call-metric span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.call-metric b {
  font-size: 1rem;
  color: var(--ink);
}

.call-summary {
  background: rgba(210, 38, 44, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 18px;
}

.call-lead h4,
.call-convo h4 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.call-lead {
  margin-bottom: 22px;
}

.call-convo {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.call-transcript {
  display: grid;
  gap: 8px;
}

.call-turn {
  margin: 0;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 90%;
}

.call-turn strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
  opacity: 0.7;
}

.call-turn-nav {
  background: #eef1f6;
  color: var(--ink);
  justify-self: start;
  border-bottom-left-radius: 4px;
}

.call-turn-cli {
  background: var(--accent);
  color: #fff;
  justify-self: end;
  border-bottom-right-radius: 4px;
}

.call-turn-cli strong { opacity: 0.85; }

.call-detail-state {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 8px 0;
}

.call-detail-state.fail { color: var(--danger); }

.m-call-row { cursor: pointer; transition: background 0.12s ease; }
.m-call-row:hover,
.m-call-row:focus-visible { background: #f4f6f9; outline: none; }

@media (max-width: 560px) {
  .call-drawer-panel { padding: 22px 16px 32px; }
}

/* ---------- Análisis IA por llamada ---------- */
.call-analysis { margin-bottom: 20px; }

.call-analyze-btn {
  width: 100%;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 12px;
  font-weight: 600;
}
.call-analyze-btn:hover:not(:disabled) { background: #000; }

.ca-card {
  background: #f6f7f9;
  border-radius: 14px;
  padding: 16px 16px 14px;
  display: grid;
  gap: 12px;
}

.ca-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ca-head h4 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}

.ca-score {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e6e9ee;
  color: var(--ink);
}
.ca-score-1, .ca-score-2 { background: rgba(210, 38, 44, 0.14); color: var(--accent); }
.ca-score-3 { background: rgba(214, 158, 46, 0.18); color: #9a6b12; }
.ca-score-4, .ca-score-5 { background: rgba(30, 140, 90, 0.16); color: #1a7a4d; }

.ca-result {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.5;
}

.ca-list { display: grid; gap: 5px; }
.ca-list > span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.ca-list ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.ca-list li { color: var(--ink); font-size: 0.9rem; line-height: 1.4; }

.ca-flow {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
}
.ca-flow.ok { background: rgba(30, 140, 90, 0.1); }
.ca-flow.warn { background: rgba(214, 158, 46, 0.14); }
.ca-flow strong { font-size: 0.9rem; color: var(--ink); }
.ca-flow span { font-size: 0.88rem; color: var(--muted); line-height: 1.4; }

.ca-meta {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: right;
}

/* ---------- Insights agregados ---------- */
.ins-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.ins-head h2 { margin: 0 0 4px; }
.ins-sub { color: var(--muted); font-size: 0.92rem; line-height: 1.5; margin: 0; max-width: 52ch; }
.ins-head button { flex: none; }

.ins-meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 16px; }

.ins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

.ins-block {
  background: #f6f7f9;
  border-radius: 14px;
  padding: 16px 18px;
}
.ins-block h3 {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
}
.ins-block p { margin: 0; color: var(--ink); font-size: 0.92rem; line-height: 1.5; }
.ins-block ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.ins-block li { color: var(--ink); font-size: 0.92rem; line-height: 1.45; }
