/* ==========================================================================
   VOXNIAC ONE — Live Call UI stylesheet
   Warm cream + terracotta palette (Space Grotesk / Inter / JetBrains Mono)
   ========================================================================== */
:root {
  /* Phase 3 final (Etapa A): tokens ported from frontend-stich/DESIGN.md's
     "Technical Warmth Console" system — primary/primary-container roles
     (#a63818 / #c7502e), ink-at-10%-opacity card borders (Level 1 elevation),
     1rem radius for major sections. The warm cream bg + charcoal ink were
     already this exact palette before Etapa A, so only accent/border/radius
     change here — no Tailwind, no new fonts, no CDN. */
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface2: #fbf5ec;
  --border: rgba(43, 36, 32, .1);
  --border-glow: rgba(199, 80, 46, .4);
  --accent: #c7502e;
  --accent2: #a63818;
  --success: #4a9b5e;
  --warning: #c9821f;
  --danger: #d64545;
  --text: #2b2420;
  --muted: #8a7d6c;
  --muted-cream: #e8d9c3;
  --radius: 16px;
  --radius-sm: 8px;
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  padding: 20px;
  max-width: 1280px;
  margin: 0 auto;
  background:
    radial-gradient(1100px 560px at 50% -8%, rgba(199, 80, 46, .10), transparent 62%),
    radial-gradient(900px 500px at 100% 110%, rgba(74, 155, 94, .05), transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
}

::selection { background: var(--accent2); color: #fff; }

/* ── HEADER ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  /* DESIGN.md: "No gradients" — flat primary fill, same as every real button */
  background: var(--accent2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 20px rgba(166, 56, 24, .28);
  flex-shrink: 0;
}

.logo-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .4px;
}

.logo-sub {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .9px;
  margin-top: 2px;
  font-weight: 500;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: all .3s;
  flex-shrink: 0;
}

.dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 155, 94, .6);
}

.dot.in-call {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(199, 80, 46, .6);
  animation: callPulse .8s ease-in-out infinite;
}

.dot.speaking {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: speakingPulse .6s ease-in-out infinite;
}

@keyframes callPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

@keyframes speakingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ── CONTROL ROOM LAYOUT (Phase 3.6): sidebar + active-layer stage ── */
.control-room {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  min-width: 0;
}

.pipeline-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .06);
}

.pipeline-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  padding: 2px 10px 10px;
}

.pipeline-items {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Subtle vertical line connecting the numbered badges — DESIGN.md's
   "Pipeline Connector": 1px, 20% opacity Charcoal */
.pipeline-items::before {
  content: '';
  position: absolute;
  left: 25px;
  top: 22px;
  bottom: 22px;
  width: 1px;
  background: rgba(43, 36, 32, .2);
  z-index: 0;
}

.pipeline-item {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  color: var(--text);
  transition: background .15s ease, border-color .15s ease;
}

.pipeline-item:hover {
  background: var(--surface2);
}

.pipeline-item.active {
  background: var(--muted-cream);
  border-color: var(--border-glow);
}

.pipeline-badge {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  transition: all .15s ease;
}

.pipeline-item.active .pipeline-badge {
  background: var(--accent);
  border-color: var(--accent2);
  color: #fff;
}

.pipeline-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}

.pipeline-item.active .pipeline-name {
  color: var(--accent2);
}

.pipeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: all .2s ease;
}

/* Set by app.js when a Twilio monitor event arrives while the user is on a
   different layer (see handleMonitorEvent's "Control Room" note) */
.pipeline-dot.active-alert {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(199, 80, 46, .6);
  animation: callPulse .8s ease-in-out infinite;
}

.layer-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.layer-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.layer-panel.active {
  display: flex;
}

.layer-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.layer-panel-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .2px;
}

@media (max-width: 900px) {
  .control-room {
    flex-direction: column;
  }
  .pipeline-sidebar {
    width: 100%;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px;
  }
  .pipeline-title {
    display: none;
  }
  .pipeline-items {
    flex: 1;
    flex-direction: row;
    gap: 6px;
  }
  .pipeline-items::before {
    display: none;
  }
  .pipeline-item {
    flex: 1;
    flex-direction: column;
    gap: 6px;
    padding: 8px 4px;
    text-align: center;
  }
  .pipeline-name {
    font-size: 10px;
    line-height: 1.25;
  }
  /* Etapa B: Agent Setup's chat + Profile Editor split collapses to a
     single column under 900px */
  .agent-setup-split {
    flex-direction: column;
  }
  .profile-editor {
    max-height: none;
  }
}

