:root {
  --ink: #121827;
  --muted: #607086;
  --line: #dfe6ee;
  --paper: #ffffff;
  --bg: #eef3f7;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #3156d3;
  --amber: #b7791f;
  --shadow: 0 18px 50px rgba(18, 24, 39, .10);
  --soft: 0 8px 24px rgba(18, 24, 39, .07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 3rem);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: grid;
  gap: .1rem;
}
.brand span {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: .02em;
  color: var(--teal-dark);
}
.brand small { color: var(--muted); font-weight: 700; }
nav {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
nav a {
  padding: .55rem .75rem;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 750;
}
nav a:hover { background: #e6f4f1; color: var(--teal-dark); }

main {
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
}
.hero, .result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 2rem;
  align-items: end;
  padding: clamp(2rem, 6vw, 5rem) 0 1.5rem;
}
.result-hero { grid-template-columns: 1fr; max-width: 980px; }
.eyebrow {
  margin: 0 0 .8rem;
  color: var(--teal);
  font-size: .84rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  max-width: 930px;
  font-size: clamp(2.5rem, 6vw, 5.6rem);
  line-height: .94;
  letter-spacing: 0;
}
.subtitle {
  margin: 1rem 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  line-height: 1.65;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-top: 1.35rem;
}
.hero-actions a,
.secondary-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .7rem 1rem;
  border-radius: 8px;
  border: 1px solid #b9ddd5;
  color: var(--teal-dark);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}
.secondary-button {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}
.hero-actions a:hover,
.secondary-button:hover {
  color: #fff;
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}
.principle {
  padding: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 5px solid var(--teal);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.principle strong { color: var(--teal-dark); }
.principle p { margin: .45rem 0 0; color: var(--muted); line-height: 1.6; }

.process-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .85rem;
  margin: 1rem 0 1.4rem;
}
.process-strip article {
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft);
}
.process-strip span {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  margin-bottom: .7rem;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}
.process-strip strong { display: block; margin-bottom: .35rem; }
.process-strip p { margin: 0; color: var(--muted); line-height: 1.45; font-size: .92rem; }
.process-strip.compact { margin-top: 0; }

.lab {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 1rem;
  padding-bottom: 3rem;
}
.panel {
  margin-bottom: 1rem;
  padding: 1.2rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft);
}
.panel.wide { grid-row: span 2; }
.section-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: .8rem;
  align-items: start;
  margin-bottom: 1rem;
}
.section-head > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--teal);
  border-radius: 50%;
  font-weight: 900;
}
h2 { margin: 0; font-size: 1.25rem; }
.section-head p { margin: .25rem 0 0; color: var(--muted); line-height: 1.5; }

.field {
  display: grid;
  gap: .45rem;
  margin-bottom: .95rem;
}
.field span {
  color: #243149;
  font-weight: 850;
}
textarea, input[type="text"], input[type="password"], input[type="email"] {
  width: 100%;
  resize: vertical;
  padding: .85rem;
  color: var(--ink);
  background: #fbfdff;
  border: 1px solid #ced8e4;
  border-radius: 7px;
  line-height: 1.55;
}
textarea:focus, input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus {
  outline: 3px solid rgba(15, 118, 110, .15);
  border-color: var(--teal);
}

/* ===== Login ===== */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  max-width: 400px;
  width: 100%;
}
.login-card h1 {
  margin: 0 0 .3rem;
  font-size: 1.4rem;
}
.login-card p.lead {
  margin: 0 0 1.2rem;
  color: var(--muted);
}
.login-error {
  color: #c0392b;
  font-weight: 650;
  margin-bottom: 1rem;
}
.two-col, .three-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.upload {
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: 1rem;
  text-align: center;
  border: 2px dashed #c8d5e2;
  border-radius: 8px;
  background: #f8fbfd;
  cursor: pointer;
}
.upload input { display: none; }
.upload span { font-weight: 900; color: var(--teal-dark); }
.upload small { color: var(--muted); margin-top: .2rem; }

