:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-deep: #050b14;
  --bg-glow: #0d1d32;
  --panel: rgba(14, 27, 45, 0.86);
  --panel-solid: #0f1d30;
  --panel-raised: #13253d;
  --panel-soft: rgba(21, 39, 62, 0.72);
  --panel-muted: rgba(8, 18, 31, 0.62);
  --text: #eaf2fb;
  --text-soft: #c8d5e5;
  --muted: #8fa3ba;
  --muted-strong: #a9bbcf;
  --line: rgba(167, 194, 222, 0.14);
  --line-strong: rgba(167, 194, 222, 0.25);
  --accent: #62e1cf;
  --accent-strong: #36c8b4;
  --accent-soft: rgba(98, 225, 207, 0.13);
  --accent-faint: rgba(98, 225, 207, 0.06);
  --violet: #a990ff;
  --violet-soft: rgba(169, 144, 255, 0.14);
  --orange: #ffbf78;
  --orange-soft: rgba(255, 191, 120, 0.14);
  --danger: #ff7e8a;
  --danger-soft: rgba(255, 126, 138, 0.13);
  --warning: #ffd37d;
  --warning-soft: rgba(255, 211, 125, 0.13);
  --ok: #6fe5a4;
  --ok-soft: rgba(111, 229, 164, 0.13);
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.22);
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.16);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg-deep);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 3% -6%, rgba(47, 122, 156, 0.22), transparent 62%),
    radial-gradient(760px 480px at 98% 2%, rgba(100, 79, 176, 0.18), transparent 61%),
    linear-gradient(145deg, var(--bg-deep) 0%, var(--bg) 47%, #091625 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.26;
  background-image:
    linear-gradient(rgba(150, 185, 215, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 185, 215, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

::selection {
  color: #031117;
  background: var(--accent);
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

code,
pre,
input[type="text"] {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

code {
  color: #b7c9dc;
  font-size: 0.9em;
}

.app-shell {
  width: min(1840px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px clamp(16px, 2.5vw, 42px) 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 68px;
  margin-bottom: 20px;
}

.brand,
.modebar,
.signal-header,
.signal-footer,
.panel-heading,
.action-row,
.transcript-heading,
.transcript-actions,
.connection-summary {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 15px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 1px solid rgba(98, 225, 207, 0.45);
  border-radius: 15px;
  color: #071c21;
  background:
    linear-gradient(145deg, #8cf0df 0%, #52d9c5 55%, #3ab9af 100%);
  box-shadow: 0 0 0 5px rgba(98, 225, 207, 0.05), 0 10px 26px rgba(39, 188, 168, 0.18);
  font-size: 16px;
  font-weight: 850;
  letter-spacing: -0.08em;
}

.brand h1 {
  margin: 1px 0 0;
  color: var(--text);
  font-size: clamp(20px, 2.1vw, 27px);
  font-weight: 740;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.brand h1 span {
  color: var(--accent);
  font-weight: 560;
}

.brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.eyebrow {
  color: #7f9ab8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.25;
  text-transform: uppercase;
}

.mini-badge,
.signal-tag,
.soon-tag {
  white-space: nowrap;
}

.status-dot,
.legend-dot,
.provider-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-soft);
  background: var(--panel-raised);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease,
    box-shadow 160ms ease, transform 160ms ease;
}

.button:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--text);
  background: #19304c;
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button.small {
  min-height: 32px;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 11px;
}

.button.primary {
  border-color: rgba(98, 225, 207, 0.55);
  color: #06201f;
  background: linear-gradient(135deg, #86eddd 0%, #4ed5c0 100%);
  box-shadow: 0 9px 22px rgba(44, 197, 175, 0.17);
}

.button.primary:hover:not(:disabled) {
  border-color: rgba(164, 248, 234, 0.8);
  color: #031716;
  background: linear-gradient(135deg, #9af4e5 0%, #59e0ca 100%);
  box-shadow: 0 12px 28px rgba(44, 197, 175, 0.26);
}

.button.danger {
  border-color: rgba(255, 126, 138, 0.28);
  color: #ffacb4;
  background: var(--danger-soft);
}

.button.danger:hover:not(:disabled) {
  border-color: rgba(255, 126, 138, 0.52);
  color: #ffd1d5;
  background: rgba(255, 126, 138, 0.2);
}

.button.ghost {
  border-color: var(--line);
  color: var(--muted-strong);
  background: rgba(13, 27, 44, 0.48);
}

.button.ghost:hover:not(:disabled) {
  border-color: rgba(98, 225, 207, 0.36);
  color: var(--accent);
  background: var(--accent-faint);
}

.button.text-button {
  min-height: 28px;
  padding: 4px 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.button.text-button:hover:not(:disabled) {
  color: var(--accent);
  background: transparent;
  transform: none;
}

.button-icon {
  display: inline-grid;
  width: 14px;
  height: 14px;
  place-items: center;
  color: currentColor;
  font-size: 9px;
}

.modebar {
  justify-content: space-between;
  gap: 20px;
  min-height: 52px;
  margin-bottom: 16px;
  padding: 7px 10px 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(12, 25, 42, 0.64);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.mode-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.mode-tab:hover:not(:disabled) {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
}

.mode-tab.active {
  border-color: rgba(98, 225, 207, 0.2);
  color: var(--accent);
  background: var(--accent-soft);
}

.mode-tab:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.soon-tag {
  padding: 3px 6px;
  border: 1px solid rgba(169, 144, 255, 0.26);
  border-radius: 999px;
  color: #c6baff;
  background: var(--violet-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.connection-summary {
  min-width: 0;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.summary-label {
  color: #7189a5;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.connection-summary code {
  max-width: min(40vw, 430px);
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(245px, 280px) minmax(430px, 1fr) minmax(260px, 325px);
  align-items: start;
  gap: 15px;
}

.left-rail,
.main-column,
.right-rail {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 15px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, rgba(17, 33, 53, 0.91), rgba(11, 23, 39, 0.88));
  box-shadow: var(--shadow-soft), inset 0 1px rgba(255, 255, 255, 0.025);
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.panel-heading h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.panel-heading.compact-heading {
  align-items: flex-start;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(7, 16, 29, 0.38);
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
}

.mini-badge.ok,
.mini-badge.ready,
.mini-badge.active,
.mini-badge.success {
  border-color: rgba(111, 229, 164, 0.3);
  color: var(--ok);
  background: var(--ok-soft);
}

.mini-badge.warn,
.mini-badge.pending,
.mini-badge.busy {
  border-color: rgba(255, 211, 125, 0.3);
  color: var(--warning);
  background: var(--warning-soft);
}

.mini-badge.error {
  border-color: rgba(255, 126, 138, 0.34);
  color: var(--danger);
  background: var(--danger-soft);
}

.input-panel,
.settings-panel,
.action-panel,
.roadmap-panel,
.metrics-panel,
.details-panel {
  padding: 17px;
}

.source-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 17px 0 13px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 15, 26, 0.45);
}

.source-tab {
  min-width: 0;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.source-tab:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
}

.source-tab.active {
  border-color: rgba(98, 225, 207, 0.22);
  color: var(--accent);
  background: var(--accent-soft);
}

.tab-icon {
  margin-right: 3px;
  color: currentColor;
  font-size: 13px;
}

.source-content {
  min-width: 0;
}

.source-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(98, 225, 207, 0.16);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(98, 225, 207, 0.1), rgba(98, 225, 207, 0.035));
}

.callout-icon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 7px;
  color: var(--accent);
  background: rgba(98, 225, 207, 0.14);
  font-size: 12px;
}

.source-callout strong {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.source-callout p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.source-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 1px 0;
  color: var(--muted);
  font-size: 10px;
}

.source-detail-row + .source-detail-row {
  padding-top: 7px;
}

.source-detail-row strong {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 650;
  text-align: right;
}

.file-drop {
  position: relative;
  display: grid;
  min-height: 126px;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 15px;
  border: 1px dashed rgba(144, 174, 204, 0.36);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(5, 14, 25, 0.35);
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.file-drop:hover,
.file-drop.dragover,
.file-drop.dragging {
  border-color: rgba(98, 225, 207, 0.66);
  color: var(--text-soft);
  background: var(--accent-faint);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-drop-icon {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 2px;
  place-items: center;
  border: 1px solid rgba(98, 225, 207, 0.2);
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 18px;
}

.file-drop strong {
  color: var(--text-soft);
  font-size: 11px;
}

.file-drop span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.file-info {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(6, 15, 26, 0.35);
}

.file-name {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 650;
}

.field:first-of-type {
  margin-top: 16px;
}

.field.compact-field {
  margin-top: 12px;
}

.field em {
  color: #7088a4;
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
}

.field small {
  color: #748ba4;
  font-size: 10px;
  font-weight: 450;
  line-height: 1.4;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--text-soft);
  background: rgba(5, 14, 25, 0.54);
  font-size: 12px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.field input,
.field select {
  height: 37px;
  padding: 8px 10px;
}

.field textarea {
  min-height: 64px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.45;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(98, 225, 207, 0.55);
  background: rgba(7, 19, 32, 0.78);
  box-shadow: 0 0 0 3px rgba(98, 225, 207, 0.08);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #60748b;
}

.field select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, #88a2bd 50%),
    linear-gradient(135deg, #88a2bd 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.field select option {
  color: var(--text);
  background: var(--panel-solid);
}

.toggle-list {
  display: grid;
  gap: 1px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.toggle-row {
  /* Keep checkbox focus inside the same scroll container as its label. */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 8px 0;
  cursor: pointer;
}

.toggle-row > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.toggle-row strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 680;
}

.toggle-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-ui {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(5, 14, 25, 0.58);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.toggle-ui::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7890a8;
  content: "";
  transition: transform 160ms ease, background 160ms ease;
}

.toggle-row input:checked + .toggle-ui {
  border-color: rgba(98, 225, 207, 0.55);
  background: rgba(98, 225, 207, 0.22);
  box-shadow: 0 0 0 3px rgba(98, 225, 207, 0.06);
}

.toggle-row input:checked + .toggle-ui::after {
  transform: translateX(16px);
  background: var(--accent);
}

.action-panel {
  border-color: rgba(98, 225, 207, 0.2);
  background: linear-gradient(150deg, rgba(27, 57, 72, 0.78), rgba(13, 29, 45, 0.9));
}

.action-row {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 6px;
}

.action-row .button {
  min-width: 0;
  min-height: 36px;
  gap: 4px;
  padding: 8px 6px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.action-row .button-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

.action-panel .text-button {
  margin-top: 11px;
}

.action-hint {
  margin: 9px 0 0;
  color: #7089a2;
  font-size: 10px;
  line-height: 1.5;
}

.action-hint code {
  color: #a8bdcf;
}

.roadmap-panel {
  background: linear-gradient(145deg, rgba(21, 29, 54, 0.89), rgba(12, 22, 39, 0.88));
}

.roadmap-panel h2 {
  margin: 4px 0 15px;
  color: var(--text);
  font-size: 15px;
  letter-spacing: -0.02em;
}

.roadmap-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.roadmap-item > span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  color: #beafff;
  background: var(--violet-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 750;
}

.roadmap-item strong,
.roadmap-item small {
  display: block;
}

.roadmap-item strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.roadmap-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.signal-panel {
  overflow: hidden;
  border-color: rgba(98, 225, 207, 0.2);
  background:
    radial-gradient(560px 220px at 45% -15%, rgba(98, 225, 207, 0.12), transparent 68%),
    linear-gradient(150deg, rgba(17, 38, 57, 0.94), rgba(10, 23, 39, 0.93));
}

.signal-header {
  justify-content: space-between;
  gap: 15px;
  padding: 19px 20px 13px;
}

.signal-header h2 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 720;
  letter-spacing: -0.03em;
}

.session-clock {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 76px;
  text-align: right;
}

.session-clock span {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.11em;
}

.session-clock strong {
  color: var(--text-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.waveform-wrap {
  position: relative;
  min-height: 188px;
  margin: 0 13px;
  overflow: hidden;
  border: 1px solid rgba(98, 225, 207, 0.13);
  border-radius: 13px;
  background:
    linear-gradient(rgba(98, 225, 207, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(98, 225, 207, 0.04) 1px, transparent 1px),
    rgba(4, 14, 24, 0.65);
  background-size: 100% 25%, 10% 100%, auto;
}

.waveform-wrap::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.025);
  border-radius: inherit;
  content: "";
}

#waveform {
  display: block;
  width: 100%;
  height: 188px;
}

.waveform-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: #7190a9;
  font-size: 11px;
  pointer-events: none;
}

.pulse-ring {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(98, 225, 207, 0.5);
  border-radius: 50%;
  background: rgba(98, 225, 207, 0.09);
}

.pulse-ring::after {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 15px rgba(98, 225, 207, 0.6);
  content: "";
}

.signal-footer {
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 11px 20px 14px;
}

.signal-tags {
  display: flex;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.signal-tag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 4px 8px;
  border: 1px solid rgba(98, 225, 207, 0.25);
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 650;
}

.signal-tag.muted {
  border-color: var(--line);
  color: var(--muted);
  background: rgba(5, 14, 25, 0.38);
}

.audio-player-wrap {
  min-width: min(250px, 100%);
}

.audio-player-wrap audio {
  display: block;
  width: min(290px, 100%);
  height: 31px;
  filter: invert(0.86) hue-rotate(155deg) saturate(0.55);
  opacity: 0.84;
}

.transcript-panel {
  padding: 18px 20px 20px;
}

.transcript-heading {
  gap: 10px;
}

.transcript-actions {
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.transcript-actions .mini-badge {
  margin-right: 3px;
}

.transcript-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 34px;
  margin-top: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.transcript-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.transcript-legend > span:last-child {
  margin-left: auto;
  color: #7890a7;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.legend-dot {
  width: 6px;
  height: 6px;
  flex-basis: 6px;
}

.legend-dot.final {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(98, 225, 207, 0.4);
}

.legend-dot.pending {
  background: var(--orange);
  box-shadow: 0 0 8px rgba(255, 191, 120, 0.36);
}

.transcript-empty {
  display: grid;
  min-height: 224px;
  place-content: center;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-glyph {
  display: grid;
  width: 43px;
  height: 43px;
  margin-bottom: 4px;
  place-items: center;
  border: 1px solid rgba(169, 144, 255, 0.25);
  border-radius: 13px;
  color: #c0b4ff;
  background: var(--violet-soft);
  font-family: Georgia, serif;
  font-size: 18px;
  font-style: italic;
}

.transcript-empty strong {
  color: var(--text-soft);
  font-size: 13px;
}

.transcript-empty p {
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.transcript-stream {
  display: grid;
  gap: 13px;
  min-height: 224px;
  padding: 18px 0 3px;
}

.transcript-block {
  min-width: 0;
}

.block-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: #8ba3bc;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.final-transcript,
.pending-transcript {
  min-height: 34px;
  color: var(--text);
  font-size: clamp(18px, 2.1vw, 24px);
  font-weight: 560;
  letter-spacing: 0.02em;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.pending-block {
  padding: 11px 13px 12px;
  border: 1px solid rgba(255, 191, 120, 0.21);
  border-radius: 11px;
  background: var(--orange-soft);
}

.pending-block .block-label {
  color: var(--orange);
}

.pending-transcript {
  color: #ffd5a7;
  font-size: 16px;
}

.event-panel {
  overflow: hidden;
  border-color: rgba(98, 225, 207, 0.18);
  background:
    linear-gradient(180deg, rgba(98, 225, 207, 0.045), transparent 58%),
    linear-gradient(155deg, rgba(17, 33, 53, 0.91), rgba(11, 23, 39, 0.88));
}

.event-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 11px 18px 9px;
  border-bottom: 1px solid rgba(167, 194, 222, 0.09);
}

.event-panel-heading h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.event-summary-status,
.event-live-state {
  display: inline-flex;
  align-items: center;
}

.event-summary-status {
  gap: 8px;
}

.event-live-state {
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.event-live-state i {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--muted);
}

.event-live-state.following {
  color: var(--accent);
}

.event-live-state.following i {
  background: var(--accent);
  box-shadow: 0 0 9px rgba(98, 225, 207, 0.55);
}

.event-live-state.paused {
  color: var(--warning);
}

.event-live-state.paused i {
  background: var(--warning);
}

.event-panel > summary,
.details-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 15px 18px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}

.event-panel > summary::-webkit-details-marker,
.details-panel summary::-webkit-details-marker {
  display: none;
}

.event-panel > summary::after,
.details-panel summary::after {
  width: 7px;
  height: 7px;
  border-right: 1px solid #8ca4bc;
  border-bottom: 1px solid #8ca4bc;
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.event-panel[open] > summary::after,
.details-panel details[open] > summary::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.event-panel > summary > span:first-child {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.event-log {
  display: flex;
  flex-direction: column;
  max-height: 230px;
  overflow: auto;
  padding: 0 18px 14px;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  scrollbar-color: rgba(133, 163, 191, 0.3) transparent;
  scrollbar-width: thin;
}

.event-log::before {
  flex: 1 0 auto;
  content: "";
}

.event-empty {
  display: grid;
  min-height: 74px;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
}

.event-item,
.event-row {
  display: grid;
  flex: 0 0 auto;
  gap: 9px;
  align-items: start;
  min-height: 34px;
  padding: 8px 0;
  border-top: 1px solid rgba(167, 194, 222, 0.09);
  color: var(--muted);
  font-size: 10px;
  animation: event-arrive 180ms ease-out;
}

.event-item {
  grid-template-columns: 74px 8px minmax(0, 1fr);
}

.event-row {
  grid-template-columns: 74px minmax(54px, auto) minmax(0, 1fr);
}

.event-item:first-child,
.event-row:first-child {
  border-top: 0;
}

.event-time {
  color: #7089a4;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.event-dot,
.event-item::before {
  width: 6px;
  height: 6px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(98, 225, 207, 0.3);
  content: "";
}

.event-row .event-type {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-row.info .event-type {
  color: var(--text-soft);
}

.event-row.success .event-type {
  color: var(--ok);
}

.event-row.warn .event-type {
  color: var(--warning);
}

.event-row.error .event-type {
  color: var(--danger);
}

.event-row .event-message {
  min-width: 0;
  overflow-wrap: anywhere;
}

.event-item.error,
.event-row.error {
  color: #ffb7be;
}

.event-item.error::before,
.event-row.error .event-dot {
  background: var(--danger);
}

.event-row.error::before {
  background: var(--danger);
}

.event-kind {
  color: var(--text-soft);
  font-weight: 650;
}

.event-message {
  overflow-wrap: anywhere;
}

@keyframes event-arrive {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metrics-panel {
  background:
    radial-gradient(420px 200px at 92% -10%, rgba(169, 144, 255, 0.1), transparent 70%),
    linear-gradient(155deg, rgba(17, 31, 54, 0.92), rgba(11, 23, 39, 0.9));
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.metric-card {
  display: grid;
  min-width: 0;
  min-height: 93px;
  align-content: space-between;
  gap: 6px;
  padding: 11px 11px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(5, 14, 25, 0.43);
}

.metric-card.accent {
  border-color: rgba(98, 225, 207, 0.26);
  background: linear-gradient(145deg, rgba(98, 225, 207, 0.11), rgba(5, 14, 25, 0.4));
}

.metric-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card strong {
  overflow: hidden;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card.accent strong {
  color: var(--accent);
}

.metric-card small {
  overflow: hidden;
  color: #6f879f;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-panel {
  padding: 0;
}

.details-panel details + details {
  border-top: 1px solid var(--line);
}

.details-panel summary {
  min-height: 47px;
  padding: 13px 17px;
  font-size: 11px;
}

.info-list {
  display: grid;
  gap: 8px;
  padding: 0 17px 15px;
}

.info-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
}

.info-list strong {
  max-width: 62%;
  overflow: hidden;
  color: var(--text-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.json-view {
  max-height: 188px;
  margin: 0 17px 15px;
  overflow: auto;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #9db6cd;
  background: rgba(4, 12, 22, 0.55);
  font-size: 9px;
  line-height: 1.55;
  scrollbar-color: rgba(133, 163, 191, 0.3) transparent;
  scrollbar-width: thin;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 17px;
  padding: 0 3px;
  color: #66809b;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.01em;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 22px;
  max-width: min(390px, calc(100vw - 44px));
  padding: 11px 14px;
  border: 1px solid rgba(98, 225, 207, 0.3);
  border-radius: 10px;
  color: var(--text-soft);
  background: rgba(14, 31, 48, 0.96);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible,
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

body.recording .brand-mark {
  box-shadow: 0 0 0 5px rgba(98, 225, 207, 0.08), 0 0 26px rgba(39, 188, 168, 0.28);
  animation: mark-breathe 2s ease-in-out infinite;
}

body.recording .waveform-wrap,
body.processing .waveform-wrap {
  border-color: rgba(98, 225, 207, 0.35);
}

body.error .brand-mark {
  border-color: rgba(255, 126, 138, 0.48);
  color: #2b0f17;
  background: linear-gradient(145deg, #ffb2b8, #ed7787);
}

@keyframes soft-pulse {
  0%,
  100% {
    opacity: 0.62;
  }
  50% {
    opacity: 1;
  }
}

@keyframes mark-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.035);
  }
}

@media (max-width: 1260px) {
  .workspace-grid {
    grid-template-columns: minmax(230px, 265px) minmax(420px, 1fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr) minmax(0, 1fr);
    align-items: start;
  }

  .right-rail .metrics-panel,
  .right-rail .details-panel {
    min-height: 100%;
  }
}

@media (max-width: 930px) {
  .app-shell {
    padding: 17px 14px 24px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
  }

  .modebar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }

  .connection-summary {
    width: 100%;
    padding: 0 4px 4px;
  }

  .connection-summary code {
    max-width: calc(100vw - 150px);
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .left-rail,
  .right-rail {
    grid-column: auto;
  }

  .left-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .left-rail .action-panel,
  .left-rail .roadmap-panel {
    grid-column: 1 / -1;
  }

  .right-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 620px) {
  body {
    font-size: 13px;
  }

  .app-shell {
    padding: 12px 10px 20px;
  }

  .brand-mark {
    width: 43px;
    height: 43px;
    flex-basis: 43px;
    border-radius: 13px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .mode-tabs {
    width: 100%;
  }

  .mode-tab {
    flex: 1;
    justify-content: center;
    padding-inline: 8px;
  }

  .connection-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .connection-summary code {
    max-width: 100%;
  }

  .left-rail,
  .right-rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .left-rail .action-panel,
  .left-rail .roadmap-panel {
    grid-column: auto;
  }

  .input-panel,
  .settings-panel,
  .action-panel,
  .roadmap-panel,
  .metrics-panel,
  .details-panel {
    padding: 14px;
  }

  .signal-header {
    align-items: flex-start;
    padding: 16px 15px 12px;
  }

  .signal-header h2 {
    font-size: 17px;
  }

  .session-clock {
    min-width: 67px;
  }

  .waveform-wrap {
    min-height: 150px;
    margin-inline: 10px;
  }

  #waveform {
    height: 150px;
  }

  .signal-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 15px 14px;
  }

  .audio-player-wrap,
  .audio-player-wrap audio {
    width: 100%;
  }

  .transcript-panel {
    padding: 15px;
  }

  .transcript-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .transcript-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .transcript-legend {
    gap: 9px;
  }

  .transcript-legend > span:last-child {
    margin-left: auto;
  }

  .transcript-empty,
  .transcript-stream {
    min-height: 190px;
  }

  .final-transcript {
    font-size: 18px;
  }

  .event-panel > summary,
  .event-log {
    padding-inline: 14px;
  }

  .event-item {
    grid-template-columns: 62px 8px minmax(0, 1fr);
  }

  .event-row {
    grid-template-columns: 62px minmax(50px, auto) minmax(0, 1fr);
  }

  .footer-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding-inline: 2px;
    line-height: 1.4;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Keep the desktop workspace inside one viewport. Long logs and side rails
   scroll independently so the main interaction stays visible at a glance. */
@media (min-width: 931px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    display: grid;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .workspace-grid {
    min-height: 0;
    height: 100%;
    align-items: stretch;
  }

  .left-rail,
  .main-column,
  .right-rail {
    min-height: 0;
  }

  .left-rail,
  .right-rail {
    overflow-y: auto;
    scrollbar-color: rgba(133, 163, 191, 0.3) transparent;
    scrollbar-width: thin;
  }

  .main-column {
    min-height: 0;
    /* Keep both live text surfaces readable while audio is running. */
    grid-template-rows: minmax(165px, 0.7fr) minmax(220px, 1.04fr) minmax(130px, 0.64fr);
    overflow: hidden;
  }

  .main-column > .panel {
    min-height: 0;
  }

  .signal-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
  }

  .waveform-wrap {
    min-height: 0;
  }

  #waveform {
    height: 100%;
    min-height: 100px;
  }

  .transcript-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-height: 0;
  }

  .transcript-empty,
  .transcript-stream {
    min-height: 0;
    overflow-y: auto;
  }

  .transcript-stream {
    align-content: start;
    overscroll-behavior: contain;
    scrollbar-color: rgba(133, 163, 191, 0.3) transparent;
    scrollbar-width: thin;
  }

  .event-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .event-log {
    min-height: 0;
    max-height: none;
  }
}

/* Restore normal document flow on tablets and phones. */
@media (max-width: 930px) {
  html,
  body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .workspace-grid {
    height: auto;
  }

  .left-rail,
  .main-column,
  .right-rail {
    min-height: auto;
    overflow: visible;
  }

  .main-column {
    grid-template-rows: none;
    overflow: visible;
  }

  .signal-panel,
  .transcript-panel,
  .event-panel {
    display: block;
  }

  .waveform-wrap {
    min-height: 188px;
  }

  #waveform {
    height: 188px;
  }

  .transcript-empty,
  .transcript-stream {
    min-height: 224px;
    overflow: visible;
  }

  .event-log {
    max-height: 230px;
  }
}

/* Compact desktop heights (for 1366×768 and similar laptop viewports). */
@media (min-width: 931px) and (max-height: 820px) {
  .app-shell {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .topbar {
    min-height: 56px;
    margin-bottom: 12px;
  }

  .modebar {
    min-height: 44px;
    margin-bottom: 10px;
  }

  .workspace-grid {
    gap: 10px;
  }

  .left-rail,
  .main-column,
  .right-rail {
    gap: 10px;
  }

  .main-column {
    grid-template-rows: minmax(140px, 0.58fr) minmax(195px, 0.96fr) minmax(115px, 0.56fr);
  }

  .signal-header {
    padding-top: 13px;
    padding-bottom: 9px;
  }

  .signal-footer {
    min-height: 42px;
    padding-top: 7px;
    padding-bottom: 9px;
  }

  .transcript-panel {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .footer-note {
    margin-top: 9px;
  }
}

/* Full-viewport workbench polish and the multi-link comparison surface. */
.app-shell {
  width: 100%;
  max-width: none;
}

.signal-header {
  min-height: 74px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(98, 225, 207, 0.1);
}

.signal-header > div:first-child {
  min-width: 0;
  padding-left: 2px;
}

.session-clock {
  min-width: 108px;
  padding: 8px 11px 7px;
  border: 1px solid rgba(98, 225, 207, 0.17);
  border-radius: 11px;
  background: rgba(4, 14, 24, 0.42);
}

.session-clock strong {
  font-size: 16px;
}

.waveform-wrap {
  min-height: 220px;
  margin: 15px 17px 0;
  border-radius: 15px;
  background-size: 100% 25%, 8% 100%, auto;
}

#waveform {
  height: 220px;
}

.waveform-empty {
  gap: 14px;
  color: #86a0b7;
}

.waveform-empty > span:last-child {
  padding: 0 18px;
  text-align: center;
}

.signal-footer {
  min-height: 62px;
  padding: 13px 22px 16px;
}

.signal-tags {
  gap: 7px;
}

.signal-tag {
  min-height: 25px;
  padding-inline: 9px;
}

.transcript-panel {
  padding: 20px 22px 22px;
}

.transcript-legend {
  min-height: 38px;
  margin-top: 14px;
}

.transcript-empty,
.transcript-stream {
  min-height: 260px;
}

.final-transcript {
  font-size: clamp(17px, 1.85vw, 23px);
  line-height: 1.68;
}

.pending-transcript {
  font-size: 16px;
}

.event-panel-heading {
  min-height: 62px;
  padding: 13px 22px 11px;
}

.event-log {
  padding-inline: 22px;
  padding-bottom: 18px;
}

.event-row {
  grid-template-columns: 82px minmax(64px, auto) minmax(0, 1fr);
  min-height: 39px;
  padding: 10px 0;
}

.compare-config-panel {
  padding: 17px;
  border-color: rgba(169, 144, 255, 0.2);
  background:
    radial-gradient(260px 160px at 100% 0%, rgba(169, 144, 255, 0.12), transparent 72%),
    linear-gradient(150deg, rgba(28, 32, 63, 0.9), rgba(12, 23, 41, 0.92));
}

.compare-intro,
.compare-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.compare-endpoint-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.compare-endpoint {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(5, 14, 25, 0.36);
  transition: border-color 160ms ease, background 160ms ease;
}

.compare-endpoint:focus-within,
.compare-endpoint:has(.compare-endpoint-enabled:checked) {
  border-color: rgba(98, 225, 207, 0.3);
  background: rgba(98, 225, 207, 0.055);
}

.compare-endpoint-toggle {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  cursor: pointer;
}

.compare-endpoint-enabled {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.compare-check {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgba(4, 12, 22, 0.62);
}

.compare-check::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border-right: 2px solid #04211e;
  border-bottom: 2px solid #04211e;
  content: "";
  opacity: 0;
  transform: rotate(42deg) scale(0.7);
  transition: opacity 140ms ease, transform 140ms ease;
}

.compare-endpoint-enabled:checked + .compare-check {
  border-color: rgba(98, 225, 207, 0.72);
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(98, 225, 207, 0.08);
}

.compare-endpoint-enabled:checked + .compare-check::after {
  opacity: 1;
  transform: rotate(42deg) scale(1);
}

.compare-endpoint-fields {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.compare-endpoint-fields input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--text-soft);
  background: rgba(4, 12, 22, 0.55);
  font-size: 10px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.compare-endpoint-fields input:first-child {
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
}

.compare-endpoint-fields input:focus {
  border-color: rgba(98, 225, 207, 0.55);
  background: rgba(7, 19, 32, 0.82);
  box-shadow: 0 0 0 3px rgba(98, 225, 207, 0.08);
}

.compare-endpoint-fields input::placeholder {
  color: #637a92;
}

.compare-results-panel {
  min-height: 0;
  padding: 21px 22px 22px;
  border-color: rgba(98, 225, 207, 0.23);
  background:
    radial-gradient(620px 220px at 70% -12%, rgba(98, 225, 207, 0.1), transparent 70%),
    linear-gradient(155deg, rgba(17, 35, 54, 0.94), rgba(10, 22, 38, 0.92));
}

.compare-results-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.compare-results-heading h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 18px;
  letter-spacing: -0.03em;
}

.compare-results-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.compare-summary {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(98, 225, 207, 0.22);
  border-radius: 10px;
  color: var(--accent);
  background: rgba(98, 225, 207, 0.08);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  line-height: 1.5;
}

.compare-table-wrap {
  position: relative;
  min-height: 0;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(4, 12, 22, 0.38);
  scrollbar-color: rgba(133, 163, 191, 0.3) transparent;
  scrollbar-width: thin;
}

.compare-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  table-layout: fixed;
}

.compare-table th,
.compare-table td {
  padding: 12px 11px;
  border-bottom: 1px solid rgba(167, 194, 222, 0.09);
  text-align: left;
  vertical-align: top;
}

.compare-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #84a0b9;
  background: #12243a;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.compare-table td {
  color: var(--muted);
  font-size: 10px;
}

.compare-table tbody tr:last-child td {
  border-bottom: 0;
}

.compare-row:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.compare-identity {
  width: 150px;
}

.compare-identity strong,
.compare-identity small {
  display: block;
}

.compare-identity strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-identity small {
  max-width: 180px;
  margin-top: 4px;
  overflow: hidden;
  color: #6e879f;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-status {
  width: 78px;
  color: var(--warning) !important;
  font-weight: 700;
  white-space: nowrap;
}

.compare-row.done .compare-status {
  color: var(--ok) !important;
}

.compare-row.ready .compare-status {
  color: var(--accent) !important;
}

.compare-row.streaming .compare-status {
  color: var(--accent) !important;
}

.compare-row.finishing .compare-status {
  color: var(--orange) !important;
}

.compare-row.error .compare-status {
  color: var(--danger) !important;
}

.compare-transcript {
  width: 27%;
  min-width: 190px;
  color: var(--text-soft) !important;
  font-size: 11px !important;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.compare-number {
  width: 94px;
  color: #b9cbe0 !important;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px !important;
  white-space: nowrap;
}

.compare-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (min-width: 931px) {
  .main-column {
    grid-template-rows: 118px minmax(0, 1fr) minmax(0, 1.15fr);
  }

  .signal-header {
    min-height: 0;
    padding: 8px 14px 4px;
    border-bottom: 0;
  }

  .signal-header h2 {
    margin-top: 2px;
    font-size: 15px;
    letter-spacing: 0;
  }

  .session-clock {
    min-width: 86px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .signal-footer {
    min-height: 0;
    gap: 8px;
    padding: 4px 14px 7px;
  }

  .signal-tag {
    min-height: 20px;
    padding: 2px 6px;
  }

  .signal-tags {
    gap: 4px;
  }

  .audio-player-wrap {
    min-width: 0;
    flex: 1 1 170px;
    max-width: 230px;
  }

  .audio-player-wrap audio {
    width: 100%;
    height: 28px;
  }

  .signal-panel .waveform-wrap {
    min-height: 0;
    margin: 0 14px;
    border-radius: 6px;
  }

  .signal-panel #waveform {
    height: 100%;
    min-height: 0;
  }

  .waveform-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 10px;
  }

  .waveform-empty .pulse-ring {
    display: none;
  }

  .transcript-panel {
    padding: 10px 14px;
  }

  .transcript-legend {
    min-height: 26px;
    margin-top: 6px;
    padding: 4px 0;
  }

  .transcript-empty,
  .transcript-stream {
    min-height: 0;
  }

  .transcript-stream {
    gap: 10px;
    padding-top: 10px;
  }

  .transcript-empty .empty-glyph {
    display: none;
  }

  .final-transcript {
    font-size: 19px;
    letter-spacing: 0;
    line-height: 1.65;
  }

  .pending-block {
    padding: 8px 10px;
    border-radius: 6px;
  }

  .block-label {
    margin-bottom: 4px;
  }

  .event-panel-heading {
    min-height: 44px;
    padding: 8px 14px;
  }

  .event-log {
    padding: 0 14px 8px;
  }

  .event-row {
    grid-template-columns: 60px 58px minmax(0, 1fr);
    min-height: 34px;
    gap: 8px;
    padding: 8px 0;
    font-size: 12px;
  }

  .event-message {
    color: var(--text-soft);
    line-height: 1.6;
  }

  .event-row .event-type {
    font-size: 10px;
    line-height: 1.9;
  }

  .compare-mode .workspace-grid {
    grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
  }

  .compare-mode .right-rail {
    display: none;
  }

  .compare-mode .main-column {
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .compare-mode .compare-results-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .compare-mode .compare-table-wrap {
    min-height: 0;
  }
}

@media (min-width: 931px) and (max-height: 820px) {
  body:not(.compare-mode) .main-column {
    grid-template-rows: 108px minmax(0, 1fr) minmax(0, 1.15fr);
  }
}

@media (max-width: 930px) {
  .app-shell {
    width: 100%;
  }

  .waveform-wrap {
    min-height: 160px;
    margin-top: 0;
  }

  #waveform {
    height: 160px;
  }

  .transcript-empty,
  .transcript-stream {
    min-height: 224px;
  }

  .compare-results-panel {
    padding: 17px 14px 18px;
  }

  .compare-results-heading {
    gap: 10px;
  }

  .compare-results-heading h2 {
    font-size: 16px;
  }

  .compare-table-wrap {
    margin-top: 12px;
  }

  .event-log {
    max-height: 300px;
  }
}

@media (max-width: 620px) {
  .signal-header {
    min-height: 66px;
    padding: 15px 15px 11px;
  }

  .session-clock {
    min-width: 87px;
    padding: 6px 8px;
  }

  .session-clock strong {
    font-size: 14px;
  }

  .signal-footer {
    padding: 10px 15px 14px;
  }

  .event-panel-heading {
    padding-inline: 15px;
  }

  .event-log {
    padding-inline: 15px;
  }

  .compare-endpoint {
    padding: 8px;
  }

  .compare-results-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .compare-summary {
    font-size: 9px;
  }
}

/* Keep the page background visible all the way to the viewport edge. */
html,
body {
  background-color: #0a1728;
}

body {
  background-attachment: fixed;
  background-size: cover;
}

@media (min-width: 931px) {
  .app-shell {
    min-height: 100dvh;
    padding-bottom: 16px;
  }
}

/* Reserve the desktop viewport for live output and all twelve metrics. */
@media (min-width: 931px) {
  body .app-shell {
    padding: 12px 16px;
  }

  body .topbar {
    min-height: 44px;
    margin-bottom: 8px;
  }

  body .brand .eyebrow,
  body .brand p {
    display: none;
  }

  body .brand h1 {
    font-size: 22px;
    letter-spacing: 0;
  }

  body .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 8px;
  }

  body .modebar {
    min-height: 44px;
    margin-bottom: 8px;
    padding-block: 3px;
  }

  body:not(.compare-mode) .workspace-grid {
    grid-template-columns: minmax(210px, 248px) minmax(0, 1fr) minmax(270px, 310px);
    grid-template-rows: minmax(0, 1fr);
    gap: 10px;
  }

  body:not(.compare-mode) .left-rail,
  body:not(.compare-mode) .main-column,
  body:not(.compare-mode) .right-rail {
    gap: 8px;
  }

  body .left-rail {
    position: relative;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  body:not(.compare-mode) .right-rail {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: max-content minmax(30px, 1fr);
    align-items: stretch;
    overflow: hidden;
  }

  .right-rail .metrics-panel,
  .right-rail .details-panel {
    min-height: 0;
  }

  .metrics-panel {
    padding: 10px 12px;
  }

  .metric-grid {
    gap: 4px 6px;
    margin-top: 8px;
  }

  .metric-card {
    min-height: 56px;
    gap: 1px;
    padding: 4px 6px;
    border-radius: 6px;
  }

  .metric-card span {
    font-size: 10px;
    line-height: 1.2;
  }

  .metric-card strong {
    font-size: 16px;
    letter-spacing: 0;
    line-height: 1.2;
  }

  .metric-card small {
    font-size: 8px;
    line-height: 1.25;
    color: var(--muted);
  }

  .details-panel {
    overflow-y: auto;
    scrollbar-color: rgba(133, 163, 191, 0.3) transparent;
    scrollbar-width: thin;
  }

  .details-panel summary {
    min-height: 27px;
    padding: 5px 12px;
  }

  .info-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    padding: 0 12px 6px;
  }

  .info-list > div {
    min-width: 0;
    gap: 4px;
  }

  .json-view {
    margin: 0 12px 8px;
  }

  body .footer-note {
    margin-top: 8px;
  }
}

/* Compact controls share the same layout in both recognition modes. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ui-icon {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  filter: invert(86%);
}

.button.icon-button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 5px;
  flex: 0 0 28px;
  border-radius: 6px;
  background: transparent;
}

.button.icon-button:hover:not(:disabled) {
  background: var(--panel-raised);
  transform: none;
}

.left-rail .panel {
  border-radius: 8px;
  padding: 10px;
}

.left-rail .panel-heading h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0;
}

.input-panel {
  position: relative;
}

.source-tabs {
  gap: 2px;
  margin: 0;
  padding: 2px;
  border-radius: 6px;
}

.source-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.source-tab .ui-icon {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.file-source-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.file-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  gap: 4px;
  padding: 4px;
  border-radius: 6px;
  white-space: nowrap;
}

.file-drop strong {
  font-size: 10px;
}

.compact-select {
  min-width: 0;
  height: 30px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-soft);
  background: var(--panel-solid);
  font-size: 11px;
}

.file-info {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.file-name {
  font-size: 10px;
  line-height: 1.4;
}

.file-meta {
  margin-top: 1px;
  overflow: hidden;
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-heading {
  gap: 6px;
}

.settings-heading .compact-select {
  width: 106px;
}

.service-setting-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin-top: 4px;
  color: var(--muted-strong);
  font-size: 10px;
}

.setting-value {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-mode .service-setting-row {
  display: none;
}

.toggle-list {
  gap: 0;
  margin-top: 4px;
}

.toggle-row {
  min-height: 32px;
  padding: 3px 0;
  gap: 8px;
}

.toggle-list > .toggle-row {
  padding-right: 34px;
}

.editable-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
}

.toggle-ui {
  width: 32px;
  height: 20px;
  flex-basis: 32px;
}

.toggle-ui::after {
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
}

.toggle-row input:checked + .toggle-ui::after {
  transform: translateX(12px);
}

.compare-endpoint-list {
  gap: 3px;
  margin-top: 6px;
}

.compare-endpoint {
  grid-template-columns: 22px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 1px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.compare-endpoint-toggle {
  position: relative;
}

.compare-endpoint-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.left-rail .action-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.action-row {
  display: flex;
  gap: 12px;
}

.action-row .round-control {
  width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border-radius: 50%;
}

.round-control .ui-icon {
  width: 19px;
  height: 19px;
  flex-basis: 19px;
}

.button.start-control {
  border-color: #72e6b9;
  background: #4bd4a0;
}

.button.start-control:hover:not(:disabled) {
  background: #73e5b9;
}

.start-control .ui-icon {
  filter: none;
}

.button.stop-control {
  border-color: #fa8290;
  background: #e85568;
}

.button.stop-control:hover:not(:disabled) {
  background: #f37180;
}

.stop-control .ui-icon {
  filter: invert(1);
}

.button.clear-control {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.settings-dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}

.settings-dialog::backdrop {
  background: rgba(2, 8, 15, 0.64);
}

.settings-dialog form {
  padding: 18px;
}

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

.dialog-heading h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-dialog textarea {
  min-height: 160px;
  max-height: 45dvh;
  font-size: 13px;
}

@media (min-width: 931px) {
  body .left-rail {
    gap: 6px;
    grid-auto-rows: max-content;
  }

  .compare-mode .workspace-grid {
    grid-template-columns: minmax(248px, 280px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 10px;
  }

  .compare-mode .compare-results-panel {
    display: flex;
    flex-direction: column;
  }

  .compare-mode .compare-table-wrap {
    min-height: 0;
    flex: 1;
  }
}

@media (min-width: 931px) and (max-height: 760px) {
  .left-rail .panel {
    padding: 6px;
  }

  .source-tab {
    min-height: 24px;
  }

  .compact-select,
  .file-drop {
    height: 26px;
    min-height: 26px;
  }

  .toggle-row,
  .service-setting-row,
  .compare-endpoint {
    min-height: 28px;
  }

  .compare-endpoint-list {
    margin-top: 4px;
    gap: 1px;
  }

  .file-source-row,
  .file-info {
    margin-top: 4px;
  }

  .left-rail .action-panel {
    min-height: 44px;
    padding: 0 4px;
  }

  .action-row .round-control {
    width: 40px;
    height: 40px;
    min-height: 40px;
    flex-basis: 40px;
  }
}

@media (min-width: 931px) and (max-height: 720px) {
  .metrics-panel {
    padding: 8px 12px;
  }

  .metrics-panel .eyebrow {
    display: none;
  }

  .metrics-panel h2 {
    margin-top: 0;
  }

  .metric-grid {
    margin-top: 4px;
    row-gap: 3px;
  }

  .metric-card {
    min-height: 48px;
    gap: 0;
    padding: 3px 6px;
  }

  .metric-card span {
    line-height: 1.2;
  }

  .metric-card strong {
    font-size: 15px;
    line-height: 1.15;
  }
}

@media (min-width: 931px) and (max-width: 1100px) {
  body:not(.compare-mode) .workspace-grid {
    grid-template-columns: 210px minmax(0, 1fr) 270px;
  }

  .transcript-actions {
    gap: 4px;
  }

  .transcript-actions .mini-badge {
    display: none;
  }

  .signal-footer:has(.audio-player-wrap:not([hidden])) .signal-tags {
    flex-basis: 100px;
  }

  .signal-footer:has(.audio-player-wrap:not([hidden])) .signal-tag.muted {
    display: none;
  }

  .event-row {
    grid-template-columns: 52px 50px minmax(0, 1fr);
    gap: 5px;
  }
}
