:root {
  --ink: #17211b;
  --muted: #657069;
  --line: #d8ded9;
  --panel: #ffffff;
  --wash: #f5f7f1;
  --accent: #0f7b63;
  --accent-strong: #0a5c4a;
  --warm: #b94f2b;
  --gold: #d49a2a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
}

body.public-demo main {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.brand {
  font-size: 24px;
  font-weight: 800;
}

nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-weight: 650;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: end;
  gap: 28px;
  min-height: calc(100vh - 170px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--warm);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 92px);
  line-height: 0.95;
}

h2,
h3 {
  margin: 0;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.55;
}

.actions,
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.actions {
  justify-content: flex-start;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

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

.button.danger {
  border-color: #b94f2b;
  color: #8d3218;
}

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

.status-panel,
.card,
.voice-panel,
.queue,
.form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-panel {
  padding: 24px;
}

.label,
.muted {
  color: var(--muted);
}

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.list {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.card p {
  margin: 6px 0 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

.icon-button.live {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 123, 99, 0.12);
}

.form {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin-top: 28px;
  padding: 22px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 750;
}

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

textarea {
  resize: vertical;
}

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

.check input {
  width: auto;
}

.demo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
}

.public-shell {
  width: min(860px, 100%);
}

.chat-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(920px, 100%);
  min-height: calc(100vh - 32px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.call-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(520px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  color: #f8fbf8;
  background:
    radial-gradient(circle at 50% 16%, rgba(15, 123, 99, 0.55), transparent 34%),
    linear-gradient(180deg, #123429 0%, #17211b 58%, #0c120f 100%);
  overflow: hidden;
}

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

.call-top p {
  margin: 4px 0 0;
  color: rgba(248, 251, 248, 0.72);
}

.call-top .button {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.call-stage {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  min-height: 0;
  padding: 22px 24px;
  text-align: center;
}

.call-avatar {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 58px;
  font-weight: 850;
  box-shadow: 0 0 0 0 rgba(15, 123, 99, 0.45);
}

.call-shell[data-state="listening"] .call-avatar {
  animation: callPulse 1.4s ease-out infinite;
}

.call-shell[data-state="speaking"] .call-avatar {
  box-shadow: 0 0 0 10px rgba(212, 154, 42, 0.16), 0 0 0 22px rgba(212, 154, 42, 0.08);
}

.call-stage h1 {
  max-width: 100%;
  font-size: 32px;
  line-height: 1.1;
}

.call-timer {
  color: rgba(248, 251, 248, 0.66);
  font-size: 18px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.call-shell .voice-status {
  max-width: 360px;
  padding: 0;
  color: rgba(248, 251, 248, 0.78);
  font-size: 15px;
}

.call-shell .live-transcript {
  width: min(390px, 100%);
  min-height: 54px;
  max-height: 110px;
  margin: 6px 0 0;
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(248, 251, 248, 0.72);
  background: rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.call-controls {
  justify-content: center;
  padding: 18px 20px 24px;
  border-top: 0;
  background: transparent;
}

.call-controls .button {
  min-width: 128px;
  min-height: 52px;
  border-radius: 999px;
}

.call-controls .button.primary {
  border-color: #f8fbf8;
  background: #f8fbf8;
  color: #123429;
}

.call-controls .button.danger {
  border-color: #d84a36;
  background: #d84a36;
  color: #fff;
}

.debug-panel {
  margin: 0 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.debug-panel summary {
  cursor: pointer;
  padding: 12px 14px;
  color: rgba(248, 251, 248, 0.78);
  font-weight: 800;
}

.debug-panel .chat-log.public {
  max-height: 220px;
  background: transparent;
}

.debug-panel .chat-input {
  border-top-color: rgba(255, 255, 255, 0.14);
  background: transparent;
}

@keyframes callPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 123, 99, 0.45);
  }
  80% {
    box-shadow: 0 0 0 26px rgba(15, 123, 99, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 123, 99, 0);
  }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 241, 0.9);
}

.chat-header h1 {
  font-size: 28px;
  line-height: 1.1;
}

.chat-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.voice-panel,
.queue {
  padding: 24px;
}

.meter {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 72px;
  margin: 28px 0;
}

.meter span {
  display: block;
  width: 18px;
  border-radius: 8px 8px 0 0;
  background: var(--accent);
}

.meter span:nth-child(1) {
  height: 26px;
}

.meter span:nth-child(2) {
  height: 54px;
  background: var(--gold);
}

.meter span:nth-child(3) {
  height: 38px;
}

.meter span:nth-child(4) {
  height: 64px;
  background: var(--warm);
}

.empty {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.chat-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.chat-log {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.chat-log.public {
  align-content: start;
  max-height: none;
  margin: 0;
  padding: 18px;
  overflow-y: auto;
  background: var(--wash);
}

.chat-message {
  max-width: 760px;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.45;
}

.chat-message.user {
  justify-self: end;
  background: var(--accent);
  color: #fff;
}

.chat-message.agent {
  justify-self: start;
  border: 1px solid var(--line);
  background: #fff;
}

.transcript-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.transcript-row {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.transcript-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.transcript-row p {
  margin: 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.chat-input input {
  min-height: 46px;
}

.voice-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.voice-controls .button {
  min-width: 112px;
}

.live-transcript {
  margin: 10px 14px 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(245, 247, 241, 0.8);
  line-height: 1.45;
}

.voice-status {
  padding: 10px 14px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

@media (max-width: 760px) {
  .topbar,
  nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding: 16px;
  }

  .hero,
  .demo-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  h1 {
    font-size: 46px;
  }

  .chat-input {
    grid-template-columns: 1fr;
  }

  .voice-controls .button {
    flex: 1 1 140px;
  }

  .call-shell {
    width: 100%;
  }

  .call-controls .button {
    flex: 1 1 128px;
  }
}
