:root {
  color-scheme: light;
  --page: #eef3f6;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --ink: #172033;
  --muted: #697386;
  --line: rgba(23, 32, 51, 0.12);
  --teal: #087f7a;
  --blue: #3366d6;
  --coral: #d95d45;
  --violet: #7056c7;
  --green: #0f8a55;
  --amber: #b86b00;
  --shadow: 0 18px 55px rgba(31, 45, 70, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-width: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(8, 127, 122, 0.16), transparent 30%),
    radial-gradient(circle at 84% 12%, rgba(217, 93, 69, 0.14), transparent 28%),
    linear-gradient(135deg, #eef3f6 0%, #f8fafb 48%, #eef5f1 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
}

button:hover,
a:hover {
  border-color: rgba(8, 127, 122, 0.5);
}

button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
}

.hidden {
  display: none !important;
}

.demo-auth {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 390px;
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.auth-error {
  min-height: 18px;
  margin: 0;
  color: #b42318;
  font-size: 13px;
}

.demo-stage {
  width: 100vw;
  height: 100vh;
  padding: clamp(14px, 1.5vw, 24px);
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) 132px;
  gap: 14px;
}

.stage-top,
.robot-panel,
.transcript-panel,
.patient-panel,
.result-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
}

.mini-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.mini-brand > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #163352;
  color: #ffffff;
  font-weight: 900;
}

.mini-brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.mini-brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.demo-controls {
  display: grid;
  grid-template-columns: 220px 190px 210px repeat(4, max-content);
  gap: 8px;
  align-items: center;
}

.presentation .stage-top {
  justify-content: center;
}

.presentation .demo-controls {
  display: none;
}

.stage-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) minmax(500px, 1.9fr) minmax(320px, 1.05fr);
  gap: 14px;
}

.robot-panel,
.transcript-panel,
.patient-panel {
  min-height: 0;
}

.robot-panel {
  padding: 18px;
  display: grid;
  grid-template-rows: 1fr auto auto auto auto;
  gap: 14px;
  align-items: center;
}

.robot-orb {
  width: min(29vh, 220px);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.92) 0 16%, rgba(8,127,122,0.22) 17% 35%, rgba(51,102,214,0.2) 36% 58%, rgba(255,255,255,0.3) 59% 100%);
}

.robot-orb::before,
.robot-orb::after {
  content: "";
  position: absolute;
  inset: 16%;
  border: 1px solid rgba(8, 127, 122, 0.28);
  border-radius: 50%;
}

.robot-orb::after {
  inset: 5%;
  border-color: rgba(217, 93, 69, 0.22);
  opacity: 0.7;
}

.robot-panel.speaking .robot-orb::before,
.robot-panel.listening .robot-orb::before,
.robot-panel.calling .robot-orb::before,
.robot-panel.speaking .robot-orb::after,
.robot-panel.listening .robot-orb::after,
.robot-panel.calling .robot-orb::after {
  animation: breathe 1.25s ease-in-out infinite;
}

.robot-panel.speaking .robot-orb::after,
.robot-panel.listening .robot-orb::after,
.robot-panel.calling .robot-orb::after {
  animation-delay: 0.45s;
}

.robot-orb span {
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 14px 35px rgba(8, 127, 122, 0.35);
}

.robot-orb i {
  position: absolute;
  width: 18%;
  height: 18%;
  border-radius: 50%;
  background: var(--coral);
  right: 21%;
  top: 24%;
  box-shadow: 0 8px 22px rgba(217, 93, 69, 0.32);
}

@keyframes breathe {
  0%, 100% { transform: scale(0.96); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 1; }
}

.call-state {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7fafc;
}

.call-state strong {
  font-size: 17px;
}

.call-state span {
  color: var(--teal);
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.voice-card,
.scenario-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
}

