:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --panel-strong: #f8fbfa;
  --ink: #171a1f;
  --muted: #667077;
  --line: #d8ddd7;
  --accent: #0f766e;
  --accent-strong: #075e58;
  --warn: #b45309;
  --danger: #b42318;
  --danger-bg: #fff1ee;
  --shadow: 0 16px 40px rgba(28, 39, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  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);
}

button {
  min-height: 42px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
}

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

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

button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

button.danger {
  background: var(--danger-bg);
  border-color: #ffc7bf;
  color: var(--danger);
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.call-panel,
.transcript-panel,
.events-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.call-panel {
  grid-column: 1 / -1;
  padding: 20px;
}

.topbar,
.panel-header,
.field-row,
.button-row,
.stage-meta {
  display: flex;
  align-items: center;
}

.topbar,
.panel-header {
  justify-content: space-between;
  gap: 16px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  font-size: 15px;
}

.status-pill {
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  background: #ffffff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9aa3a8;
}

.status-pill.live .status-dot {
  background: var(--accent);
}

.status-pill.busy .status-dot {
  background: var(--warn);
}

.status-pill.error .status-dot {
  background: var(--danger);
}

.call-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: 16px;
}

.controls,
.stage,
.transcript-panel,
.events-panel {
  padding: 16px;
}

.controls {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-label,
.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.model-switch {
  display: grid;
  gap: 8px;
}

.model-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.model-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.model-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.model-option span {
  min-width: 0;
}

.model-option strong,
.model-option small {
  display: block;
}

.model-option strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.model-option small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.field-row {
  margin-top: 14px;
  gap: 12px;
}

.field {
  flex: 1;
  display: grid;
  gap: 7px;
}

select,
input[type="text"] {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
}

.metric {
  width: 112px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
}

.metric strong {
  font-variant-numeric: tabular-nums;
  font-size: 21px;
}

.button-row {
  margin-top: 14px;
  gap: 8px;
  flex-wrap: wrap;
}

.text-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.stage {
  min-height: 330px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(180, 83, 9, 0.07) 1px, transparent 1px),
    #fcfbf7;
  background-size: 26px 26px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 20px;
}

.voice-orb {
  width: min(380px, 80vw);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fffdf8;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.voice-orb::before,
.voice-orb::after {
  content: "";
  position: absolute;
  inset: 15%;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 50%;
}

.voice-orb::after {
  inset: 28%;
  border-color: rgba(180, 83, 9, 0.2);
}

.meter {
  width: 76%;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  z-index: 2;
}

.meter span {
  width: 7px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
  transform-origin: center;
  transition: height 80ms linear, opacity 80ms linear;
}

.meter-local {
  position: absolute;
  bottom: 58px;
  height: 42px;
  opacity: 0.75;
}

.meter-local span {
  width: 4px;
  background: var(--warn);
}

.stage-meta {
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stage-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 7px 10px;
  max-width: 220px;
  overflow-wrap: anywhere;
}

.transcript-panel,
.events-panel {
  min-height: 360px;
}

.transcript,
.event-log {
  margin-top: 12px;
  height: 300px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  line-height: 1.45;
}

.message strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.message.user strong {
  color: var(--warn);
}

.message.pending {
  color: var(--muted);
}

.event {
  border-left: 3px solid var(--line);
  background: #ffffff;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.event.error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.event.good {
  border-left-color: var(--accent);
}

@media (max-width: 860px) {
  .app-shell,
  .call-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100vw - 20px, 680px);
    padding: 10px 0;
  }

  .call-panel,
  .transcript-panel,
  .events-panel {
    box-shadow: none;
  }

  .topbar,
  .field-row {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .status-pill,
  .metric {
    width: 100%;
  }

  .button-row,
  .text-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stage {
    min-height: 270px;
  }

  .voice-orb {
    width: min(290px, 78vw);
  }
}