.mode-grid, .role-grid {
  display: grid;
  gap: .65rem;
}
.mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mode-grid label, .role-check {
  display: grid;
  gap: .25rem;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
}
.mode-grid label:has(input:checked),
.role-config:has(input:checked) .role-check {
  border-color: var(--teal);
  background: #eefaf7;
}
.mode-grid input, .role-grid input { margin: 0 0 .15rem; }
.mode-grid span, .role-grid strong { font-weight: 850; }
.role-grid small { color: var(--muted); line-height: 1.45; }
.role-config {
  display: grid;
  gap: .55rem;
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.role-check {
  padding: .65rem;
}
.role-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}
.role-controls label,
.role-deep-grid label {
  display: grid;
  gap: .25rem;
}
.role-controls span,
.role-deep-grid span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.role-advanced {
  border-top: 1px solid var(--line);
  padding-top: .55rem;
}
.role-advanced summary {
  cursor: pointer;
  color: var(--teal-dark);
  font-weight: 900;
  list-style: none;
}
.role-advanced summary::-webkit-details-marker { display: none; }
.role-advanced summary::after {
  content: "Abrir";
  float: right;
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.role-advanced[open] summary::after { content: "Cerrar"; }
.role-deep-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  margin-top: .7rem;
}
.role-deep-grid .span-2 { grid-column: 1 / -1; }
select {
  width: 100%;
  min-height: 38px;
  padding: .45rem .55rem;
  color: var(--ink);
  background: #fbfdff;
  border: 1px solid #ced8e4;
  border-radius: 7px;
}
.hint {
  margin: .65rem 0 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

.submit-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 0;
}
.submit-row p { margin: 0; color: var(--muted); }
button {
  min-width: 245px;
  min-height: 56px;
  display: grid;
  place-items: center;
  gap: .1rem;
  padding: .75rem 1.2rem;
  color: #fff;
  background: var(--teal);
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}
button small { font-weight: 650; opacity: .85; }
button:hover { background: var(--teal-dark); }
button:disabled { opacity: .75; cursor: progress; }

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.card, .box, .callout, .recommendation {
  padding: 1rem;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.staged-form {
  margin-bottom: 3rem;
}
.question-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.question-card {
  display: grid;
  gap: .65rem;
  padding: 1rem;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
}
.question-card strong {
  line-height: 1.35;
}
.diagnostic-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: .85rem;
  background: #eefaf7;
  border: 1px solid #b9ddd5;
  border-radius: 8px;
}
.diagnostic-tools p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}
.card h3 { margin: 0 0 .65rem; color: var(--teal-dark); }
.agent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: -.25rem 0 .65rem;
}
.agent-meta span {
  padding: .22rem .5rem;
  border-radius: 999px;
  color: var(--teal-dark);
  background: #eefaf7;
  border: 1px solid #b9ddd5;
  font-size: .78rem;
  font-weight: 850;
}
.profile-strip {
  display: grid;
  gap: .35rem;
  margin: -.25rem 0 .75rem;
  padding: .7rem;
  background: #f6fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.profile-strip span {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.4;
}
.card p, .box p, .callout p { color: var(--muted); line-height: 1.55; }
.card p { margin: .35rem 0; }
.card.debate { border-left: 5px solid var(--blue); }
.mini {
  display: grid;
  gap: .2rem;
  padding-top: .65rem;
  margin-top: .65rem;
  border-top: 1px solid var(--line);
}
.mini strong, .box strong, .callout strong { color: #25324a; }
.mini span, .box li, .box small { color: var(--muted); line-height: 1.5; }
ul { margin: .45rem 0 0; padding-left: 1.1rem; }
.callout {
  margin-top: 1rem;
  border-left: 5px solid var(--amber);
}
.recommendation {
  margin: 1rem 0;
  background: #eefaf7;
  border-color: #b9ddd5;
}
.recommendation span {
  display: block;
  margin-bottom: .35rem;
  color: var(--teal-dark);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}
.recommendation p {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.55;
  font-weight: 750;
}
.round-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.round-card {
  padding: 1rem;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: 8px;
}
.round-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .75rem;
}
.round-top span {
  color: var(--teal-dark);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .8rem;
}
.round-top small {
  color: var(--muted);
  font-weight: 700;
}
.round-card p {
  margin: .5rem 0;
  color: var(--muted);
  line-height: 1.55;
}
.round-card strong { color: #25324a; }
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: .75rem;
  padding: .75rem 1rem;
  color: #fff;
  background: var(--teal);
  border-radius: 8px;
  font-weight: 900;
}
.button-link:hover { background: var(--teal-dark); }
.action-cards .box {
  display: grid;
  align-content: start;
  gap: .65rem;
}
.action-primary {
  border-color: #b9ddd5;
  background: #eefaf7;
}
.quick-debate textarea { min-height: 92px; }
.live-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
  margin-bottom: 3rem;
}
.live-side {
  position: sticky;
  top: 88px;
}
.speaker-list {
  display: grid;
  gap: .6rem;
  margin-bottom: 1rem;
}
.speaker-list article {
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}
.speaker-list strong,
.speaker-list small {
  display: block;
}
.speaker-list small {
  margin-top: .2rem;
  color: var(--muted);
  font-weight: 700;
}
.speaker-list p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
}
.live-main {
  min-height: 70vh;
}
.chat-thread {
  display: grid;
  gap: .85rem;
  max-height: 64vh;
  overflow: auto;
  padding: .5rem;
  margin: -.5rem -.5rem 1rem;
}
.chat-message,
.chat-empty {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}
.chat-message.human {
  margin-left: clamp(1rem, 10vw, 7rem);
  background: #eefaf7;
  border-color: #b9ddd5;
}
.chat-message.agent {
  margin-right: clamp(1rem, 8vw, 5rem);
  border-left: 5px solid var(--blue);
}
.chat-message.moderator {
  margin-inline: clamp(.5rem, 5vw, 4rem);
  background: #fff8eb;
  border-color: #f0d29b;
  border-left: 5px solid var(--amber);
}
.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .45rem;
}
.chat-meta strong { color: var(--teal-dark); }
.chat-meta small { color: var(--muted); font-weight: 700; }
.chat-message p,
.chat-empty p {
  margin: .35rem 0;
  color: var(--muted);
  line-height: 1.58;
}
.live-composer[hidden] { display: none; }
.live-composer {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.dialogue-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
.dialogue-mode label {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
}
.dialogue-mode label:has(input:checked) {
  border-color: #79bdb1;
  background: #eefaf7;
  box-shadow: inset 4px 0 0 var(--teal);
}
.dialogue-mode input {
  margin-top: .25rem;
}
.dialogue-mode strong,
.dialogue-mode small {
  display: block;
}
.dialogue-mode small {
  margin-top: .2rem;
  color: var(--muted);
  line-height: 1.35;
}
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.quick-prompts button {
  width: auto;
  padding: .55rem .7rem;
  color: var(--teal-dark);
  background: #fff;
  border: 1px solid #b9ddd5;
  font-size: .88rem;
}
.quick-prompts button:hover {
  color: #fff;
  background: var(--teal-dark);
}
.interaction-panel {
  border-color: #b9ddd5;
  box-shadow: 0 18px 50px rgba(23, 119, 98, .12);
}
.interaction-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}
.interaction-rail {
  position: sticky;
  top: 92px;
  display: grid;
  gap: .65rem;
  padding: 1rem;
  background: #eefaf7;
  border: 1px solid #b9ddd5;
  border-radius: 8px;
}
.interaction-rail strong {
  color: var(--teal-dark);
  font-weight: 900;
}
.prompt-chip {
  width: 100%;
  padding: .75rem;
  color: #25324a;
  background: #fff;
  border: 1px solid #c9ddd9;
  text-align: left;
  font-size: .9rem;
  font-weight: 800;
}
.prompt-chip:hover {
  color: var(--teal-dark);
  background: #f8fffd;
}
.interaction-workspace {
  display: grid;
  gap: 1rem;
}
.interaction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.final { margin-bottom: 3rem; }

