:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #111827;
  --muted: #637083;
  --line: #d5dae3;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --decision: #e9c46a;
  --danger: #b42318;
  --danger-strong: #8f1d14;
  --ok: #1f7a4d;
  --surface: #101820;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 11px;
  background: var(--surface);
}

.brand-mark::before,
.brand-mark::after,
.brand-ring {
  position: absolute;
  content: "";
  border-radius: 999px;
}

.brand-mark::before {
  inset: 12px;
  background: var(--bg);
}

.brand-mark::after {
  inset: 18px;
  background: var(--accent);
}

.brand-ring {
  top: 21px;
  left: 21px;
  width: 6px;
  height: 6px;
  z-index: 2;
  background: var(--decision);
}

.brand-lockup h1,
.brand-lockup p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

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

.status-pill {
  min-width: 112px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-align: center;
  font-weight: 700;
}

.status-pill.online {
  color: var(--ok);
  border-color: #a7d7bd;
  background: #eef9f2;
}

.auth-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 10px 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.auth-bar[hidden] {
  display: none;
}

.auth-bar button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #e8f7f4;
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
}

.auth-bar [role="status"] {
  grid-column: 1 / -1;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}

.tab,
.toolbar button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.tab:not(.active):hover {
  border-color: #9fb4c8;
}

.connect-button {
  min-width: 112px;
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 800;
}

.connect-button:not(:disabled) {
  background: #e8f7f4;
}

.connect-button:hover:not(:disabled) {
  background: #d7f0eb;
}

.connect-button.stopping:not(:disabled) {
  border-color: #b42318;
  background: #fff1f0;
  color: #b42318;
}

.connection-toast {
  position: sticky;
  top: 8px;
  z-index: 10;
  width: fit-content;
  max-width: min(560px, 100%);
  margin: 12px 0 -4px auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
  font-weight: 800;
}

.connection-toast[data-state="connected"] {
  color: var(--ok);
  border-color: #a7d7bd;
  background: #eef9f2;
}

.connection-toast[data-state="connecting"],
.connection-toast[data-state="disconnecting"] {
  color: #8a5a00;
  border-color: #f0d083;
  background: #fff8df;
}

.connection-toast[data-state="disconnected"] {
  color: var(--danger);
  border-color: #f0b5ad;
  background: #fff4f2;
}

.error-toast {
  color: var(--danger);
  border-color: #f0b5ad;
  background: #fff4f2;
}

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

.tab.active {
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 700;
}

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

.config-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

#configStepStatus,
#realtimeStepStatus,
#transcribeStepStatus {
  min-width: 164px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  text-align: center;
}

#configStepStatus[data-state="pass"],
#realtimeStepStatus[data-state="pass"],
#transcribeStepStatus[data-state="pass"] {
  border-color: #a7d7bd;
  background: #eef9f2;
  color: var(--ok);
}

#configStepStatus[data-state="blocked"],
#realtimeStepStatus[data-state="blocked"],
#transcribeStepStatus[data-state="blocked"] {
  border-color: #f0b5ad;
  background: #fff4f2;
  color: var(--danger);
}

#configStepStatus[data-state="recording"],
#configStepStatus[data-state="checking"],
#realtimeStepStatus[data-state="recording"],
#realtimeStepStatus[data-state="checking"],
#transcribeStepStatus[data-state="recording"],
#transcribeStepStatus[data-state="checking"] {
  border-color: #b7c7dc;
  background: #eef5ff;
  color: #315f95;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

