@import url("/tokens.css");
@import url("/ui.css");
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--tv-space-4);
  padding: var(--tv-space-5) 5%;
  border-bottom: 1px solid var(--tv-outline-variant);
  background: var(--tv-nav);
  color: var(--tv-on-nav);
}
header a {
  color: inherit;
  font-weight: 700;
}
header > span {
  font-size: var(--tv-type-caption);
  color: var(--tv-nav-muted);
}
header a:focus-visible {
  outline-color: var(--tv-nav-focus);
}
main {
  max-width: 900px;
  margin: var(--tv-space-10) auto;
  padding: 0 var(--tv-space-6);
}
h1 {
  margin: var(--tv-space-4) 0;
  font-size: var(--tv-type-headline);
}
.intro {
  max-width: 66ch;
  color: var(--tv-muted);
  line-height: var(--tv-line-body);
}
section {
  margin: var(--tv-space-6) 0;
  background: var(--tv-surface-elevated);
  border: 1px solid var(--tv-outline-variant);
  border-radius: var(--tv-radius-md);
  padding: var(--tv-space-6);
}
input {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.controls {
  display: flex;
  gap: var(--tv-space-3);
  margin-top: var(--tv-space-4);
}
#status,
footer,
.muted {
  font-size: var(--tv-type-label);
  color: var(--tv-muted);
  line-height: var(--tv-line-body);
}
#status {
  padding-top: var(--tv-space-4);
  margin: 0;
}
#transcript {
  max-height: 320px;
  overflow: auto;
  line-height: 1.7;
}
#transcript p {
  padding: var(--tv-space-3) var(--tv-space-4);
  background: var(--tv-surface-container);
  border-radius: var(--tv-radius-sm);
  white-space: pre-wrap;
}
footer {
  margin-bottom: var(--tv-space-10);
}
@media (max-width: 639px) {
  header > span {
    display: none;
  }
  main {
    margin: var(--tv-space-6) auto;
    padding: 0 var(--tv-space-4);
  }
  section {
    padding: var(--tv-space-4);
  }
  .controls {
    flex-wrap: wrap;
  }
  .controls input {
    flex-basis: 100%;
  }
}