@media (max-width: 980px) {
  .hero, .round-grid, .interaction-layout, .interaction-grid, .live-layout, .dialogue-mode { grid-template-columns: 1fr; }
  .lab, .process-strip, .three-col, .question-grid { grid-template-columns: 1fr; }
  .panel.wide { grid-row: auto; }
  .interaction-rail, .live-side { position: static; }
  .chat-thread { max-height: none; }
}

@media (max-width: 720px) {
  main { width: min(100% - 1rem, 1240px); }
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .two-col, .mode-grid, .cards, .role-deep-grid { grid-template-columns: 1fr; }
  .role-deep-grid .span-2 { grid-column: auto; }
  .submit-row { align-items: stretch; flex-direction: column; }
  button { width: 100%; }
  h1 { font-size: 2.4rem; }
}

/* ===== Modo llamada (voz) ===== */
.call-toggle-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.call-mode-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  background: var(--teal);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--soft);
}
.call-mode-btn:hover { background: var(--teal-dark); }
.call-mode-btn:disabled { opacity: .7; cursor: default; }
.call-mode-note { color: var(--muted); }

.call-panel[hidden] { display: none; }
.call-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.call-status {
  display: flex;
  align-items: center;
  gap: 14px;
}
.call-status-icon {
  font-size: 2rem;
  line-height: 1;
}
.call-status strong { display: block; font-size: 1.05rem; }
.call-status p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.call-live-transcript {
  min-height: 1.4em;
  color: var(--blue);
  font-style: italic;
  margin: 0;
}
.call-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.call-mode-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .92rem;
}
.call-hangup-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  background: #c0392b;
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}
.call-hangup-btn:hover { background: #a5301f; }