/* ── AGENT SETUP (interviewer) panel ── */
.state-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.state-badge.INTERVIEWING {
  background: rgba(199, 80, 46, .10);
  color: var(--accent2);
  border-color: var(--border-glow);
}

.state-badge.REVIEWING_PLAN {
  background: rgba(201, 130, 31, .12);
  color: var(--warning);
  border-color: var(--warning);
}

.state-badge.APPROVED {
  background: rgba(74, 155, 94, .12);
  color: var(--success);
  border-color: var(--success);
}

/* Etapa B: Agent Setup splits into chat (left) + Profile Editor (right) */
.agent-setup-split {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.agent-setup-split > .interview-panel,
.agent-setup-split > .profile-editor {
  flex: 1;
  min-width: 0;
}

.interview-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 720px;
  overflow-y: auto;
}

.profile-editor::-webkit-scrollbar {
  width: 6px;
}

.profile-editor::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.profile-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.profile-editor-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}

.profile-editor-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.profile-editor-row > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-textarea,
.profile-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
}

.profile-textarea {
  resize: vertical;
}

.profile-textarea:focus,
.profile-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(199, 80, 46, .12);
}

.profile-textarea-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.profile-save-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-display);
  cursor: pointer;
  transition: opacity .15s ease;
}

.profile-save-btn:hover:not(:disabled) {
  opacity: .88;
}

.profile-save-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.profile-editor-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
}

.interview-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 2px;
}

.interview-messages::-webkit-scrollbar {
  width: 6px;
}

.interview-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.interview-bubble {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.interview-bubble.assistant {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
}

.interview-bubble.user {
  align-self: flex-end;
  background: var(--muted-cream);
  color: #5a4e42;
}

.interview-bubble.partial {
  font-style: italic;
  opacity: .75;
}

.interview-plan-preview {
  align-self: stretch;
  background: var(--surface2);
  border: 1px solid var(--border-glow);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text);
  max-height: 260px;
  overflow-y: auto;
}

/* Phase 3.5 P2: interviewer model select (120B quality / 20B fast) */
.interview-model-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.interview-model-row select {
  flex: 1;
}

.interview-input-row {
  display: flex;
  gap: 8px;
}

/* Phase 3.5 P2: voice-note mic button */
.interview-mic-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}

.interview-mic-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(199, 80, 46, .08);
}

.interview-mic-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.interview-mic-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: micPulse .8s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 69, 69, .5); }
  50% { box-shadow: 0 0 0 8px rgba(214, 69, 69, 0); }
}

.interview-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}

.interview-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(199, 80, 46, .12);
}

.interview-input:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.interview-send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  transition: opacity .15s ease;
}

.interview-send-btn:hover:not(:disabled) {
  opacity: .88;
}

.interview-send-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.interview-controls {
  display: flex;
  gap: 8px;
}

.interview-ctrl-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .4px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  transition: all .15s ease;
}

.interview-ctrl-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.interview-ctrl-btn.approve:not(:disabled) {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.interview-ctrl-btn.adjust:not(:disabled) {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}

.interview-ctrl-btn.reset {
  background: var(--surface2);
  color: var(--danger);
  border-color: var(--danger);
}

.interview-ctrl-btn.reload {
  background: var(--surface2);
  color: var(--accent2);
  border-color: var(--accent);
}

.interview-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
}

/* Phase 3.5 QA fix: "Reload profile" button status line */
.profile-reload-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
}

.profile-reload-status.status-ok {
  color: var(--success);
  font-weight: 600;
}

.profile-reload-status.status-error {
  color: var(--danger);
  font-weight: 600;
}

/* ── CALL A PROSPECT CARD ── */
.prospect-call-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .06);
}

.prospect-call-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tunnel-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.prospect-call-row {
  display: flex;
  gap: 8px;
}

.prospect-phone-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: var(--font-mono);
  outline: none;
}

.prospect-phone-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(199, 80, 46, .12);
}

.prospect-call-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-display);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s ease;
}

.prospect-call-btn:hover:not(:disabled) {
  opacity: .88;
}

.prospect-call-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.prospect-call-result {
  min-height: 16px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--muted);
}

.prospect-call-result.ok {
  color: var(--success);
}

.prospect-call-result.error {
  color: var(--danger);
}

/* Phase 3.5 P1: live call monitor status + transcript */
.prospect-call-status {
  min-height: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent2);
}

.prospect-transcript-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.prospect-transcript-header {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.prospect-transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 2px;
}