header .brand-mark svg {
  color: var(--tv-voice-accent);
}
/* A focused voice stage with actual audio, alongside the persistence trail. */
main {
  max-width: 1280px;
  margin: 40px auto;
  padding: 0 32px;
}
.studio-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}
.studio-heading h1 {
  font-size: 32px;
  letter-spacing: -0.04em;
}
.studio-heading .intro {
  font-size: 14px;
  margin-bottom: 0;
}
.studio-mode {
  font-size: var(--tv-type-caption);
  letter-spacing: 0.1em;
  color: var(--tv-muted);
  border: 1px solid var(--tv-outline-variant);
  padding: 8px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.studio-back {
  font-size: 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 24px;
}
.studio-grid section {
  margin: 0;
}
.voice-stage {
  background: var(--tv-nav);
  color: var(--tv-on-nav);
  padding: 24px;
  overflow: hidden;
}
.stage-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--tv-type-caption);
  letter-spacing: 0.07em;
  color: var(--tv-nav-muted);
}
.signal-area {
  position: relative;
  height: 240px;
  display: grid;
  place-items: center;
}
.signal-area canvas {
  display: block;
  width: 100%;
  height: 240px;
}
.signal-placeholder {
  position: absolute;
  text-align: center;
  color: var(--tv-voice-accent);
}
.signal-placeholder p {
  font-size: 12px;
  color: var(--tv-nav-muted);
  margin: 12px 0 0;
}
.signal-legend {
  display: flex;
  justify-content: center;
  gap: 32px;
  font-size: var(--tv-type-caption);
  padding-bottom: 24px;
  color: var(--tv-voice-accent);
}
.signal-legend span:last-child {
  color: var(--tv-on-nav);
}
.session-controls {
  border-top: 1px solid var(--tv-nav-active);
  padding-top: 20px;
}
.session-controls label {
  color: var(--tv-nav-muted);
  font-size: var(--tv-type-caption);
  margin-top: 0;
}
.session-controls select {
  background: var(--tv-nav-active);
  color: var(--tv-on-nav);
  border-color: var(--tv-nav-muted);
  font-size: 12px;
}
.voice-stage :focus-visible {
  outline-color: var(--tv-nav-focus);
}
.voice-stage .controls {
  justify-content: center;
}
.session-followup {
  padding: 28px;
}
.session-followup h2 {
  font-size: 22px;
  letter-spacing: -0.025em;
}
.session-steps {
  list-style: none;
  padding: 0;
  margin: 24px 0;
}
.session-steps li {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 28px;
}
.session-steps li:last-child {
  padding-bottom: 0;
}
.session-steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 4px;
  width: 1px;
  background: var(--tv-outline-variant);
}
.session-steps li > span {
  width: 32px;
  height: 32px;
  border: 1px solid var(--tv-outline-variant);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--tv-type-caption);
  color: var(--tv-muted);
  flex-shrink: 0;
}
.session-steps strong {
  font-size: 13px;
}
.session-steps small {
  display: block;
  font-size: var(--tv-type-caption);
  color: var(--tv-muted);
  margin-top: 3px;
}
.session-steps [data-state="active"] > span {
  color: var(--tv-primary);
  border-color: var(--tv-primary);
  background: var(--tv-primary-container);
}
.session-steps [data-state="complete"] > span {
  color: var(--tv-success);
  border-color: var(--tv-success);
  background: var(--tv-success-container);
}
.session-steps [data-state="pending"] > span {
  color: var(--tv-warning);
  border-color: var(--tv-warning);
  background: var(--tv-warning-container);
}
.session-steps [data-state="error"] > span {
  color: var(--tv-error);
  border-color: var(--tv-error);
  background: var(--tv-error-container);
}
#status {
  border-top: 1px solid var(--tv-outline-variant);
  font-size: 12px;
  line-height: 1.8;
}
.live-result {
  margin-top: 20px;
  padding: 16px;
  background: var(--tv-primary-container);
  color: var(--tv-on-primary-container);
  border-radius: 8px;
}
.live-result small {
  font-size: var(--tv-type-caption);
  letter-spacing: 0.08em;
}
.live-result strong {
  display: block;
  font-size: 20px;
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.live-result p {
  font-size: var(--tv-type-caption);
  margin: 0;
}
.transcript-stage {
  grid-column: 1/-1;
  padding: 0;
  overflow: hidden;
}
.transcript-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--tv-outline-variant);
}
.transcript-heading .eyebrow {
  margin-bottom: 6px;
}
.transcript-heading > span {
  font-size: var(--tv-type-caption);
  color: var(--tv-muted);
}
#transcript {
  min-height: 160px;
  max-height: 420px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#transcript p {
  margin: 0;
  max-width: 80%;
  font-size: 14px;
  border-radius: 12px;
  padding: 14px 18px;
}
#transcript .utterance strong {
  display: block;
  font-size: var(--tv-type-caption);
  color: var(--tv-muted);
  margin-bottom: 4px;
}
#transcript .utterance span {
  display: block;
  white-space: pre-wrap;
}
#transcript .utterance--user {
  align-self: flex-end;
  border: 1px solid var(--tv-outline-variant);
  background: var(--tv-surface-elevated);
}
#text-form {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--tv-outline-variant);
}
#text-form label {
  margin-top: 0;
  font-size: var(--tv-type-caption);
}
footer {
  margin-top: 20px;
  font-size: 12px;
}
/* Was max-width: 900px — a rung of its own, and the only one left off the product's
   ladder once the dashboard was consolidated onto 639/767/1023/1279/1440. Moved up to
   1023 rather than down to 767 so the Studio collapses to one column in the same step as
   every other multi-column layout: the right column has a 280px floor, and holding two
   columns through the 768–1023 band leaves the voice stage and its canvas under 450px. */
@media (max-width: 1023px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
  .studio-heading {
    align-items: flex-start;
  }
  .studio-mode {
    display: none;
  }
  .studio-heading h1 {
    font-size: 28px;
  }
  .studio-grid .transcript-stage {
    grid-column: auto;
  }
  .session-steps {
    display: flex;
    gap: 16px;
  }
  .session-steps li {
    flex: 1;
    padding-bottom: 0;
  }
  .session-steps li::after {
    display: none;
  }
  .session-followup {
    padding: 24px;
  }
}
@media (max-width: 639px) {
  main {
    padding: 0 16px;
    margin: 24px auto;
  }
  .studio-heading h1 {
    font-size: 25px;
  }
  .studio-grid {
    gap: 16px;
  }
  .studio-back {
    font-size: var(--tv-type-caption);
  }
  .session-steps {
    display: grid;
  }
  .session-steps li {
    padding-bottom: 8px;
  }
  .voice-stage {
    padding: 20px 16px;
  }
  .transcript-heading,
  #transcript,
  #text-form {
    padding: 20px 16px;
  }
  .transcript-heading > span {
    display: none;
  }
  #transcript p {
    max-width: 94%;
  }
  .stage-top {
    font-size: var(--tv-type-caption);
  }
}
main {
  margin-top: 24px;
}
.studio-heading {
  margin-bottom: 20px;
}
.signal-area,
.signal-area canvas {
  height: 200px;
}
.voice-stage .signal-legend {
  padding-bottom: 16px;
}
.studio-heading h1 {
  margin-top: 10px;
  margin-bottom: 10px;
}