.voice-card span,
.scenario-card span,
.panel-head span,
.patient-card span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wave {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.wave b {
  width: 8px;
  height: 14px;
  border-radius: 99px;
  background: linear-gradient(var(--teal), var(--blue));
}

.robot-panel.speaking .wave b,
.robot-panel.listening .wave b,
.robot-panel.calling .wave b {
  animation: wave 1.2s ease-in-out infinite;
}

.wave b:nth-child(2) { animation-delay: 0.08s; }
.wave b:nth-child(3) { animation-delay: 0.16s; }
.wave b:nth-child(4) { animation-delay: 0.24s; }
.wave b:nth-child(5) { animation-delay: 0.32s; }
.wave b:nth-child(6) { animation-delay: 0.4s; }
.wave b:nth-child(7) { animation-delay: 0.48s; }

@keyframes wave {
  0%, 100% { height: 14px; opacity: 0.55; }
  50% { height: 42px; opacity: 1; }
}

.transcript-panel {
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.panel-head > * {
  min-width: 0;
}

.panel-head strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.panel-head small {
  color: var(--muted);
}

.panel-head.compact strong {
  font-size: 16px;
}

.story-strip {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.story-card {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(23, 32, 51, 0.1);
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  gap: 4px;
}

.story-card span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.story-card strong {
  font-size: 15px;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.story-card.status-confirmed,
.story-card.status-reschedule_confirmed,
.story-card.status-rescheduled,
.story-card.status-scheduled,
.story-card.status-waitlist_filled {
  border-color: rgba(15, 138, 85, 0.24);
  background: rgba(240, 251, 245, 0.86);
}

.story-card.status-no_show_risk,
.story-card.status-late_risk,
.story-card.status-reschedule_slot_search {
  border-color: rgba(184, 107, 0, 0.24);
  background: rgba(255, 248, 232, 0.9);
}

.variant-rail {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow: hidden;
}

.presentation .variant-rail {
  display: none;
}

.variant-rail button {
  min-width: 0;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.variant-rail button.active {
  border-color: rgba(8, 127, 122, 0.45);
  background: #e9f6f3;
  color: var(--teal);
}

.transcript-feed {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  overflow: hidden;
}

.message {
  max-width: 86%;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  animation: messageIn 420ms ease-out both;
  will-change: transform, opacity;
}

.message.bot {
  align-self: flex-start;
  background: #ffffff;
}

.message.driver {
  align-self: flex-end;
  background: #eaf6f3;
  border-color: rgba(8, 127, 122, 0.22);
}

.message.system {
  align-self: center;
  max-width: 74%;
  background: #f5f2ff;
  border-color: rgba(112, 86, 199, 0.22);
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.message p {
  margin: 0;
  font-size: clamp(17px, 1.45vw, 24px);
  line-height: 1.28;
}

@keyframes messageIn {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.patient-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
}

.patient-card {
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff, #f0f7f5);
  border: 1px solid rgba(8, 127, 122, 0.18);
}

.patient-card h2 {
  margin: 8px 0 6px;
  font-size: clamp(22px, 1.8vw, 26px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.patient-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pipeline {
  display: grid;
  gap: 8px;
}

.queue-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.queue-head span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.queue-head strong {
  font-size: 14px;
}

.queue-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.queue-item {
  min-width: 0;
  min-height: 72px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
  gap: 5px 9px;
  animation: chipIn 300ms ease-out both;
  transition:
    border-color 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease;
}

.queue-item strong,
.queue-item span,
.queue-item small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item strong {
  display: block;
  font-size: 13px;
  line-height: 1.1;
  white-space: nowrap;
}

.queue-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.queue-item b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf3f7;
  color: var(--teal);
  font-size: 16px;
}

.queue-item small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.queue-item.active {
  border-color: rgba(8, 127, 122, 0.52);
  background: #f0fbf5;
  box-shadow: 0 8px 22px rgba(8, 127, 122, 0.13);
}

.queue-item.in-call b {
  background: var(--teal);
  color: #ffffff;
}

.call-active .queue-item.in-call b,
.call-active .queue-item.active b {
  animation: pulseDot 1.25s ease-in-out infinite;
}

.queue-item.done {
  background: #f8fafb;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 1; }
}

.trigger-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.trigger-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  overflow: hidden;
}

.decision-step {
  min-height: 74px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid rgba(51, 102, 214, 0.2);
  background: #f5f8ff;
  animation: chipIn 300ms ease-out both;
  will-change: transform, opacity;
}

.decision-step b {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border-radius: 50%;
  background: #c7d5ef;
  box-shadow: 0 0 0 5px rgba(51, 102, 214, 0.08);
}

.decision-step strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.decision-step span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.decision-step small {
  display: block;
  margin-top: 4px;
  color: rgba(23, 32, 51, 0.62);
  font-size: 11px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.decision-step.done b {
  background: var(--blue);
}

.decision-step.action {
  border-color: rgba(217, 93, 69, 0.22);
  background: #fff6f2;
}

.decision-step.action b {
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(217, 93, 69, 0.09);
}

.decision-step.patch {
  border-color: rgba(15, 138, 85, 0.22);
  background: #f0fbf5;
}

.decision-step.patch b {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(15, 138, 85, 0.09);
}

@keyframes chipIn {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.result-strip {
  min-height: 0;
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.1fr;
  gap: 14px;
}

.result-card {
  min-width: 0;
  padding: 15px 16px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.result-card.primary-result {
  border-color: rgba(8, 127, 122, 0.28);
}

.result-card.status-confirmed,
.result-card.status-reschedule_confirmed,
.result-card.status-rescheduled,
.result-card.status-scheduled,
.result-card.status-waitlist_filled {
  border-color: rgba(15, 138, 85, 0.28);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(236, 251, 244, 0.92));
}

.result-card.status-no_show_risk,
.result-card.status-late_risk,
.result-card.status-reschedule_slot_search {
  border-color: rgba(184, 107, 0, 0.28);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 232, 0.94));
}

.result-card.status-needs_admin,
.result-card.status-pain_or_urgent {
  border-color: rgba(217, 93, 69, 0.3);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 244, 240, 0.94));
}

.result-card.status-confirmed strong,
.result-card.status-reschedule_confirmed strong,
.result-card.status-rescheduled strong,
.result-card.status-scheduled strong,
.result-card.status-waitlist_filled strong {
  color: var(--green);
}

.result-card.status-no_show_risk strong,
.result-card.status-late_risk strong,
.result-card.status-reschedule_slot_search strong {
  color: var(--amber);
}

.result-card.status-needs_admin strong,
.result-card.status-pain_or_urgent strong {
  color: var(--coral);
}

.result-card span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-card strong {
  font-size: clamp(18px, 1.55vw, 26px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.result-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 11px 14px;
  border-radius: 10px;
  background: #172033;
  color: #ffffff;
  box-shadow: var(--shadow);
}

@media (max-width: 1320px) {
  .demo-stage {
    grid-template-rows: 64px minmax(0, 1fr) 120px;
    gap: 10px;
  }

  .stage-grid,
  .result-strip {
    gap: 10px;
  }

  .robot-panel,
  .transcript-panel,
  .patient-panel {
    padding: 14px;
  }

  .demo-controls {
    grid-template-columns: 180px 155px 190px repeat(4, max-content);
  }
}

@media (max-width: 1100px) {
  .demo-stage {
    padding: 12px;
    grid-template-rows: 62px minmax(0, 1fr) 112px;
    gap: 10px;
  }

  .stage-top {
    padding: 10px 12px;
  }

  .stage-grid {
    grid-template-columns: minmax(170px, 0.6fr) minmax(330px, 1.45fr) minmax(250px, 0.9fr);
    gap: 10px;
  }

  .robot-panel,
  .transcript-panel,
  .patient-panel {
    padding: 12px;
  }

  .robot-panel {
    gap: 10px;
  }

  .robot-orb {
    width: min(22vh, 160px);
  }

  .call-state {
    padding: 10px;
  }

  .call-state span {
    font-size: 22px;
  }

  .voice-card,
  .scenario-card {
    padding: 9px 10px;
  }

  .message {
    max-width: 90%;
    padding: 11px 13px;
  }

  .message p {
    font-size: 18px;
  }

  .story-strip {
    gap: 8px;
  }

  .story-card {
    padding: 8px 9px;
  }

  .story-card strong {
    font-size: 13px;
  }

  .variant-rail {
    gap: 6px;
  }

  .variant-rail button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }

  .patient-card {
    padding: 12px;
  }

  .patient-card h2 {
    font-size: 21px;
  }

  .queue-list {
    gap: 6px;
  }

  .queue-item {
    min-height: 68px;
    padding: 8px;
  }

  .queue-item strong {
    font-size: 12px;
  }

  .queue-item b {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }

  .decision-step {
    min-height: 68px;
    padding: 9px;
  }

  .result-strip {
    gap: 10px;
  }

  .result-card {
    padding: 12px;
  }

  .result-card strong {
    font-size: 20px;
  }
}