/* ── LLM SELECTOR ── */
.llm-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .06);
}

.field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
}

select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13.5px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(199, 80, 46, .12);
}

select:disabled {
  opacity: .5;
  cursor: not-allowed;
}

select option:disabled {
  color: #bbae9a;
}

/* ── AGENT OPENING PANEL ── */
.agent-opening-panel {
  background: var(--surface);
  border: 1px solid var(--border-glow);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 0 20px rgba(199, 80, 46, .08);
}

.agent-opening-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--accent2);
}

.agent-opening-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
}

/* ── CALL BUTTON PANEL ── */
.call-button-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .06);
}

.call-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-display);
  user-select: none;
  transition: all .2s ease;
  position: relative;
}

.call-btn:hover:not(:disabled) {
  background: rgba(199, 80, 46, .08);
  transform: scale(1.05);
}

.call-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.call-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent2);
  box-shadow: 0 0 28px rgba(199, 80, 46, .4);
  animation: callActive 1.4s ease-in-out infinite;
}

@keyframes callActive {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(199, 80, 46, .4);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(199, 80, 46, 0);
  }
}

.call-hint {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* ── TRANSCRIPT PANEL ── */
.transcript-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .06);
}

.transcript-panel::-webkit-scrollbar {
  width: 6px;
}

.transcript-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.transcript-header {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transcript-bubble {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}

.transcript-speaker {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}

.transcript-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
}

/* User message: right-aligned, muted cream background */
.transcript-bubble.user .transcript-text {
  background: var(--muted-cream);
  color: #5a4e42;
  margin-left: auto;
  max-width: 80%;
  text-align: right;
}

/* User partial: italic, muted */
.transcript-bubble.user.partial .transcript-text {
  font-style: italic;
  opacity: .7;
}

/* Agent message: left-aligned, white with terracotta left border */
.transcript-bubble.agent .transcript-text {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  max-width: 80%;
}

/* Agent partial: italic, muted */
.transcript-bubble.agent.partial .transcript-text {
  font-style: italic;
  opacity: .7;
}

/* ── LATENCY GRID ── */
.latency-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.latency-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--accent);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .05);
}

.latency-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent2);
}

.latency-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
}

/* ── STATUS AREA ── */
.status-area {
  min-height: 20px;
  font-size: 13px;
  padding: 4px 2px;
}

.status-ok {
  color: var(--success);
}

.status-error {
  color: var(--danger);
  font-weight: 600;
}

.status-info {
  color: var(--muted);
}

/* ── HISTORY TABLE ── */
.history-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .06);
}

.history-panel::-webkit-scrollbar {
  width: 6px;
}

.history-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.history-header {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-family: var(--font-mono);
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: .5px;
  position: sticky;
  top: 0;
  background: var(--surface);
  font-family: var(--font-body);
}

tbody tr:hover {
  background: rgba(199, 80, 46, .04);
}

/* ── RESPONSIVE ── */
@media (max-width: 720px) {
  .latency-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .call-btn {
    width: 100px;
    height: 100px;
    font-size: 16px;
  }
  .transcript-panel {
    max-height: 300px;
  }
  .history-panel {
    max-height: 240px;
  }
}

/* ==========================================================================
   LAYER 4 — CAMPAIGNS (Phase 4 Etapa C)
   Visual reference: frontend-stich/stitch_output/capa_4_campaigns/ (Stitch
   SDK output, Tailwind CDN) — layout/spacing ideas ported to this file's own
   classes/tokens; none of that file's markup or CDN was reused (PLAN_FASE4_
   CAMPAIGNS.md's rule of hierro).
   ========================================================================== */
.campaigns-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .06);
}

.campaigns-counters {
  display: flex;
  gap: 22px;
}

.campaigns-counter {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.campaigns-counter-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  color: var(--muted);
}

.campaigns-counter-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.campaigns-counter.hot .campaigns-counter-value {
  color: var(--accent2);
}

.campaigns-counter.warm .campaigns-counter-value {
  color: var(--warning);
}

.campaigns-counter.cold .campaigns-counter-value {
  color: var(--muted);
}

.campaigns-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* DEMO SAFE MODE badge — reuses the same pulsing-dot pattern as .dot.in-call
   (callPulse keyframes, already defined above) instead of inventing a new
   animation. */
.demo-safe-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(199, 80, 46, .10);
  border: 1px solid var(--border-glow);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--accent2);
}

.demo-safe-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(199, 80, 46, .6);
  animation: callPulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