/* Same materials as the workspace; the canvas continues to show actual audio. */
header,
.voice-stage {
  background: var(--tv-voice-background);
}
.voice-stage {
  border-radius: var(--tv-radius-lg);
  box-shadow: var(--tv-elevation-2);
}
.session-followup,
.transcript-stage {
  background: var(--tv-glass-surface);
  border-color: var(--tv-glass-border);
  border-radius: var(--tv-radius-lg);
  box-shadow: var(--tv-elevation-1);
}
#transcript p {
  border-radius: var(--tv-radius-md);
  box-shadow: var(--tv-glass-shine);
}

/* Approved site materials; semantic audio colors remain bound to the real signal. */
.session-followup {
  background: var(--tv-summary-background);
}
.transcript-heading {
  background: var(--tv-metric-background);
}
#transcript .utterance--assistant {
  background: var(--tv-metric-background);
}
#transcript .utterance--user {
  background: var(--tv-summary-background);
}
.session-steps small,
.stage-top,
.signal-legend {
  font-size: var(--tv-type-caption);
}
.session-followup h2 {
  font-size: var(--tv-type-title);
}
.voice-signature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--tv-space-5);
  padding: var(--tv-space-6) 0 var(--tv-space-3);
}
.voice-signature .voice-orb {
  width: 72px;
  height: 72px;
}
.voice-signature > span:last-child {
  font-size: var(--tv-type-label);
  color: var(--tv-on-nav);
}
.signal-area,
.signal-area canvas {
  height: 140px;
}
.signal-placeholder svg {
  display: none;
}
.signal-placeholder p {
  font-size: var(--tv-type-caption);
}

.embedded-studio > header,
.embedded-studio main > footer,
.embedded-studio .studio-heading .intro,
.embedded-studio .studio-mode {
  display: none;
}
.embedded-studio main {
  padding: 16px;
  max-width: none;
  margin: 0;
}
.embedded-studio .studio-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.embedded-studio .studio-heading {
  margin-bottom: 12px;
}
.embedded-studio h1 {
  font-size: 22px;
}
/* Inside the dashboard panel the studio is a tool, not a showcase. The panel is roughly
   half a screen tall, and on 2026-09-24 a merchant had to scroll down to start a call and
   back up to find the approval it then asked for, which expired unseen three times. So:
   the decorative signal block goes, and the controls, together with any approval request,
   stay pinned at the top of the frame for the whole conversation. */
.embedded-studio .studio-heading,
.embedded-studio .voice-signature,
.embedded-studio .stage-top,
.embedded-studio .signal-area,
.embedded-studio .signal-legend,
.embedded-studio .session-steps,
.embedded-studio .session-followup > .eyebrow,
.embedded-studio .session-followup > h2,
.embedded-studio .transcript-heading {
  display: none;
}
.embedded-studio .voice-stage {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 16px;
  /* A pinned block taller than the frame would put its own bottom out of reach for good,
     and on a phone the approval card alone can be. It scrolls within itself instead. */
  max-height: 100vh;
  overflow-y: auto;
}
/* The panel's own header already carries the orb, the state and the clock, driven by the
   same postMessage reports, so the frame does not draw them a second time. */
.embedded-studio .session-controls {
  border-top: 0;
  padding-top: 0;
}
.embedded-studio .session-followup,
.embedded-studio .transcript-stage {
  padding: 12px 16px;
}
.embedded-studio .tool-approval p {
  margin: 4px 0;
}
.embedded-studio .tool-approval {
  margin: 12px 0 0;
  background: var(--tv-surface);
  color: var(--tv-on-surface);
  box-shadow: var(--tv-elevation-2);
}

.tool-approval {
  border: 2px solid var(--tv-primary);
  border-radius: var(--tv-radius-md);
  padding: var(--tv-space-4);
  margin-bottom: var(--tv-space-4);
  overflow-wrap: anywhere;
}
.tool-approval[hidden] {
  display: none;
}
.tool-approval h3 {
  margin-top: 0;
}
