:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #687386;
  --line: #dbe3ee;
  --accent: #0f766e;
  --accent-soft: #e6f5f3;
  --success: #137333;
  --warn: #a15c00;
  --danger: #b42318;
  --shadow: 0 22px 60px rgba(23, 32, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(220deg, rgba(46, 84, 130, 0.10), transparent 30%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

button {
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

button:hover {
  background: #0b5f59;
}

button:disabled,
input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.lede {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  min-height: 42px;
  padding: 0 36px 0 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 22px;
  align-items: stretch;
}

.chat-panel,
.lead-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 227, 238, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(360px, 52vh) auto;
  min-height: 640px;
  overflow: hidden;
}

.voice-console {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfd;
}

.voice-console h2 {
  margin-bottom: 6px;
}

.voice-agency {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.voice-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.voice-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.voice-status span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
}

.voice-status.connecting span {
  background: var(--warn);
}

.voice-status.live {
  color: var(--success);
  border-color: #b7e2c1;
  background: #f3fbf5;
}

.voice-status.live span {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(19, 115, 51, 0.12);
}

.voice-status.ended span,
.voice-status.error span {
  background: var(--danger);
}

.voice-transcript {
  min-height: 86px;
  max-height: 150px;
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  background: #ffffff;
}

.voice-transcript p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.voice-caption {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.voice-caption strong {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.voice-caption span {
  line-height: 1.45;
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 22px;
}

.message {
  width: min(78%, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff;
}

.message strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.message p {
  margin-bottom: 0;
  line-height: 1.5;
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.message.user strong {
  color: rgba(255, 255, 255, 0.78);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #f9fbfd;
}

.composer input {
  min-height: 44px;
  padding: 0 13px;
}

.lead-panel {
  padding: 20px;
}

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

.badge {
  white-space: nowrap;
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.badge.ready_to_book {
  background: #edf9ef;
  color: var(--success);
}

.badge.escalate {
  background: #fff4e6;
  color: var(--warn);
}

.lead-fields {
  display: grid;
  gap: 10px;
  margin: 0;
}

.lead-fields div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfd;
}

.lead-fields div.filled {
  border-color: #b7e2c1;
  background: #f3fbf5;
}

dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .intro {
    align-items: start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 560px;
    grid-template-rows: auto auto minmax(320px, 50vh) auto;
  }

  .voice-console {
    align-items: stretch;
    flex-direction: column;
  }

  .voice-actions {
    justify-content: flex-start;
  }

  .message {
    width: 100%;
  }

  .composer {
    grid-template-columns: 1fr;
  }
}
