/* Dialogue Studio: calm surfaces, compact controls, clear hierarchy.
   Keep phone landscape views on the scrollable layout through 1000px. */
.background-actions {margin:18px 0 10px;flex-wrap:wrap}
.background-buttons {display:flex;gap:8px;flex-wrap:wrap}
.account-controls {display:flex;align-items:center;gap:9px;min-width:0}
.templates-dialog {width:min(980px,calc(100vw - 32px));height:min(760px,calc(100dvh - 32px));background:var(--surface,#fff)}
.templates-dialog[open] {display:flex;flex-direction:column;overflow:hidden}
.templates-dialog .modal-head {flex-shrink:0}
.templates-dialog h2 {margin:0;font-size:20px}
.templates-dialog .help {margin:6px 0;color:var(--muted);font-size:12px}
.template-tabs {display:flex;align-items:center;gap:8px;padding:12px 20px;border-bottom:1px solid var(--stroke);flex-wrap:wrap}
.template-tabs [aria-selected=true] {color:var(--accent);border-color:var(--accent);background:var(--field)}
#templates-count {margin-left:auto}
#templates-notice {margin:0;padding:0 20px;color:var(--accent);font-size:13px;white-space:pre-wrap}
#templates-notice:not(:empty) {padding-top:10px;padding-bottom:10px}
.templates-body {display:grid;grid-template-columns:minmax(220px,34%) minmax(0,1fr);min-height:0;flex:1;overflow:hidden}
#template-list {overflow:auto;padding:14px;border-right:1px solid var(--stroke);overscroll-behavior:contain}
.template-row {border:1px solid var(--stroke);border-radius:12px;margin-bottom:10px;padding:12px;background:var(--field);overflow-wrap:anywhere}
.template-row.selected {border-color:var(--accent)}
.template-preview {display:block!important;border:0;background:none;padding:0;width:100%;text-align:left;line-height:1.6;font-size:14px;white-space:normal;color:var(--fg)}
.template-summary {display:block;color:var(--muted);font-size:12px;font-weight:400;margin-top:6px}
.template-row-actions {display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.template-row-actions button {padding:6px 12px;min-height:34px;font-size:13px}
#template-detail {padding:20px 24px;overflow:auto;overflow-wrap:anywhere;overscroll-behavior:contain;min-width:0}
#template-detail h3 {margin:0 0 12px;font-size:17px}
#template-detail h4 {margin:18px 0 6px;color:var(--muted);font-size:12px;font-weight:500}
#template-detail p {white-space:pre-wrap;line-height:1.8;font-size:14px;margin:4px 0}
#template-detail label {display:flex;flex-direction:column;gap:6px;margin:12px 0;font-size:13px}
#template-detail :is(input,textarea,select) {width:100%;min-width:0;line-height:1.65}
@media(max-width:650px) {
  .background-buttons {display:grid;grid-template-columns:minmax(0,1fr);width:100%;gap:8px}
  .settings-dialog .background-buttons button {width:100%;white-space:nowrap;padding:10px 12px;background:var(--field);border-color:var(--stroke)}
  .templates-dialog {width:calc(100vw - 16px);height:calc(100dvh - 20px)}
  .templates-body {grid-template-columns:1fr;grid-template-rows:38% minmax(0,1fr)}
  #template-list {border-right:0;border-bottom:1px solid var(--stroke)}
  #template-detail {padding:16px}
  .templates-dialog .modal-head {padding:16px;gap:12px}
  .template-row {padding:10px}
}
.settings-status-row { grid-column:2; grid-row:3; min-width:0; flex-shrink:0; }
.settings-status-row:has(.random-progress:not([hidden])) { padding:12px 24px; }
.settings-dialog .settings-status-row:has(.random-progress:not([hidden])) .modal-notice { padding:0; margin:0 0 8px; }
.random-progress { display:flex; flex:1; min-width:0; align-items:center; gap:16px; padding:12px; border:1px solid var(--stroke); border-radius:12px; background:var(--field); font-size:12px; }
.random-process { flex:1; min-width:0; }
.random-task { color:var(--accent); margin-top:4px; line-height:1.5; }
.random-steps { position:relative; max-height:96px; overflow-y:auto; overscroll-behavior:contain; padding-left:28px; padding-right:8px; margin:6px 0 0; line-height:24px; color:var(--muted); }
.random-steps li[data-status="running"] { color:var(--accent); font-weight:600; }
.random-steps li[data-status="completed"] { color:var(--fg); }
.random-steps li[data-status="pending"] { opacity:.65; }
.random-step-line { display:flex; align-items:baseline; gap:6px; }
.random-step-name { flex:0 1 auto; min-width:0; }
.random-step-leader { flex:1 1 20px; min-width:14px; height:1.6em; overflow:hidden; white-space:nowrap; color:var(--muted); }
.random-step-percent { flex:0 0 4ch; text-align:right; font:inherit; font-variant-numeric:tabular-nums; }
.random-meter { position:relative; flex:0 0 76px; width:76px; height:76px; }
.random-ring { display:block; width:100%; height:100%; transform:rotate(-90deg); }
.random-ring circle { fill:none; stroke-width:4; }
.random-ring-track { stroke:var(--stroke); }
.random-ring-arc { stroke:var(--accent); stroke-linecap:round; }
#random-percent { position:absolute; inset:0; display:grid; place-items:center; font-size:16px; font-weight:600; font-variant-numeric:tabular-nums; }
.random-progress:is([data-status="running"],[data-status="accelerating"]) .random-ring { animation:random-progress-spin 2.4s linear infinite; }
.random-progress[data-status="failed"] .random-task { color:var(--warning); }
@keyframes random-progress-spin { from { transform:rotate(-90deg); } to { transform:rotate(270deg); } }
@media (max-width:1000px) {
  .settings-status-row:has(.random-progress:not([hidden])) { padding:10px 20px; }
  .random-progress { flex-basis:100%; gap:10px; }
  .random-steps { max-height:72px; }
}
@media (prefers-reduced-motion:reduce) { .random-progress:is([data-status="running"],[data-status="accelerating"]) .random-ring { animation:none; } }
:root {
  color-scheme:light;
  --fg:#23283d;
  --muted:#7b8094;
  --stroke:#e4e6ee;
  --accent:#6655d8;
  --cyan:#6655d8;
  --surface:#fff;
  --field:#f9fafc;
  --left:44%}

* {
  box-sizing:border-box}
[hidden] {
  display:none!important}
html,body {
  margin:0;
  min-height:100%;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%}
body {
  background:#f4f5f9;
  color:var(--fg);
  font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased}
button,input,select,textarea {
  font:inherit}
button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:38px;
  padding:8px 17px;
  border:1px solid #dfe2ec;
  border-radius:9px;
  background:#fff;
  color:#51566d;
  cursor:pointer;
  /* Input feedback should appear in the next paint, without a color fade. */
  transition:none}
button:hover:not(:disabled) {
  background:#f2f0fc;
  border-color:#c4bced;
  color:#5848bd}
button:disabled {
  opacity:.4;
  cursor:not-allowed}
button.primary {
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
  font-weight:600;
  box-shadow:0 4px 12px #6655d821}
button.primary:hover:not(:disabled) {
  background:#5845c4;
  border-color:#5845c4;
  color:#fff;
  box-shadow:0 5px 16px #6655d837}
button.danger {
  color:#af6273;
  background:#fff;
  border-color:#ebd9df}
button.subtle {
  min-height:30px;
  padding:4px 10px;
  background:transparent;
  color:#6a58c8;
  border-color:transparent;
  font-size:12px}
button.icon {
  min-width:32px;
  min-height:32px;
  padding:3px 7px;
  font-size:18px}
button[aria-pressed=true] {
  color:#6855d8;
  border-color:#ddd6f6;
  background:#f0ecfc}
.button-icon {
  width:16px;
  height:16px;
  flex:none}
:focus-visible {
  outline:2px solid #8a7bea;
  outline-offset:3px}

.app {
  max-width:1920px;
  margin:auto}
.topbar {
  height:68px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin:12px 20px 0;
  padding:0 20px;
  border:1px solid var(--stroke);
  border-radius:16px;
  background:#fff}
.brand {
  display:flex;
  align-items:center;
  gap:13px}
.brand-mark {
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  border-radius:13px;
  color:#fff;
  background:linear-gradient(145deg,#7f70e6,#5343b8);
  box-shadow:0 5px 14px #6655d824}
.brand-mark svg {
  width:26px;
  height:26px}
.brand-title {
  font-size:16px;
  font-weight:650;
  letter-spacing:.1em}
.brand-sub {
  font:9px/1.6 ui-monospace,Consolas,monospace;
  letter-spacing:.15em;
  color:#9296aa;
  margin-top:3px}
.toolbar,.button-cluster {
  display:flex;
  align-items:center;
  gap:9px}
.toolbar {
  gap:16px}
.button-cluster+.button-cluster {
  border-left:1px solid var(--stroke);
  padding-left:16px}
.toolbar button {
  white-space:nowrap;
  min-width:76px}
.toolbar #call {
  min-width:102px}
.toolbar #call:disabled {
  background:var(--stroke);
  border-color:var(--stroke);
  color:var(--muted);
  box-shadow:none;
  opacity:1}
.settings-entry {position:relative}
#call-trigger {display:inline-flex;min-width:0;-webkit-tap-highlight-color:transparent}
#call-trigger.needs-background {cursor:pointer}
#call-trigger.needs-background #call {pointer-events:none}
#experience-status {min-height:1.5em}
.call-setup-hint {
  position:absolute;
  z-index:30;
  top:calc(100% + 12px);
  right:0;
  width:230px;
  max-width:calc(100vw - 40px);
  box-shadow:0 6px 20px #0002;
  padding:8px 12px;
  border:1px solid var(--accent-border);
  border-radius:10px;
  background:var(--accent-soft);
  color:var(--accent-text);
  font-size:12px;
  line-height:1.5;
  white-space:normal}
.call-setup-hint::before {
  content:"";
  position:absolute;
  top:-6px;
  right:30px;
  width:10px;
  height:10px;
  border-top:1px solid var(--accent-border);
  border-left:1px solid var(--accent-border);
  background:var(--accent-soft);
  transform:rotate(45deg)}
.call-setup-hint.flashing {animation:setup-hint-flash .35s ease-in-out 3}
@keyframes setup-hint-flash {50% {opacity:.25;transform:translateY(2px)}}
@media(max-width:1000px) {
  .button-cluster.settings-entry {grid-template-columns:minmax(0,1fr)}
}

#workspace {
  padding:30px 40px 40px}
.workspace-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin-bottom:24px}
.eyebrow {
  display:block;
  font:10px/1.6 ui-monospace,Consolas,monospace;
  letter-spacing:.16em;
  color:#9189ae;
  margin-bottom:7px}
h1 {
  margin:0;
  font-size:24px;
  font-weight:600;
  letter-spacing:.02em;
  line-height:1.4}
h1 span {
  font-size:13px;
  font-weight:400;
  letter-spacing:0;
  color:#a0a4b6;
  margin-left:16px}
.workspace-heading p {
  font-size:12px;
  color:#9296a7;
  margin:0}
.dock {
  height:calc(100dvh - 150px);
  min-height:760px;
  display:grid;
  grid-template-columns:minmax(310px,var(--left)) 20px minmax(410px,1fr);
  /* Summaries size to their content; the network gets the remaining space. */
  grid-template-rows:minmax(min-content,var(--row1,max-content)) 16px minmax(260px,var(--row2,3fr)) 16px minmax(240px,1.5fr)}
.pane {
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
  overflow:hidden;
  border:1px solid var(--stroke);
  border-radius:16px;
  background:var(--surface);
  box-shadow:0 4px 14px #24284603}
.pane-header {
  flex:none;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 16px;
  min-height:44px}
.pane-header h3 {
  font-size:14px;
  font-weight:600;
  letter-spacing:.03em;
  margin:0;
  white-space:nowrap}
.pane-body {
  padding:0 22px 18px;
  min-height:0;
  overflow:auto}
.conversation-pane {
  grid-column:1;
  grid-row:1/6;
  background:linear-gradient(180deg,#fff 55%,#faf9fe)}
.conversation-pane .pane-header {
  border-bottom:1px solid #eff0f5}
.metrics-pane {
  container:metrics / inline-size;
  grid-column:3;
  grid-row:1}
.diagram-pane {
  container:diagram / inline-size;
  grid-column:3;
  grid-row:3}
.wave-pane {
  grid-column:3;
  grid-row:5}
.state {
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:14px;
  font-size:11px;
  color:#8b8fa4}
#status {
  display:inline-flex;
  align-items:center;
  gap:6px}
#status::before {
  content:'';
  width:5px;
  height:5px;
  background:#b3adcd;
  border-radius:50%}
#status.live {
  color:#35a58e}
#status.live::before {
  background:#35a58e}
#duration {
  font:11px ui-monospace,Consolas,monospace;
  font-variant-numeric:tabular-nums}
.messages {
  flex:1;
  min-height:0;
  overflow:auto;
  padding:20px;
  scroll-behavior:smooth}
.empty {
  height:100%;
  min-height:330px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  position:relative}
.empty-icon {
  display:grid;
  place-items:center;
  position:relative;
  isolation:isolate;
  width:144px;
  height:144px;
  margin:0 0 30px;
  color:#fff;
  border-radius:50%;
  background:radial-gradient(circle at 30% 22%,#fff 0%,#e5ddff 15%,#b1a0ef 38%,#8474ce 61%,#d7d6ef 87%);
  box-shadow:inset -12px -16px 28px #6c5ba549,inset 12px 14px 24px #ffffffb3,0 20px 55px #8673c830}
.empty-icon::before,.empty-icon::after {
  content:'';
  position:absolute;
  z-index:-1;
  border:1px solid #ddd8ec;
  border-radius:50%;
  inset:-22px;
  transform:rotate(-25deg) scaleY(.76)}
.empty-icon::after {
  inset:-39px;
  transform:rotate(35deg) scaleY(.79);
  border-color:#ebe7f5}
.empty-icon svg {
  width:95px;
  height:95px;
  filter:drop-shadow(0 1px 5px #56408a40)}
.empty-icon svg circle {
  display:none}
.empty-eyebrow {
  font:9px ui-monospace,Consolas,monospace;
  letter-spacing:.24em;
  color:#aba3bc;
  margin-bottom:14px}
.empty strong {
  font-size:20px;
  font-weight:500;
  letter-spacing:.04em;
  color:#47405f}
.empty p {
  font-size:12px;
  line-height:2;
  color:#81768f;
  margin:14px 0 0}
.message {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  margin:16px 0}
.caption-arrival { animation:caption-arrival .16s ease-out; }
@keyframes caption-arrival { from { opacity:.25; } to { opacity:1; } }
@media (prefers-reduced-motion:reduce) { .caption-arrival { animation:none; } }
.message.user {
  align-items:flex-end}
.speaker {
  margin-bottom:7px;
  font-size:11px;
  color:#9490a4}
.bubble {
  max-width:90%;
  padding:10px 14px;
  border:1px solid #ecebf3;
  border-radius:4px 16px 16px;
  background:#f4f3f9;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font-size:14px;
  line-height:1.8}
.user .bubble {
  border-color:#e3ddf8;
  background:#eee9fc;
  border-radius:16px 4px 16px 16px;
  color:#514575}

.metrics-unit {
  margin-left:auto;
  color:var(--muted);
  font-size:11px}
.metrics {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:16px 18px}
.metrics>div {
  display:flex;
  flex-direction:column;
  border-left:1px solid #e9e8f0;
  padding-left:12px}
.metrics b {
  font-size:11px;
  font-weight:400;
  color:#787187;
  line-height:1.4;
  white-space:nowrap}
.metrics span {
  margin-top:4px;
  font:22px/1.3 ui-monospace,Consolas,monospace;
  color:#5b5671;
  font-variant-numeric:tabular-nums}
.metrics>div:first-child span {
  color:#7862d1}
.metrics-pane .pane-header {
  min-height:40px;
  padding-top:8px;
  padding-bottom:8px}
.metrics-pane .pane-body {
  padding:0 16px 12px}
@container metrics (min-width:700px) {
  .metrics { grid-template-columns:repeat(6,minmax(0,1fr)); gap:12px; }
}

.diagram-pane {
  color:#e2e3f1;
  background:#151822;
  border-color:#202431;
  box-shadow:0 7px 24px #20233515}
.diagram-pane .pane-header {
  padding:8px 14px;
  min-height:44px;
  gap:10px;
  border-bottom:1px solid var(--stroke)}
.graph-tools {
  display:flex;
  flex:none;
  gap:5px}
.graph-tools button {
  font-size:14px;
  min-height:29px;
  min-width:29px;
  background:transparent;
  color:#9092ae;
  border-color:transparent}
.graph-tools button[aria-pressed=true] {
  color:#bdb0fa;
  background:#2b273f;
  border-color:#413854}
.graph-tools button:hover:not(:disabled) {
  background:#333047;
  color:#fff;
  border-color:#4b4464}
.legend {
  flex:none;
  display:flex;
  align-items:center;
  gap:10px;
  font-size:10px;
  color:var(--muted);
  white-space:nowrap}
.legend>span {
  display:inline-flex;
  align-items:center;
  gap:5px}
.legend i {
  display:inline-block;
  width:6px;
  height:6px;
  flex:none;
  border-radius:50%;
  background:#7099bd}
.legend .selected { background:#5ce0c4 }
.legend .candidate { background:#efc57a }
.diagram-meta {
  display:flex;
  flex:0 1 auto;
  min-width:0;
  max-width:70%;
  margin-left:auto;
  padding-left:18px;
  gap:18px;
  font-size:11px}
.diagram-meta>div {
  display:flex;
  align-items:center;
  flex:0 1 auto;
  min-width:0;
  max-width:180px;
  gap:5px}
.diagram-meta>div:nth-child(2) { max-width:280px }
.diagram-meta b {
  flex:none;
  font-size:10px;
  font-weight:400;
  color:var(--muted)}
.diagram-meta span {
  max-width:160px;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  color:var(--fg)}
.diagram-meta>div:nth-child(2) span { max-width:255px }
/* Keep a single header on desktop; a narrow pane gets one readable metadata row. */
@container diagram (max-width:720px) {
  .legend-label { display:none }
  .legend { gap:7px }
  .graph-header { gap:8px }
}
@container diagram (max-width:520px) {
  .graph-header { flex-wrap:wrap }
  .graph-tools { margin-left:auto }
  .diagram-meta { order:1; flex-basis:100%; max-width:none; margin-left:0; padding:2px 0 0; gap:10px }
  .diagram-meta>div { flex:1; max-width:none }
  .diagram-meta>div:nth-child(2) { flex:1.5; max-width:none }
  .legend-label { display:inline }
  .legend { gap:10px }
}
@container diagram (max-width:360px) {
  .legend-label { display:none }
  .legend { gap:7px }
}
#diagram-mount {
  position:relative;
  flex:1;
  min-height:90px;
  overflow:hidden;
  background:#151822}
#diagram,#diagram-render {
  display:block;
  width:100%;
  height:100%;
  touch-action:none;
  overflow:hidden;
  background:#151822}
#diagram-empty {
  position:absolute;
  left:16%;
  right:16%;
  top:15%;
  font-size:11px;
  line-height:1.9;
  color:#999ab0;
  text-align:center;
  pointer-events:none}
.zoom-tools {
  position:absolute;
  right:14px;
  bottom:12px;
  display:flex;
  gap:3px;
  padding:3px;
  border:1px solid #313344;
  border-radius:8px;
  background:#1e202deb}
.zoom-tools button {
  min-height:24px;
  font-size:11px;
  padding:1px 8px;
  background:transparent;
  border-color:transparent;
  color:#bab9ce}
.pane-foot {
  padding:7px 22px;
  border-top:1px solid #2b2d3b;
  color:#777a90;
  font:10px/1.5 ui-monospace,Consolas,monospace}
.diagram-pane.expanded {
  position:fixed;
  inset:28px;
  z-index:20;
  box-shadow:0 0 0 100vmax #181b30b3}

.wave-pane {
  position:relative;
  overflow:hidden;
  background:#fff}
.wave-pane .pane-header {
  min-height:44px;
  padding:8px 14px;
  gap:12px;
  flex-wrap:wrap}
.call-id {
  margin-left:auto;
  max-width:180px;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  color:#9394a7;
  font:10px ui-monospace,Consolas,monospace}
.wave-pane .icon {
  min-width:28px;
  min-height:28px}
.wave-heading, .wave-recording {
  display:flex;
  align-items:center;
  gap:7px;
  min-width:0}
.wave-heading { flex:none }
#wave-position {
  color:var(--muted);
  font:11px ui-monospace,Consolas,monospace;
  font-variant-numeric:tabular-nums;
  white-space:nowrap}
.wave-recording { flex:1; justify-content:flex-end; min-width:100px }
.wave-recording .call-id { margin-left:0; min-width:0; max-width:none; flex:1; text-align:right }
.wave-recording button { flex:none }
#wave-scroll {
  position:relative;
  border-radius:0 0 15px 15px;
  flex:1;
  min-height:40px;
  overflow-x:auto;
  touch-action:pan-x;
  background:#f7f6fb;
  border-top:1px solid #f0edf6}
#wave-scroll::-webkit-scrollbar { height:9px }
#wave-scroll::-webkit-scrollbar-thumb:hover { background:var(--accent) }
#wave-scroll::-webkit-scrollbar-thumb:active { background:var(--accent-hover) }
#wave-content {
  height:100%;
  min-height:40px}
.wave-empty {
  position:absolute;
  inset:0;
  z-index:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  pointer-events:none;
  background:linear-gradient(90deg,transparent 10%,var(--wave-bg) 35%,var(--wave-bg) 65%,transparent 90%);
  color:var(--muted)}
.wave-empty svg { width:42px; height:22px; color:var(--accent-text); margin-bottom:3px }
.wave-empty p { margin:0; font-size:12px; color:var(--fg) }
.wave-empty span { font-size:11px }
#wave {
  display:block;
  position:sticky;
  left:0;
  height:100%;
  min-height:40px}
#wave-tooltip {
  position:absolute;
  top:3px;
  z-index:2;
  transform:translateX(-50%);
  pointer-events:none;
  padding:6px 10px;
  border:1px solid #dad4eb;
  border-radius:6px;
  background:#fffffff2;
  font-size:11px;
  white-space:pre}
#recording-review {
  position:absolute;
  bottom:36px;
  left:16px;
  z-index:2;
  width:calc(100% - 32px);
  height:32px;
  margin:0;
  border-radius:999px;
  box-shadow:0 4px 16px #0002}
.splitter {
  touch-action:none;
  position:relative}
.splitter::after {
  content:'';
  position:absolute;
  border-radius:3px;
  background:transparent;
  transition:background .15s}
.splitter:hover::after,.splitter:focus-visible::after {
  background:#b6ace4}
.vertical {
  grid-column:2;
  grid-row:1/6;
  cursor:col-resize}
.vertical::after {
  width:3px;
  height:40px;
  left:9px;
  top:45%}
.horizontal {
  grid-column:3;
  cursor:row-resize}
.horizontal::after {
  width:40px;
  height:3px;
  top:6px;
  left:45%}
#split-h1 {
  grid-row:2}
#split-h2 {
  grid-row:4}
.notice {
  margin:0;
  padding:10px 40px;
  background:#ede9f8;
  border-bottom:1px solid #e1daf1;
  color:#75678d;
  font-size:12px}
.notice:empty {
  display:none}
#entry {
  max-width:420px;
  margin:80px auto;
  padding:32px;
  background:#fff;
  border:1px solid var(--stroke);
  border-radius:18px}

/* Configuration is a spacious workspace with persistent section navigation. */
dialog {
  width:min(620px,calc(100vw - 48px));
  max-height:calc(100dvh - 48px);
  padding:0;
  border:1px solid #e0dfea;
  border-radius:20px;
  background:#fff;
  color:var(--fg);
  box-shadow:0 32px 100px #29244033;
  overflow:auto}
dialog::backdrop {
  /* Blurring the entire live canvas workspace makes even modal hover repaint it. */
  background:#24233355}
.settings-dialog {
  width:min(1140px,calc(100vw - 64px));
  /* Let short forms shrink; keep expanded network settings inside the viewport. */
  height:fit-content;
  max-height:calc(100dvh - 32px)}
.settings-dialog[open] {
  display:grid;
  grid-template-columns:192px minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr) auto auto;
  overflow:hidden}
.modal-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:18px 24px;
  border-bottom:1px solid var(--stroke)}
.settings-dialog .modal-head {
  grid-column:1/-1}
.modal-head .eyebrow {
  font-size:9px;
  margin-bottom:8px}
h2 {
  font-size:22px;
  font-weight:550;
  line-height:1.4;
  margin:0;
  letter-spacing:.03em}
.heading-description {
  font-size:12px;
  font-weight:400;
  color:#a0a0af;
  letter-spacing:0;
  margin-left:20px}
.modal-head .icon {
  border:none;
  background:#f5f5f8;
  border-radius:50%;
  color:#8d8a9e;
  width:34px;
  height:34px;
  min-width:34px;
  min-height:34px;
  padding:0;
  display:grid;
  place-items:center;
  flex:none;
  line-height:1}
.modal-head .icon svg { width:18px; height:18px; display:block }
.settings-feedback { flex:none; white-space:nowrap; color:var(--accent-text); font-size:11px; line-height:1.6 }
.settings-feedback:empty { display:none }
.tabs {
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:22px 12px;
  background:linear-gradient(180deg,#f7f6fa,#faf9fc);
  border-right:1px solid var(--stroke);
  grid-column:1;
  grid-row:2/5}
.tabs button {
  min-height:47px;
  padding:10px 14px;
  justify-content:flex-start;
  border:1px solid transparent;
  background:transparent;
  color:#8b889c;
  font-size:13px;
  border-radius:8px}
.tabs button[aria-selected=true] {
  color:#6855c7;
  background:#ebe7f7;
  border-color:#e3ddf3}
.tab-index {
  font:10px ui-monospace,Consolas,monospace;
  opacity:.55;
  margin-right:3px}
.tab-arrow {
  margin-left:auto;
  font-size:16px;
  opacity:.55}

#preferences {
  min-height:0;
  overflow:auto;
  padding:20px 24px 8px;
  scrollbar-gutter:stable;
  grid-column:2;
  grid-row:2}
.section-intro {
  margin-bottom:18px}
.call-section-intro {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap}
.settings-dialog .call-section-intro:has(+ #network-settings:not([hidden])) {
  margin-bottom:8px}
.section-intro .eyebrow {
  font-size:9px;
  color:#a89cc3;
  margin-bottom:7px}
.section-intro h3 {
  font-size:17px;
  font-weight:500;
  letter-spacing:.025em}
.section-intro p {
  font-size:12px;
  color:#81798e;
  margin:7px 0 0}
.modal-actions {
  display:flex;
  justify-content:flex-end;
  gap:12px;
  padding:18px 34px;
  border-top:1px solid var(--stroke);
  background:#fff;
  grid-column:2;
  grid-row:4}
.modal-actions button {
  min-width:90px;
  min-height:40px}
.modal-notice {
  grid-column:2;
  grid-row:3;
  margin:0;
  padding:8px 34px;
  color:#a07049;
  font-size:12px}
.modal-notice:empty {
  padding:0}
fieldset {
  min-width:0;
  border:0;
  margin:0;
  padding:0}
h3 {
  margin:0;
  font-size:14px;
  font-weight:550}
label {
  display:flex;
  flex-direction:column;
  gap:8px;
  margin:16px 0;
  color:#777388;
  font-size:12px}
input:not([type=checkbox]):not([type=radio]),select,textarea {
  width:100%;
  min-width:0;
  padding:10px 12px;
  background:var(--field);
  border:1px solid #e1e1eb;
  border-radius:8px;
  color:#464158;
  font-size:13px;
  line-height:1.6;
  transition:border-color .15s,box-shadow .15s}
input:not([type=checkbox]):not([type=radio]):not([type=range]),select {
  min-height:42px}
input:hover:not(:disabled),select:hover:not(:disabled),textarea:hover:not(:disabled) {
  border-color:#c3bbd9}
input:not([type=checkbox]):not([type=radio]):focus,select:focus,textarea:focus {
  border-color:#9f8fd8;
  outline:none;
  box-shadow:0 0 0 3px #8873cf10;
  background:#fff}
input::placeholder,textarea::placeholder {
  color:#8c859c;
  opacity:1;
  font-weight:400}
textarea {
  min-height:90px;
  resize:vertical}
.settings-dialog textarea { resize:none; }
#background-fields textarea::-webkit-scrollbar-corner { background:transparent; }
.settings-dialog #background-fields [aria-invalid="true"] {
  border-color:var(--danger);
  box-shadow:0 0 0 2px color-mix(in srgb,var(--danger) 12%,transparent);
  background:color-mix(in srgb,var(--danger) 5%,var(--field));
}
.settings-dialog #background-fields .background-field-error {
  color:var(--danger);
  font-size:12px;
  line-height:1.5;
}
.background-validation {
  margin:0;
  padding:10px 24px;
  color:var(--danger);
  background:color-mix(in srgb,var(--danger) 7%,var(--surface));
  border-top:1px solid color-mix(in srgb,var(--danger) 20%,var(--stroke));
  font-size:13px;
  line-height:1.6;
}
textarea[readonly] {
  color:#8d869e;
  background:#f5f4f8}
input[type=checkbox],input[type=radio] {
  width:16px;
  height:16px;
  flex-shrink:0;
  margin:0;
  accent-color:var(--accent)}
input[type=radio] {
  appearance:none;
  border:1.5px solid var(--muted);
  border-radius:50%;
  background:transparent}
input[type=radio]:checked {
  border-color:var(--accent);
  background:radial-gradient(circle,var(--accent) 45%,transparent 50%)}
input[type=range] {
  padding:8px 0!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  accent-color:var(--accent)}
input[type=file] {
  font-size:11px!important;
  overflow:hidden;
  background:#fff!important}
input::file-selector-button {
  margin-right:10px;
  padding:5px 9px;
  border:0;
  border-radius:5px;
  background:#efeaf8;
  color:#756394;
  font:inherit;
  cursor:pointer}
.check {
  flex-direction:row;
  align-items:center;
  gap:10px}
.help,small {
  font-size:11px;
  color:#867c90;
  line-height:1.8}
.help {
  margin:10px 0}
.group {
  padding:22px;
  margin:22px 0;
  border:1px solid #e6e3ed;
  border-radius:12px;
  background:#fff}
.group-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:18px}
.form-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  column-gap:20px}
.wide {
  grid-column:1/-1}
.role-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:22px}
.role-card {
  padding:20px;
  border-radius:12px;
  border:1px solid #eae6f1;
  background:#fbfaff}
.role-card+.role-card {
  background:#fafbfe;
  border-color:#e5e9f2}
.role-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  color:#776693;
  font-size:12px;
  margin-bottom:8px}
.role-heading>span {
  display:flex;
  align-items:center;
  gap:8px}
.role-avatar {
  display:grid;
  place-items:center;
  width:26px;
  height:26px;
  border:1px solid #e2d9f0;
  border-radius:8px;
  background:#f0eaf8;
  color:#8b72ac;
  font:11px ui-monospace,Consolas,monospace}
.role-card+.role-card .role-heading {
  color:#7487a4}
.role-card+.role-card .role-avatar {
  color:#7890b1;
  background:#eaf0f8;
  border-color:#dce5f1}
.role-heading small {
  font:10px ui-monospace,Consolas,monospace;
  color:#b8b0c8}
.role-card .form-grid {
  grid-template-columns:minmax(0,1.6fr) minmax(72px,1fr);
  gap:0 12px}
.role-card label {
  margin:12px 0}
.role-card textarea {
  height:106px}
.context-field {
  margin:24px 0 0}
.context-field textarea {
  height:108px}
#background-fields {
  padding:0;
  border:0;
  background:transparent;
  margin:24px 0 0}
.range-row {
  display:flex;
  align-items:center;
  gap:12px}
.range-row input {
  flex:1;
  min-width:0}
.audio-groups {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px}
.audio-groups .group {
  margin:0;
  min-width:0}
.audio-groups .group:first-child {
  grid-row:1/3}
.audio-groups .group h3 {
  margin-bottom:12px}
.audio-groups .group .help {
  margin-bottom:0}
.audio-groups .check {
  margin:9px 0}
#hotwords {
  max-width:28rem}
.mode-options {
  display:flex;
  flex-wrap:wrap;
  gap:24px;
  padding:3px 0;
  border-bottom:1px solid var(--stroke)}
.mode-options label {
  margin:0 0 12px;
  flex-direction:row;
  align-items:center;
  gap:8px}
.enable-network {
  flex-shrink:0;
  margin:0;
  padding:7px 10px;
  background:#f4f1fb;
  border:1px solid #e4ddf3;
  border-radius:10px;
  color:#766590;
  font-size:13px}
.material-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px}
.material-grid .group {
  min-width:0;
  margin:14px 0 0;
  background:#fbfaff;
  border-style:dashed;
  padding:20px}
.material-grid h3 {
  margin-bottom:16px}
.material-grid h3 small {
  margin-left:6px}
.material-grid button {
  font-size:12px;
  margin-top:3px}
.precision-group {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0 28px}
.precision-group h3 {
  grid-column:1/-1}
.precision-control {
  min-width:0}
.precision-group .help {
  margin:0}
.precision-group label {
  position:relative}
#precision-value {
  position:absolute;
  top:0;
  right:0;
  color:#8b72b9;
  font:12px ui-monospace,Consolas,monospace}
#scenario-description {
  height:110px}
#scenario-submit {
  display:none}
#task-state {
  padding:18px 0}
#task-state progress {
  width:100%;
  height:6px;
  accent-color:var(--accent)}
#task-stages {
  columns:2;
  column-gap:28px;
  line-height:2.2;
  padding-left:24px}
#task-stages li {
  break-inside:avoid}
#transfer-dialog>label,#transfer-dialog>p,#transfer-dialog>button {
  margin:20px 28px}
#transfer-dialog>label {
  width:calc(100% - 56px)}
.material-result {
  list-style:none;
  padding:0;
  margin:0}
.material-result li {
  margin:12px 0;
  padding:12px;
  border:1px solid var(--stroke);
  border-radius:8px}
.material-result p {
  font-size:12px;
  line-height:1.8;
  color:var(--muted);
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  margin:6px 0}
hr {
  border:0;
  border-top:1px solid var(--stroke);
  margin:24px 0}
::-webkit-scrollbar {
  width:6px;
  height:6px}
::-webkit-scrollbar-thumb {
  border-radius:5px;
  background:#a4a0b54d}

@media(min-width:1001px) and (max-width:1150px) {
  .topbar {
  padding:0 24px}
#workspace {
  padding:24px}
.workspace-heading p {
  display:none}
.dock {
  grid-template-columns:minmax(290px,var(--left)) 16px minmax(360px,1fr);
  min-height:720px}
.pane-header {
  padding-left:18px;
  padding-right:18px}
.messages {
  padding:20px}
.empty strong {
  font-size:17px}
.settings-dialog[open] {
  grid-template-columns:160px minmax(0,1fr)}
#preferences {
  padding:26px 24px 8px}
.tabs {
  padding:28px 10px}
.role-grid {
  gap:16px}
.role-card {
  padding:16px}
.role-card label {
  margin:10px 0}
.heading-description {
  margin-left:14px}
.material-grid {
  gap:14px}
.material-grid .group {
  padding:16px}
.call-id {
  max-width:125px}
}

@media(max-width:1000px) {
  body {
  font-size:13px}
.app {
  padding-inline:env(safe-area-inset-left) env(safe-area-inset-right)}
#account-name {
  min-width:0;
  overflow-wrap:anywhere}
.topbar {
  height:auto;
  flex-wrap:wrap;
  gap:20px;
  padding:22px 20px}
.brand-title {
  font-size:15px}
.brand-sub {
  font-size:8px}
.brand-mark {
  width:38px;
  height:38px}
.toolbar {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  width:100%;
  gap:8px}
.account-controls {
  grid-column:1/-1;
  justify-content:space-between;
  gap:12px}
.account-controls #account-name {flex:1}
.account-controls #account-logout {width:auto;flex:none;padding-inline:12px}
.call-actions {grid-column:span 2}
.button-cluster {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  min-width:0;
  gap:8px}
.button-cluster+.button-cluster {
  border-left:0;
  padding-left:0}
.toolbar button {
  min-width:0;
  width:100%;
  min-height:44px;
  gap:5px;
  font-size:13px;
  padding:8px 6px}
.toolbar #call {
  min-width:0}
#call-label {
  white-space:normal;
  overflow-wrap:anywhere}
.button-icon {
  width:14px}
#workspace {
  padding:24px 16px 28px}
.workspace-heading {
  margin-bottom:22px}
.workspace-heading p,h1 span {
  display:none}
h1 {
  font-size:22px}
.eyebrow {
  font-size:9px}
.dock {
  display:flex;
  flex-direction:column;
  gap:18px;
  height:auto;
  min-height:0}
.pane {
  border-radius:14px}
.conversation-pane {
  height:clamp(360px,60dvh,540px);
  min-height:0}
.metrics-pane {
  height:auto}
.metrics-pane .pane-body {
  padding:0 20px 18px}
.metrics {
  gap:18px}
.metrics span {
  font-size:22px}
.diagram-pane {
  height:420px}
.wave-pane {
  height:330px}
.splitter {
  display:none}
.pane-header {
  padding:16px 20px}
.messages {
  padding:20px}
.empty {
  min-height:0}
.empty-icon {
  width:156px;
  height:156px;
  margin-bottom:38px}
.empty strong {
  font-size:18px}
.empty p {
  font-size:12px}
.bubble {
  max-width:94%}
.call-id {
  max-width:125px}
.wave-pane .pane-header {
  gap:4px;
  padding-left:16px;
  padding-right:16px}
.wave-pane .subtle {
  padding:3px 6px}
.state {
  gap:9px}
.diagram-pane.expanded {
  inset:10px max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
  height:auto;
  padding-bottom:env(safe-area-inset-bottom)}
.notice {
  padding:10px 20px}
dialog,.settings-dialog {
  width:calc(100vw - 20px);
  --dialog-inset:max(18px,env(safe-area-inset-left),env(safe-area-inset-right));
  max-width:calc(100vw - var(--dialog-inset) - var(--dialog-inset));
  max-height:calc(100dvh - 20px);
  border-radius:16px}
.settings-dialog {
  height:calc(100dvh - 20px)}
.settings-dialog[open] {
  display:flex;
  flex-direction:column}
.modal-head {
  padding:20px 22px;
  flex-shrink:0}
.modal-head h2 {
  font-size:21px}
.heading-description {
  display:block;
  margin:7px 0 0;
  font-size:11px}
.tabs {
  flex-direction:row;
  gap:12px;
  padding:12px 20px;
  border-right:0;
  border-bottom:1px solid var(--stroke);
  flex-shrink:0}
.tabs button {
  flex:1;
  min-height:42px;
  padding:8px 12px;
  font-size:12px}
.tabs::after,.tab-arrow {
  display:none}
.tab-index {
  font-size:9px}
#preferences {
  flex:1;
  padding:25px 20px 16px;
  scrollbar-gutter:auto}
.section-intro {
  margin-bottom:22px}
.section-intro h3 {
  font-size:17px}
.section-intro p {
  font-size:11px;
  line-height:1.9}
.modal-actions {
  padding:14px 20px max(14px,env(safe-area-inset-bottom));
  flex-shrink:0}
.modal-actions button {
  min-height:43px;
  min-width:90px}
.modal-notice {
  padding-left:20px;
  padding-right:20px;
  flex-shrink:0}
.role-grid,.audio-groups,.material-grid,.precision-group {
  grid-template-columns:1fr;
  gap:18px}
.role-card {
  padding:20px}
.role-card .form-grid {
  grid-template-columns:1fr}
.role-card textarea {
  height:105px}
.role-card .form-grid label {
  margin:12px 0}
.context-field textarea {
  height:120px}
.group {
  padding:20px;
  margin:22px 0}
.form-grid {
  grid-template-columns:1fr}
.wide {
  grid-column:1/-1}
.audio-groups .group:first-child {
  grid-row:auto}
.audio-groups .group {
  margin:0}
.precision-group {
  gap:0}
.material-grid .group {
  margin:0}
.material-grid {
  margin-top:22px}
.enable-network {
  padding:7px 10px}
.mode-options {
  gap:8px 16px}
.mode-options label {
  font-size:15px;
  min-height:44px;
  white-space:nowrap;
  margin:4px 0}
.mode-options input {
  width:18px;
  height:18px}
input:not([type=checkbox]):not([type=radio]),select,textarea {
  font-size:16px;
  padding:10px 12px}
input[type=checkbox],input[type=radio] {
  width:18px;
  height:18px}
input[type=file] {
  font-size:11px!important}
#task-stages {
  columns:1}
.graph-tools button {
  min-width:32px;
  min-height:32px}
#transfer-dialog>button {
  margin:14px 20px}
#entry {
  margin:40px 20px;
  padding:26px}
}

@media(prefers-reduced-motion:reduce) {
  * {
  scroll-behavior:auto!important;
  transition:none!important}
}

@media (max-width:360px) {
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .call-id { max-width:100px; }
}

/* Shared day/night palette, including all canvas rendering. */
:root {

  color-scheme: light;
  --page: #f4f5f9;
  --fg: #303247;
  --muted: #76758a;
  --soft: #8b879b;
  --stroke: #e4e3ec;
  --surface: #ffffff;
  --surface-alt: #f8f7fb;
  --field: #f9fafc;
  --accent: #6655d8;
  --accent-hover: #5845c4;
  --accent-text: #6c58b7;
  --accent-soft: #eee9fa;
  --accent-border: #ddd5ef;
  --role-other: #f7f9fc;
  --role-other-text: #667d9e;
  --role-other-border: #dfe6ef;
  --bubble: #f4f3f9;
  --notice-bg: #ede9f8;
  --warning: #986439;
  --danger: #ad5870;
  --backdrop: #24233355;
  --graph-bg: #fbfaff;
  --graph-node: #527299;
  --graph-selected: #178571;
  --graph-candidate: #b17a20;
  --graph-label: #545068;
  --graph-line: #8090a8;
  --wave-bg: #f7f6fb;
  --wave-grid: #d6d1e2;
  --wave-input: #249777;
  --wave-output: #5b8dcb;
  --wave-marker: #9c78d4;
}
:root[data-theme="dark"] {

  color-scheme: dark;
  --page: #12141b;
  --fg: #d5d6e2;
  --muted: #a09eaf;
  --soft: #9691a8;
  --stroke: #30313e;
  --surface: #1c1e28;
  --surface-alt: #222430;
  --field: #181a24;
  --accent: #8270cc;
  --accent-hover: #9180d8;
  --accent-text: #b7a4e6;
  --accent-soft: #302a43;
  --accent-border: #48405d;
  --role-other: #222734;
  --role-other-text: #a0b2ce;
  --role-other-border: #374256;
  --bubble: #272735;
  --notice-bg: #2a2639;
  --warning: #d4ae82;
  --danger: #d38c9e;
  --backdrop: #07080dc9;
  --graph-bg: #1a1c26;
  --graph-node: #8a9dbb;
  --graph-selected: #64cbb2;
  --graph-candidate: #ddbb79;
  --graph-label: #c0bdd3;
  --graph-line: #75849c;
  --wave-bg: #191b25;
  --wave-grid: #383849;
  --wave-input: #66ba9f;
  --wave-output: #7d9fcd;
  --wave-marker: #ab8ad6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {

  color-scheme: dark;
  --page: #12141b;
  --fg: #d5d6e2;
  --muted: #a09eaf;
  --soft: #9691a8;
  --stroke: #30313e;
  --surface: #1c1e28;
  --surface-alt: #222430;
  --field: #181a24;
  --accent: #8270cc;
  --accent-hover: #9180d8;
  --accent-text: #b7a4e6;
  --accent-soft: #302a43;
  --accent-border: #48405d;
  --role-other: #222734;
  --role-other-text: #a0b2ce;
  --role-other-border: #374256;
  --bubble: #272735;
  --notice-bg: #2a2639;
  --warning: #d4ae82;
  --danger: #d38c9e;
  --backdrop: #07080dc9;
  --graph-bg: #1a1c26;
  --graph-node: #8a9dbb;
  --graph-selected: #64cbb2;
  --graph-candidate: #ddbb79;
  --graph-label: #c0bdd3;
  --graph-line: #75849c;
  --wave-bg: #191b25;
  --wave-grid: #383849;
  --wave-input: #66ba9f;
  --wave-output: #7d9fcd;
  --wave-marker: #ab8ad6;
  }
}

body { background: var(--page); color: var(--fg); }
.topbar, .pane, .wave-pane, dialog, .modal-actions, .group, #entry {
  background: var(--surface); color: var(--fg); border-color: var(--stroke);
}
.conversation-pane { background: linear-gradient(180deg,var(--surface) 55%,var(--surface-alt)); }
.conversation-pane .pane-header, .metrics > div, .modal-head, .tabs, .mode-options, .material-result li, .modal-actions {
  border-color: var(--stroke);
}
button { background: var(--surface); color: var(--muted); border-color: var(--stroke); }
button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-border); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: none; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); color: #fff; border-color: var(--accent-hover); box-shadow: none; }
button.danger { background: var(--surface); color: var(--danger); border-color: var(--stroke); }
button.subtle { background: transparent; color: var(--accent-text); border-color: transparent; }
button[aria-pressed=true] { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-border); }
:focus-visible { outline-color: var(--accent); }
#theme-toggle { margin-left:auto; padding:8px 12px; min-width:104px; font-size:12px; background:transparent; border-color:transparent; }
[data-theme-toggle]:hover { background:var(--accent-soft); border-color:var(--accent-border); }
[data-theme-toggle] svg { width:17px; height:17px; }
.theme-sun { display:none; }
:root[data-theme=dark] .theme-sun { display:block; }
:root[data-theme=dark] .theme-moon { display:none; }
.workspace-heading p, .state, .speaker, .performance-head, .performance-head small, .metrics b, .call-id,
.heading-description, .section-intro p, label, .help, small, .role-heading small, .material-result p { color:var(--muted); }
.metrics span, .empty strong { color:var(--fg); }
.metrics > div:first-child span { color:var(--accent-text); }
.empty p { color:var(--muted); }
.bubble { background:var(--bubble); border-color:var(--stroke); }
.user .bubble { background:var(--accent-soft); border-color:var(--accent-border); color:var(--fg); }
/* The network is now another surface of the active theme, not a separate black panel. */
.diagram-pane { background:var(--surface); color:var(--fg); border-color:var(--stroke); box-shadow:0 4px 14px #24284603; }
.graph-tools button { color:var(--muted); background:transparent; border-color:transparent; }
.graph-tools button[aria-pressed=true] { color:var(--accent-text); background:var(--accent-soft); border-color:var(--accent-border); }
.graph-tools button:hover:not(:disabled) { color:var(--accent-text); background:var(--accent-soft); border-color:var(--accent-border); }
.legend { color:var(--muted); }
.legend i { background:var(--graph-node); }
.legend .selected { background:var(--graph-selected); }
.legend .candidate { background:var(--graph-candidate); }
.diagram-meta b { color:var(--muted); }
.diagram-meta span { color:var(--fg); }
#diagram-mount, #diagram, #diagram-render { background:var(--graph-bg); }
#diagram-empty { color:var(--muted); }
.zoom-tools { background:var(--surface); border-color:var(--stroke); }
.zoom-tools button { background:transparent; color:var(--muted); }
.pane-foot { color:var(--muted); border-color:var(--stroke); }
.diagram-pane.expanded { box-shadow:0 0 0 100vmax var(--backdrop); }
#wave-scroll { background:var(--wave-bg); border-color:var(--stroke); }
#wave-tooltip { background:var(--surface); color:var(--fg); border-color:var(--stroke); }
.notice { background:var(--notice-bg); color:var(--accent-text); border-color:var(--accent-border); }
dialog::backdrop { background:var(--backdrop); }
.modal-head .icon { background:var(--surface-alt); color:var(--muted); }
.tabs { background:var(--surface-alt); }
.tabs button { background:transparent; color:var(--muted); }
.tabs button[aria-selected=true] { background:var(--accent-soft); border-color:var(--accent-border); color:var(--accent-text); }
.modal-notice { color:var(--warning); }
input:not([type=checkbox]):not([type=radio]), select, textarea { background:var(--field); color:var(--fg); border-color:var(--stroke); }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color:var(--accent-border); }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { background:var(--surface); border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color:var(--soft); }
textarea[readonly] { color:var(--muted); background:var(--surface-alt); }
input[type=file] { background:var(--field)!important; }
input::file-selector-button { color:var(--accent-text); background:var(--accent-soft); }
.role-card, .material-grid .group { background:var(--surface-alt); border-color:var(--stroke); }
.role-card + .role-card { background:var(--role-other); border-color:var(--role-other-border); }
.role-heading { color:var(--accent-text); }
.role-avatar { background:var(--accent-soft); color:var(--accent-text); border-color:var(--accent-border); font-size:12px; font-style:normal; }
.role-card + .role-card .role-heading { color:var(--role-other-text); }
.role-card + .role-card .role-avatar { background:var(--role-other); color:var(--role-other-text); border-color:var(--role-other-border); }
.enable-network { color:var(--accent-text); background:var(--accent-soft); border-color:var(--accent-border); }
#precision-value { color:var(--accent-text); }
/* Quiet night treatment: no white orb, hard shadows or bright secondary surfaces. */
:root[data-theme=dark] .empty-icon { background:radial-gradient(circle at 30% 22%,#a49abf 0%,#807499 24%,#5d4f7d 54%,#383348 86%); box-shadow:inset -12px -16px 28px #17112255,inset 12px 14px 24px #b9a4d326,0 20px 55px #0a091730; color:#ddd5ec; }
:root[data-theme=dark] .empty-icon::before, :root[data-theme=dark] .empty-icon::after { border-color:#393346; }
:root[data-theme=dark] .brand-mark { background:linear-gradient(145deg,#8070b7,#54477c); box-shadow:none; color:#ece6fa; }
:root[data-theme=dark] dialog { box-shadow:0 32px 100px #0008; }
:root[data-theme=dark] .pane { box-shadow:none; }
/* Space formerly occupied by ornamental captions is intentionally removed. */
.empty-icon { margin-bottom:30px; }
.brand-title { line-height:1.5; }
@media (max-width:1000px) {
  .topbar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; margin:10px 12px 0; padding:12px; }
  .brand {min-width:0}
  #workspace {padding:16px 12px 24px}
  .dock {gap:12px}
  .wave-recording {flex:1;min-width:0;gap:6px}
  .wave-pane .pane-header {flex-wrap:nowrap;gap:8px;padding-inline:12px}
  .wave-recording .call-id {flex:1 1 0}
  .wave-pane .subtle {padding-inline:4px;white-space:nowrap}
  .empty-icon {width:128px;height:128px;margin-bottom:28px}
  #theme-toggle { min-width:44px; min-height:44px; padding:8px; }
  .toolbar { grid-column:1/-1; }
}
@media (max-width:480px) {
  .wave-pane .pane-header {gap:6px;padding-inline:10px}
  .wave-heading {gap:4px}
  .wave-recording {gap:4px}
  .wave-pane .subtle,.wave-pane .icon {min-width:32px;min-height:32px}
}
@media (max-width:360px) {
  #theme-toggle { font-size:11px; gap:5px; padding:6px; }
  .brand { gap:8px; }
  .brand-title { font-size:14px; letter-spacing:0; }
}

.modal-header-actions { display:flex; align-items:center; gap:16px; }
#settings-theme-toggle { background:transparent; border-color:transparent; color:var(--muted); padding:6px 8px; font-size:12px; }
@media (max-width:1000px) {
  .modal-header-actions { gap:8px; }
  #settings-theme-toggle { padding:6px; min-width:32px; }
  #settings-theme-toggle [data-theme-label] { display:none; }
}

/* Apply a remembered theme before showing the interface, avoiding a white flash. */
body.theme-pending { background:#181a24; min-height:100dvh; }
body.theme-pending > .app, body.theme-pending > dialog { visibility:hidden; }
/* Reserve the action row even when the current network mode hides its buttons. */
.settings-dialog .modal-actions { min-height:78px; }
@media (min-width:1001px) and (max-height:800px) {
  .settings-dialog .modal-head { padding:10px 24px; }
  .settings-dialog #preferences { padding:12px 24px 8px; }
  .settings-dialog .section-intro { margin-bottom:12px; }
  .settings-dialog .section-intro h3 { font-size:17px; }
  .settings-dialog .section-intro p { margin-top:4px; }
  .settings-dialog #background-fields { margin-top:12px; }
  .settings-dialog .group-head { margin-bottom:10px; }
  .settings-dialog .role-grid { gap:16px; }
  .settings-dialog .role-card { padding:12px; }
  .settings-dialog .role-heading { margin-bottom:4px; }
  .settings-dialog .role-card label { margin:6px 0; gap:6px; }
  .settings-dialog .role-card input, .settings-dialog .role-card select { min-height:36px; padding-block:6px; }
  .settings-dialog .role-card textarea { height:76px; min-height:76px; }
  .settings-dialog .context-field { margin-top:12px; gap:6px; }
  .settings-dialog .context-field textarea { height:76px; min-height:76px; }
  .settings-dialog .modal-notice { padding-inline:24px; }
  .settings-dialog .modal-actions { min-height:64px; padding:12px 24px; }
}
@media (max-width:1000px) {
  .settings-dialog .modal-actions { min-height:calc(58px + max(14px,env(safe-area-inset-bottom))); }
}

/* Point directly at the explicit submission action; preserve status feedback. */
.material-grid .group.submission-required { border-color:var(--warning); border-style:solid; }
button.needs-submission { border-color:var(--warning); color:var(--warning); box-shadow:0 0 0 3px color-mix(in srgb,var(--warning) 16%,transparent); }
.submission-hint {
  position:relative; margin-top:12px; padding:10px 12px;
  color:var(--warning); background:var(--surface); border:1px solid var(--warning);
  border-radius:8px; font-size:12px; line-height:1.7;
}
.submission-hint::before {
  content:''; position:absolute; left:24px; top:-5px; width:8px; height:8px;
  background:var(--surface); border-left:1px solid var(--warning); border-top:1px solid var(--warning);
  transform:rotate(45deg);
}
button.needs-submission { scroll-margin-block:32px; }
.microphone-dialog { width:min(480px,calc(100vw - 32px)); }
.microphone-dialog .modal-head { padding:22px 24px 16px; }
.microphone-dialog h2 { font-size:19px; }
#microphone-message { margin:0; padding:20px 24px; line-height:1.9; color:var(--muted); }
.microphone-dialog .modal-actions { margin:0; padding:14px 24px 20px; }
/* Keep desktop panels inside the viewport; the network yields space to the waveform. */
@media(min-width:1001px) {
  /* Anchor both settings tabs at the same upper edge as their content grows. */
  .settings-dialog {
    --settings-top:clamp(16px,6dvh,64px);
    margin-block:var(--settings-top) 0;
    max-height:calc(100dvh - var(--settings-top) - 16px);
  }
  html,body {height:100%;overflow:hidden}
  .app {height:100dvh;display:flex;flex-direction:column}
  .topbar {flex:none}
  #workspace {flex:1;min-height:0;display:flex;flex-direction:column;padding:12px 20px 16px}
  .workspace-heading {flex:none;margin-bottom:10px}
  .workspace-heading h1 {font-size:20px}
  .dock {--wave-height:190px;flex:1;min-height:0;height:auto;grid-template-rows:minmax(min-content,var(--row1,max-content)) 10px minmax(0,var(--row2,1fr)) 10px var(--wave-height)}
  /* A portrait conversation column anchors the desk; diagnostics stay on the right. */
  .dock[data-network-enabled=false] {
    grid-template-columns:minmax(300px,min(var(--left-free,clamp(540px,57%,840px)),calc(100% - 312px))) 12px minmax(300px,1fr);
    grid-template-rows:minmax(min-content,var(--metrics-free-height,max-content)) 12px minmax(0,1fr);
  }
  .dock[data-network-enabled=false] .conversation-pane { grid-column:1; grid-row:1/-1 }
  .dock[data-network-enabled=false] .vertical { grid-column:2; grid-row:1/-1 }
  .dock[data-network-enabled=false] .wave-pane { grid-column:3; grid-row:3 }
  .dock[data-network-enabled=false] #split-h1 { grid-column:3; grid-row:2 }
  .dock[data-network-enabled=false] .metrics-pane { grid-column:3; grid-row:1 }
  .dock[data-network-enabled=false] .metrics-pane .pane-header { min-height:38px; padding:8px 16px }
  .dock[data-network-enabled=false] .metrics-pane .pane-body { padding:0 16px 14px }
  .dock[data-network-enabled=false] .metrics { grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px 16px }
  .dock[data-network-enabled=false] .metrics>div { padding-left:10px }
  .dock[data-network-enabled=false] .metrics b { font-size:11px }
  .dock[data-network-enabled=false] .metrics span { font-size:21px; margin-top:3px }
  .dock[data-network-enabled=false] .empty { min-height:0; gap:0; text-align:center }
  .dock[data-network-enabled=false] .empty-icon { width:128px; height:128px; flex:none; margin-bottom:34px }
  .dock[data-network-enabled=false] .empty-icon svg { width:78px; height:78px }
  .dock[data-network-enabled=false] .empty strong { font-size:18px }
  .dock[data-network-enabled=false] .bubble { max-width:88% }
  #diagram-mount {min-height:0}
}
@container metrics (min-width:700px) {
  .dock[data-network-enabled=false] .metrics { grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px }
}
@media(min-width:1001px) and (max-height:800px) {
  .topbar {height:64px;padding:0 16px}
  .dock {--wave-height:170px}
  .brand-mark {width:34px;height:34px}
  #workspace {padding:10px 20px 12px}
  .workspace-heading {margin-bottom:8px}
  .workspace-heading h1 {font-size:20px}
  .metrics {grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
  .metrics b {white-space:normal;font-size:10px}
  .metrics span {font-size:18px}
  .metrics>div {padding-left:6px}
  .metrics-pane .pane-header {min-height:32px;padding:6px 14px}
  .metrics-pane .pane-body {padding:0 14px 8px}
  .diagram-pane .pane-header {min-height:40px;padding:6px 12px}
  .diagram-pane .pane-foot {padding:3px 14px}
}
@media(min-width:1001px) and (max-height:560px) {
  .dock {--wave-height:140px}
  .workspace-heading {display:none}
}
@media(max-width:1000px) {
  .diagram-pane {height:310px}
  .wave-pane .wave-header {flex-wrap:nowrap;gap:6px;padding-inline:10px}
  .wave-header h3 {flex:none;white-space:nowrap}
  .wave-header .call-id {flex:1 1 0;min-width:0;max-width:none}
  .wave-header .subtle {flex:none;padding-inline:4px;white-space:nowrap}
  .wave-header .icon {flex:none}
}
@media(min-width:1001px) and (max-height:700px) {
  .workspace-heading {display:none}
}

@media(min-width:1001px) and (max-height:640px) {
  .dock[data-network-enabled=false] .messages { padding:10px 20px }
  .dock[data-network-enabled=false] .empty-icon { width:104px; height:104px; margin-bottom:26px }
  .dock[data-network-enabled=false] .empty-icon svg { width:64px; height:64px }
  .dock[data-network-enabled=false] .empty strong { font-size:16px }
  .dock[data-network-enabled=false] .empty p { margin-top:6px }
}
/* Mobile controls stay readable without adding a second waveform toolbar row. */
.settings-dialog .mode-options input {
  appearance:none;border:1.5px solid var(--muted);border-radius:50%;
  background:transparent;box-shadow:none;outline:none;
}
.settings-dialog .mode-options input:checked {border-color:var(--accent);background:radial-gradient(circle,var(--accent) 45%,transparent 50%)}
.settings-dialog .mode-options input:focus-visible {outline:2px solid var(--accent);outline-offset:3px}
@media(max-width:1000px) {
  .settings-dialog .mode-options {gap:8px 12px}
  .settings-dialog .mode-options label {font-size:15px;min-height:44px;gap:8px;margin:4px 0;white-space:nowrap}
  .settings-dialog .mode-options input {width:18px;height:18px}
}
@media(max-width:480px) {
  .wave-header .subtle,.wave-header .icon {min-width:32px;min-height:32px}
}

/* One mobile type scale for both settings tabs and every network workflow. */
@media(max-width:1000px) {
  .settings-dialog {
    --settings-caption:.8125rem;
    --settings-label:.875rem;
    --settings-body:.9375rem;
    --settings-control:1rem;
    font-family:system-ui,-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
    font-size:var(--settings-body);
    font-weight:400;
    line-height:1.6;
    letter-spacing:normal;
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
  }
  .settings-dialog *, .settings-dialog ::file-selector-button {font-family:inherit;letter-spacing:normal}
  .settings-dialog .tab-index,.settings-dialog .role-heading small,.settings-dialog .role-avatar,.settings-dialog #precision-value {font-family:inherit}
  .settings-dialog h2 {font-size:1.375rem;font-weight:600;line-height:1.35}
  .settings-dialog .heading-description {font-size:var(--settings-caption);font-weight:400;line-height:1.5;margin-top:6px}
  .settings-dialog .section-intro h3 {font-size:1.125rem;font-weight:600;line-height:1.5}
  .settings-dialog .section-intro p {font-size:var(--settings-caption);font-weight:400;line-height:1.7;margin-top:6px}
  .settings-dialog h3 {font-size:var(--settings-control);font-weight:600;line-height:1.5}
  .settings-dialog .tabs button {font-size:var(--settings-body);font-weight:500;line-height:1.4;min-height:44px}
  .settings-dialog .tabs button[aria-selected=true] {font-weight:600}
  .settings-dialog .tab-index,.settings-dialog .role-heading small {font-size:.75rem;font-weight:400;line-height:1.5;font-variant-numeric:tabular-nums}
  .settings-dialog .role-heading {font-size:var(--settings-label);font-weight:500;line-height:1.5}
  .settings-dialog .role-avatar {font-size:var(--settings-label);font-weight:500;font-style:normal;line-height:1}
  .settings-dialog label {font-size:var(--settings-label);font-weight:500;line-height:1.5;color:var(--fg)}
  .settings-dialog .check,.settings-dialog .mode-options label {font-size:var(--settings-body);font-weight:400;line-height:1.6;min-height:44px}
  .settings-dialog .enable-network {font-weight:500;color:var(--accent-text)}
  .settings-dialog input:not([type=checkbox]):not([type=radio]):not([type=range]),
  .settings-dialog select,.settings-dialog textarea {
    font-size:var(--settings-control);font-weight:400;line-height:1.5;min-height:44px;
  }
  .settings-dialog textarea {line-height:1.65}
  .settings-dialog input::placeholder,.settings-dialog textarea::placeholder {font-size:inherit;font-weight:400;line-height:inherit}
  .settings-dialog .help,.settings-dialog small,.settings-dialog .material-result p,
  .settings-dialog .modal-notice,.settings-dialog .submission-hint {
    font-size:var(--settings-caption);font-weight:400;line-height:1.65;
  }
  .settings-dialog .help,.settings-dialog small {color:var(--muted)}
  .settings-dialog .role-heading small {font-size:.75rem}
  .settings-dialog #precision-value {font-size:var(--settings-label);font-weight:500;line-height:1.5;font-variant-numeric:tabular-nums}
  .settings-dialog button {font-size:var(--settings-body);font-weight:500;line-height:1.45;min-height:44px}
  .settings-dialog .modal-actions button {font-size:var(--settings-control);font-weight:500}
  .settings-dialog .modal-actions .primary {font-weight:600}
  .settings-dialog .modal-head .icon,.settings-dialog #settings-theme-toggle {min-height:36px}
  .settings-dialog input[type=file] {font-size:var(--settings-caption)!important;line-height:1.5}
  .settings-dialog ::file-selector-button {font-size:var(--settings-label);font-weight:500;line-height:1.5;padding:7px 10px}
  .settings-dialog .material-result {font-size:var(--settings-caption);line-height:1.65}
  .settings-dialog .material-result strong {font-size:var(--settings-label);font-weight:600;line-height:1.5}
  .settings-dialog #task-text {font-size:var(--settings-body);font-weight:500;line-height:1.6}
  .settings-dialog #transfer-notice {font-size:var(--settings-caption);line-height:1.65}
}

#entry-form { max-width:440px; margin:8vh auto; padding:26px; }
.account-form label { display:flex; flex-direction:column; gap:8px; margin:16px 0; }
.account-form button[type=submit] { width:100%; }
@media(min-width:1001px) and (max-width:1150px) {
  .topbar {height:auto;min-height:68px;flex-wrap:wrap;padding-block:12px}
  .toolbar {max-width:100%;flex-wrap:wrap;justify-content:flex-end}
}
.account-switch { margin:8px 0; text-align:center; font-size:14px; }
.account-switch a {
  display:inline-flex;
  align-items:center;
  min-height:44px;
  padding-inline:6px;
  color:var(--accent-text);
  font-weight:600;
  text-decoration:underline;
  text-underline-offset:3px;
}
.account-switch a:focus-visible { outline:2px solid currentColor; outline-offset:2px; border-radius:4px; }
.registration-page { width:min(100%, 500px); margin:0 auto; padding:clamp(20px, 5vh, 48px) 16px; }
.registration-brand { margin:0 0 12px; color:var(--accent-text); font-weight:600; }
.registration-form {
  padding:clamp(18px, 5vw, 32px);
  border:1px solid var(--stroke);
  border-radius:16px;
  background:var(--surface);
}
.registration-form h1 { margin:0; font-size:26px; line-height:1.4; }
.registration-form input { width:100%; font-size:16px; }
.registration-form label[for=captcha-answer] { margin-bottom:8px; }
.registration-form .notice { margin:12px 0; }
.captcha-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.captcha-row img { max-width:100%; height:auto; border-radius:8px; background:#eef2f6; }
#captcha-answer { text-transform:uppercase; }
#registration-success { margin:4px 0 0; color:var(--accent-text); font-size:14px; }
#registration-success:empty { display:none; }

/* Authentication has one theme action and one compact, scrollable form. */
html:has(.app[data-view=login]),body:has(.app[data-view=login]) {height:auto;overflow:auto}
.app[data-view=login] {height:auto;min-height:100dvh}
.app[data-view=login] #entry {width:min(420px,calc(100% - 32px));margin:24px auto;padding:24px}
.app[data-view=login] #entry-form {margin:0;padding:0}
.account-form :is(input,button[type=submit]) {min-height:44px}

@media(max-width:1000px) {
  .account-form {font-size:14px}
  .account-form .help {font-size:13px;line-height:1.7;overflow-wrap:anywhere}
  .toolbar button {font-size:14px}
  .settings-dialog .modal-head {padding:14px 16px;gap:12px}
  .settings-dialog .modal-header-actions {gap:4px;flex:none}
  .settings-dialog .modal-head .icon,.settings-dialog #settings-theme-toggle {min-width:44px;min-height:44px}
  .settings-dialog .tabs {padding:8px 12px;gap:8px}
  .settings-dialog .tabs button {min-width:0;white-space:nowrap;justify-content:center;padding-inline:8px}
  .settings-dialog #preferences {padding:20px 16px 16px;overscroll-behavior:contain}
  .settings-dialog .section-intro {margin-bottom:16px}
  .settings-dialog :is(.help,.material-result li,#task-text) {overflow-wrap:anywhere}
  .settings-dialog .role-card,.settings-dialog .group {padding:16px}
  .settings-dialog #background-fields {padding:0}
  .settings-dialog .background-actions {gap:12px;margin-bottom:16px}
  .settings-dialog .modal-actions {padding:12px 16px max(12px,env(safe-area-inset-bottom))}
  .settings-dialog .modal-actions button {flex:1;min-width:0}
  .template-row-actions button,.template-tabs button {min-height:44px}
  .graph-tools button,.zoom-tools button {min-width:44px;min-height:44px}
  .wave-pane .wave-header {display:grid;grid-template-columns:minmax(0,1fr);gap:8px;padding:12px}
  .wave-recording {width:100%;gap:8px}
  .wave-recording .call-id {text-align:left;font-size:12px}
  .wave-header .subtle,.wave-header .icon {min-width:44px;min-height:44px}
  #wave-position {font-size:12px}
  .conversation-pane .pane-header {flex-wrap:wrap;gap:8px}
}
#account-name{font-size:13px}#quota-dialog{width:min(560px,94vw);padding:24px;max-height:90vh;overflow:auto}#quota-reasons{padding-left:22px;line-height:1.8}#quota-form>label:not(.check){display:flex;flex-direction:column;gap:8px}#quota-form .check{margin:18px 0}#quota-current,#quota-summary{overflow-wrap:anywhere}#quota-notice{color:var(--danger,#de815d)}#serial-change{margin-bottom:12px}#quota-dialog input:not([type=checkbox]){width:100%}