select {
  appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 0 56px 0 12px;
  border: 2px solid #9fb4c8;
  border-radius: 6px;
  background:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%230b5f59'%20stroke-width='2.6'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E") no-repeat right 13px center / 22px 22px,
    linear-gradient(90deg, #fff calc(100% - 48px), #e8f7f4 calc(100% - 48px));
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

select:hover:not(:disabled) {
  border-color: var(--accent);
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
  outline: none;
}

input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid #9fb4c8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid #9fb4c8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
  outline: none;
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.checkbox-field {
  align-content: end;
}

.meter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.meter-row > div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.meter-row strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.1;
}

.realtime-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.realtime-card {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.realtime-card strong,
.realtime-card span {
  display: block;
}

.muted-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.key-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.key-row button,
.realtime-toolbar button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.realtime-toolbar {
  grid-template-columns: minmax(240px, 1fr) repeat(3, auto);
}

.transcribe-toolbar {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.realtime-meter-row {
  margin-top: 16px;
}

.browser-demo {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
}

.browser-demo-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.browser-demo h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.browser-demo-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.browser-demo-actions button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.browser-demo-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.browser-demo-status > div {
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.browser-demo-status strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.realtime-output {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.realtime-output > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.realtime-output p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.output-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.output-heading button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.realtime-output pre {
  min-height: 42px;
  max-height: 180px;
  margin: 6px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.chat-box {
  display: grid;
  gap: 14px;
}

.timeline-list {
  min-height: 180px;
  max-height: 360px;
  margin: 0;
  padding: 12px 12px 12px 32px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.timeline-list li {
  margin: 0 0 10px;
  color: var(--ink);
}

.timeline-list code {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

#robotConfigText,
#connectionCapabilityText,
#statusText {
  width: 100%;
  min-height: 180px;
  margin: 14px 0 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  color: #d8e6ef;
}

.debug-log ol {
  max-height: 220px;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.debug-log li {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.debug-log li:first-child {
  border-top: 0;
}

.debug-log li strong {
  color: var(--ink);
  font-size: 13px;
}

.debug-log li span {
  color: var(--muted);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.recorder-display {
  padding: 16px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: var(--surface);
  color: #e5edf5;
}

.timer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#recordTimer {
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
}

#levelText {
  color: #9fb2c7;
  font-weight: 700;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 48 / 11;
  border: 1px solid #263445;
  border-radius: 6px;
  background: var(--surface);
}

.level-bar {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #263445;
}

.level-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #facc15, #ef4444);
  transition: width 120ms ease;
}

.recorder {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(220px, 360px);
  gap: 14px;
  align-items: center;
  margin-top: 16px;
}

.record-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 132px;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: var(--danger);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.record-button:hover:not(:disabled) {
  background: var(--danger-strong);
}

.record-button.recording {
  background: #111827;
}

.record-button.stopping {
  background: #4b5563;
}

.record-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
}

.record-button .record-dot {
  color: #fff;
}

.record-button.recording .record-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.recorder-state {
  display: grid;
  gap: 4px;
}

.recorder-state span {
  color: var(--muted);
}

audio {
  width: 100%;
}

@media (max-width: 760px) {
  .topbar,
  .auth-bar,
  .config-heading,
  .recorder,
  .key-row,
  .realtime-grid,
  .toolbar,
  .meter-row,
  .browser-demo-status,
  .output-heading {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .browser-demo-main {
    align-items: stretch;
    flex-direction: column;
  }

  .browser-demo-actions {
    justify-content: stretch;
  }

  .browser-demo-actions button {
    flex: 1 1 180px;
  }

  #recordTimer {
    font-size: 28px;
  }
}

/* Neutral efficiency workbench 1.0.0 */
.efficiency-ui { --bg:var(--ui-background); --ink:var(--ui-text); --muted:var(--ui-muted-text); --line:var(--ui-border); --panel:var(--ui-surface); --accent:var(--ui-accent); --accent-strong:var(--ui-accent); --danger:var(--ui-danger); --danger-strong:var(--ui-danger); --ok:var(--ui-success); --surface:var(--ui-muted-surface); }
.efficiency-ui .brand-mark { display:none; }
.efficiency-ui .topbar { min-height:64px; flex-wrap:wrap; padding-bottom:16px; }
.efficiency-ui .brand-lockup { flex:1; }
.efficiency-ui .tabs { flex-wrap:wrap; gap:16px; padding:12px 0; border-bottom:1px solid var(--line); }
.efficiency-ui .tab-group { display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
.efficiency-ui .tab-group-label { font-size:12px; color:var(--muted); margin-right:4px; }
.efficiency-ui .tab { border-color:transparent; background:transparent; padding:0 10px; }
.efficiency-ui .tab.active { background:var(--ui-accent-surface); color:var(--accent); border-color:transparent; }
.efficiency-ui .panel { padding:16px 0; border:0; border-radius:0; }
.efficiency-ui .auth-bar { background:var(--ui-muted-surface); border:0; }
.efficiency-ui .status-pill, .efficiency-ui .connection-toast { background:var(--panel); border-color:var(--line); box-shadow:none; font-weight:600; }
.efficiency-ui .status-pill.online, .efficiency-ui .connection-toast[data-state="connected"] { color:var(--ok); background:var(--ui-muted-surface); }
.efficiency-ui .connection-toast[data-state="connecting"], .efficiency-ui .connection-toast[data-state="disconnecting"] { color:var(--ui-warning); background:var(--ui-muted-surface); border-color:var(--line); }
.efficiency-ui .connection-toast[data-state="disconnected"], .efficiency-ui .error-toast { color:var(--danger); background:var(--ui-muted-surface); border-color:var(--line); }
.efficiency-ui .field select, .efficiency-ui .field input, .efficiency-ui .field textarea { background:var(--panel); color:var(--ink); border:1px solid var(--line); box-shadow:none; }
.efficiency-ui .toolbar button, .efficiency-ui .key-row button, .efficiency-ui .realtime-toolbar button, .efficiency-ui .browser-demo-actions button, .efficiency-ui .output-heading button { background:var(--panel); color:var(--ink); }
.efficiency-ui .connect-button:not(:disabled), .efficiency-ui .auth-bar button { background:var(--ui-accent-surface); color:var(--accent); font-weight:600; }
.efficiency-ui .connect-button.stopping:not(:disabled) { background:var(--ui-muted-surface); color:var(--danger); border-color:var(--danger); }
.efficiency-ui .meter-row > div, .efficiency-ui .realtime-card, .efficiency-ui .browser-demo-status > div, .efficiency-ui .realtime-output > div { background:transparent; border:0; border-left:1px solid var(--line); border-radius:0; }
.efficiency-ui .browser-demo { background:transparent; border:0; border-top:1px solid var(--line); border-radius:0; }
.efficiency-ui .timeline-list, .efficiency-ui .debug-log, .efficiency-ui .recorder-display { background:var(--ui-muted-surface); color:var(--ink); border-color:var(--line); }
.efficiency-ui .timer-row, .efficiency-ui .recorder-display span { color:var(--ink); }
.efficiency-ui .browser-demo h3 { font-size:16px; }
.efficiency-ui .meter-row strong { font-size:22px; }
.efficiency-ui .config-heading strong { background:var(--ui-muted-surface); color:var(--muted); border-color:var(--line); }
.efficiency-ui .config-heading strong[data-state="connected"], .efficiency-ui .config-heading strong[data-state="ready"] { color:var(--ok); }
.efficiency-ui .config-heading strong[data-state="blocked"], .efficiency-ui .config-heading strong[data-state="error"] { color:var(--danger); }
@media(max-width:767px) { .efficiency-ui .tabs { gap:8px; } .efficiency-ui .tab-group { width:100%; } .efficiency-ui .tab-group-label { width:64px; } .efficiency-ui .auth-bar { grid-template-columns:1fr; } .efficiency-ui .topbar { gap:8px; } .efficiency-ui .status-pill { min-width:0; } }
