:root {
  --paper: #f7f5ef;
  --ink: #181a1f;
  --muted: #646b73;
  --line: #c8d0d4;
  --panel: #ffffff;
  --accent: #0d6b5f;
  --accent-2: #b7402c;
  --blue: #275f9f;
  --shadow: 0 24px 80px rgba(21, 24, 28, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)),
    var(--paper);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

.shell {
  min-height: 100vh;
  display: grid;
  place-items: end center;
  padding: 24px;
}

.dictation-panel {
  width: min(980px, calc(100vw - 24px));
  margin-bottom: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.topbar,
.mode-row,
.recorder,
.actions,
.prompt-strip {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.brand {
  font-size: 14px;
  font-weight: 650;
}

.status {
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.mode-row {
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mode,
.actions button,
.icon-text,
.micro-button {
  border: 1px solid var(--line);
  background: #f8faf9;
  color: var(--ink);
  border-radius: 6px;
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
}

.mode.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 160px 140px;
  gap: 8px;
  margin-bottom: 10px;
}

.progress-grid > div,
.prompt-strip {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px;
}

.mini-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  margin-bottom: 4px;
}

.metric {
  font-size: 15px;
  font-weight: 700;
}

.gate-metric {
  color: var(--accent-2);
}

.gate-metric.complete {
  color: var(--accent);
}

.select-field,
.single-field {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}

.runtime-select {
  min-height: 28px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 650;
}

.runtime-subvalue {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.prompt-strip {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.locked-session-strip {
  display: grid;
  grid-template-columns: 0.8fr 1.6fr 0.8fr 1.4fr;
  gap: 8px;
  margin-bottom: 12px;
}

.locked-session-strip > div {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px;
}

.prompt-text {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.prompt-target {
  margin-top: 6px;
  color: var(--accent);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

.session-row {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(150px, auto) minmax(230px, auto) 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.check-row,
.nas-status,
.runtime-strip > div {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.nas-status {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nas-status.warn {
  color: var(--accent-2);
}

.runtime-strip,
.optimization-strip {
  display: grid;
  gap: 8px;
}

.runtime-strip {
  grid-template-columns: 1.05fr 0.75fr 0.75fr 1.25fr 1fr 1.25fr 1fr;
  margin-bottom: 8px;
}

.optimization-strip {
  grid-template-columns: 1.1fr 0.7fr 0.9fr 1.2fr 0.9fr;
  margin-bottom: 12px;
}

.runtime-strip > div,
.optimization-strip > div {
  min-width: 0;
  display: block;
}

.optimization-wide {
  grid-column: 1 / -1;
}

.operator-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px;
  margin-bottom: 12px;
}

.operator-checklist {
  display: grid;
  gap: 6px;
}

.operator-step {
  display: grid;
  grid-template-columns: 28px minmax(140px, 0.7fr) minmax(100px, 0.45fr) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border-top: 1px solid rgba(200, 208, 212, 0.72);
  padding-top: 6px;
  font-size: 12px;
}

.operator-step:first-child {
  border-top: 0;
  padding-top: 0;
}

.operator-step span {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.operator-step strong,
.operator-step small,
.operator-step em,
.operator-step code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-step strong {
  font-size: 12px;
}

.operator-step small {
  color: var(--accent-2);
  font-weight: 700;
}

.operator-step.ready small {
  color: var(--accent);
}

.operator-step em {
  color: var(--muted);
  font-style: normal;
}

.operator-step code {
  grid-column: 2 / -1;
  color: var(--blue);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 11px;
}

.runtime-value {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.micro-button {
  width: 100%;
  min-height: 28px;
  margin-top: 6px;
  padding: 0 8px;
  font-size: 12px;
}

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

.metric.warn {
  color: var(--accent-2);
}

.runtime-value.warn {
  color: var(--accent-2);
}

.route-lanes {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px;
}

.route-lane-list {
  display: grid;
  gap: 6px;
}

.route-lane {
  display: grid;
  grid-template-columns: minmax(90px, 0.75fr) minmax(120px, 1fr) minmax(112px, 1fr) minmax(96px, 0.9fr);
  gap: 8px;
  align-items: center;
  min-height: 28px;
  border-top: 1px solid rgba(200, 208, 212, 0.72);
  padding-top: 6px;
  font-size: 12px;
}

.route-lane:first-child {
  border-top: 0;
  padding-top: 0;
}

.route-lane span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-lane-role {
  font-weight: 700;
}

.route-lane-model,
.route-lane-metric {
  color: var(--muted);
}

.route-lane-status {
  font-weight: 700;
}

.route-lane-status.blocked {
  color: var(--accent-2);
}

.route-lane-status.ready {
  color: var(--accent);
}

.asr-frontier {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px;
}

.asr-frontier-list {
  display: grid;
  gap: 6px;
}

.asr-frontier-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.25fr) minmax(78px, 0.55fr) minmax(72px, 0.45fr) minmax(92px, 0.7fr);
  gap: 8px;
  align-items: center;
  min-height: 28px;
  border-top: 1px solid rgba(200, 208, 212, 0.72);
  padding-top: 6px;
  font-size: 12px;
}

.asr-frontier-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.asr-frontier-row strong,
.asr-frontier-row span,
.asr-frontier-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asr-frontier-row strong {
  font-size: 12px;
}

.asr-frontier-row span {
  color: var(--muted);
  font-family: Consolas, "Cascadia Mono", monospace;
}

.asr-frontier-row small {
  color: var(--accent-2);
  font-style: normal;
  font-weight: 700;
}

.asr-frontier-row.quality small,
.asr-frontier-row.pass small {
  color: var(--accent);
}

.gpu-unlock-ladder {
  display: grid;
  gap: 6px;
}

.gpu-unlock-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(92px, 0.4fr) minmax(96px, 0.45fr);
  gap: 8px;
  align-items: center;
  min-height: 28px;
  border-top: 1px solid rgba(200, 208, 212, 0.72);
  padding-top: 6px;
  font-size: 12px;
}

.gpu-unlock-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.gpu-unlock-row strong,
.gpu-unlock-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gpu-unlock-row strong {
  font-size: 12px;
}

.gpu-unlock-row span {
  color: var(--accent-2);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-weight: 700;
}

.gpu-unlock-row.ready span {
  color: var(--accent);
}

.recorder {
  gap: 12px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.record-button {
  width: 48px;
  height: 48px;
  border: 1px solid #b9c2c7;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.record-button.recording {
  border-color: var(--accent-2);
  background: #fff4f1;
}

.record-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-2);
  display: block;
}

.record-button.recording .record-dot {
  border-radius: 4px;
  width: 16px;
  height: 16px;
}

.recorder-copy {
  min-width: 0;
}

.record-state {
  font-weight: 650;
  font-size: 14px;
}

.interim {
  min-height: 38px;
  margin-top: 4px;
  padding: 7px 9px;
  border: 1px solid #dfe7ea;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  line-height: 1.36;
  overflow-wrap: anywhere;
}

.interim:empty {
  min-height: 22px;
  padding: 0;
  border-color: transparent;
  background: transparent;
}

.audio-quality {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-quality.pass {
  color: var(--accent);
}

.audio-quality.warn {
  color: var(--accent-2);
}

.draft-probe-button {
  width: auto;
  min-width: 112px;
  margin-top: 4px;
}

.probe-reload-button {
  width: auto;
  min-width: 84px;
  margin-top: 4px;
}

.probe-recovery {
  min-height: 18px;
  margin-top: 3px;
  color: var(--accent-2);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.probe-recovery:empty {
  display: none;
}

.field-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.text-field {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  line-height: 1.42;
  color: var(--ink);
  background: #fff;
}

.editor-surface {
  min-height: 126px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  tab-size: 2;
}

.single-field {
  min-height: 38px;
}

.text-field:focus,
button:focus-visible {
  outline: 2px solid rgba(39, 95, 159, 0.25);
  outline-offset: 2px;
}

.output {
  min-height: 118px;
  font-family: Consolas, "Cascadia Mono", monospace;
}

.actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

#normalize {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.recording-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.recordings {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.recording-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fbfcfc;
  border-radius: 8px;
  padding: 8px;
}

.recording-main {
  min-width: 0;
}

.recording-meta,
.recording-quality,
.recording-path {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recording-quality.pass {
  color: var(--accent);
}

.recording-quality.warn {
  color: var(--accent-2);
}

.recording-text {
  margin: 3px 0;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.recording-item audio {
  width: 100%;
  height: 34px;
}

.empty-state {
  min-height: 70px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

@media (max-width: 560px) {
  .shell {
    padding: 8px;
  }

  .dictation-panel {
    width: 100%;
    margin-bottom: 8px;
  }

  .actions button {
    flex: 1 1 42%;
  }

  .progress-grid {
    grid-template-columns: 1fr;
  }

  .prompt-strip,
  .session-row,
  .runtime-strip,
  .optimization-strip,
  .locked-session-strip,
  .operator-step,
  .route-lane,
  .asr-frontier-row,
  .gpu-unlock-row,
  .recording-item {
    grid-template-columns: 1fr;
  }

  .operator-step code {
    grid-column: 1;
  }

  .prompt-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .prompt-actions {
    justify-content: stretch;
  }

  .prompt-actions button,
  .recording-item audio {
    width: 100%;
  }
}