.demo-safe-badge.off {
  background: rgba(214, 69, 69, .10);
  border-color: var(--danger);
  color: var(--danger);
}

.demo-safe-badge.off .demo-safe-dot {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(214, 69, 69, .6);
  animation: none;
}

.leads-import-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-display);
  cursor: pointer;
  transition: opacity .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leads-import-btn:hover {
  opacity: .88;
}

.leads-import-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
  padding: 0 2px;
}

.leads-import-status.status-ok {
  color: var(--success);
  font-weight: 600;
}

.leads-import-status.status-error {
  color: var(--danger);
  font-weight: 600;
}

.campaigns-grid {
  display: flex;
  align-items: stretch;
  gap: 16px;
  min-width: 0;
}

.leads-table-card,
.lead-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-shadow: 0 4px 24px rgba(140, 110, 70, .06);
}

.leads-table-card {
  flex: 1.6;
}

.lead-detail-card {
  flex: 1;
}

.leads-table-header,
.lead-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.leads-table-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.leads-table-scroll {
  max-height: 560px;
  overflow-y: auto;
}

.leads-table-scroll::-webkit-scrollbar {
  width: 6px;
}

.leads-table-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.leads-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  text-align: left;
  padding: 10px 14px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.leads-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.leads-table tbody tr {
  cursor: pointer;
  transition: background .12s ease;
}

.leads-table tbody tr:hover {
  background: var(--surface2);
}

.leads-table tbody tr.selected {
  background: var(--muted-cream);
}

.leads-table-empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  cursor: default;
}

.leads-table-empty-row:hover {
  background: transparent;
}

.lead-contact-name {
  font-weight: 600;
  color: var(--text);
}

.lead-phone-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.lead-status-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .4px;
  font-family: var(--font-mono);
  border: 1px solid transparent;
}

.lead-status-chip.COLD {
  background: var(--surface2);
  color: var(--muted);
  border-color: var(--border);
}

.lead-status-chip.WARM {
  background: rgba(201, 130, 31, .12);
  color: var(--warning);
  border-color: var(--warning);
}

.lead-status-chip.HOT {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent2);
}

.lead-detail-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.lead-detail-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: 620px;
}

.lead-detail-body::-webkit-scrollbar {
  width: 6px;
}

.lead-detail-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.lead-detail-profile {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lead-detail-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.lead-detail-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.lead-detail-field-row {
  display: flex;
  gap: 10px;
}

.lead-detail-field-row > div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lead-detail-pain-points {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lead-detail-pain-point {
  font-size: 12.5px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
}

.lead-detail-pain-points-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.lead-detail-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.lead-action-btn {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .4px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  transition: all .15s ease;
}

.lead-action-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.lead-action-btn.generate {
  border-color: var(--accent);
  color: var(--accent2);
}

.lead-action-btn.save {
  border-color: var(--success);
  color: var(--success);
}

.lead-action-btn.call:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent2);
}

.lead-detail-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
}

.lead-detail-status.status-ok {
  color: var(--success);
  font-weight: 600;
}

.lead-detail-status.status-error {
  color: var(--danger);
  font-weight: 600;
}

.lead-classification {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lead-classification-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}

.lead-transcript-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.lead-transcript-header {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.lead-transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px;
}

@media (max-width: 900px) {
  .campaigns-grid {
    flex-direction: column;
  }
  .lead-detail-body {
    max-height: none;
  }
}

/* ── INTERVIEW THOUGHT (DEEP REASONING) ── */
.interview-thought {
  background: rgba(220, 150, 60, 0.04);
  border: 1px solid rgba(220, 150, 60, 0.18);
  border-left: 3px solid rgba(220, 150, 60, 0.6);
  border-radius: 6px;
  margin: 10px 0;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.3s ease;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.interview-thought.collapsed .interview-thought-body {
  display: none;
}

.interview-thought.collapsed {
  border-left-color: rgba(220, 150, 60, 0.3);
}

.interview-thought-header {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(220, 150, 60, 0.95);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease;
}

.interview-thought-header:hover {
  color: rgba(220, 150, 60, 1);
}

.interview-thought-body {
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap;
  font-style: italic;
}

/* Pulse animation for active thoughts streaming */
.interview-thought.active .interview-thought-header::after {
  content: " ";
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: rgba(220, 150, 60, 0.8);
  border-radius: 50%;
  margin-left: 8px;
  animation: thoughtPulse 1.2s infinite ease-in-out;
}

@keyframes thoughtPulse {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
}
