:root {
  --bg: #14171a;
  --surface: #1c2024;
  --surface-raised: #23282e;
  --border: #2a2f36;
  --border-strong: #383f47;
  --text: #edeff1;
  --text-dim: #8a9099;
  --text-faint: #5b6169;
  --accent: #e8a33d;
  --accent-dim: #7a5a26;
  --danger: #d9634a;
  --success: #5fb88c;
  --font-sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.rack {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.rack__header {
  margin-bottom: 28px;
}

.wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 6px;
  color: var(--text);
}

.tagline {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  max-width: 46ch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.panel__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel__head .panel__eyebrow { flex: 1; }

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.field-row:last-child { margin-bottom: 0; }

.field-label {
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 108px;
}

.select, .text-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-sans);
}
.select {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.select:focus-visible, .text-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.select--compact {
  flex: 0 0 auto;
  width: 92px;
}

.text-input--narrow {
  flex: 0 0 auto;
  width: 70px;
}

.meta-line {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0 0 12px;
  min-height: 1em;
}

.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.tip {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: var(--surface-raised);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
}
.tip strong { color: var(--text); font-weight: 600; }

.textarea {
  width: 100%;
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px;
  font-size: 13px;
  font-family: var(--font-mono);
  resize: vertical;
  margin-bottom: 12px;
}
.textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.file-input {
  flex: 1;
  color: var(--text-dim);
  font-size: 12px;
  min-width: 0;
}
.file-input::file-selector-button {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  margin-right: 10px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
}
.btn:hover { border-color: var(--text-faint); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--ghost {
  padding: 8px 10px;
  font-weight: 500;
  color: var(--text-dim);
}

.btn--primary {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  min-width: 156px;
  justify-content: center;
}
.btn--primary.is-recording {
  border-color: var(--danger);
  color: var(--danger);
}

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.is-recording .rec-dot {
  background: var(--danger);
  animation: pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .is-recording .rec-dot { animation: none; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.status {
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-inline input[type="checkbox"] {
  accent-color: var(--accent);
}

.meter {
  display: flex;
  gap: 3px;
  height: 16px;
  flex: 1;
}

.meter__segment {
  flex: 1;
  background: var(--surface-raised);
  border-radius: 2px;
  transition: background-color 80ms linear;
}
.meter__segment.is-active { background: var(--success); }
.meter__segment.is-active.is-hot { background: var(--accent); }
.meter__segment.is-active.is-peak { background: var(--danger); }

.timer {
  font-size: 13px;
  color: var(--text-dim);
  width: 74px;
  text-align: right;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress {
  flex: 1;
  height: 6px;
  background: var(--surface-raised);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.progress__bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 150ms ease-out;
}
.progress__bar--indeterminate {
  position: absolute;
  top: 0;
  left: -35%;
  width: 35%;
  animation: indeterminate-slide 1.1s ease-in-out infinite;
}
@keyframes indeterminate-slide {
  0% { left: -35%; }
  100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .progress__bar--indeterminate { animation: none; position: static; width: 60%; }
}
.progress__label {
  font-size: 11px;
  color: var(--text-dim);
  width: 160px;
  text-align: right;
}

.tab-bar {
  display: flex;
  gap: 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 2px 10px;
  cursor: pointer;
}
.tab-btn:hover { color: var(--text-dim); }
.tab-btn.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tab-panel { padding-bottom: 4px; }

.history-list { display: flex; flex-direction: column; }

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }

.history-item__checkbox {
  accent-color: var(--accent);
  flex-shrink: 0;
}

.history-item__info { min-width: 0; flex: 1; }
.history-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item.is-active .history-item__title::after {
  content: ' (current)';
  color: var(--text-faint);
  font-weight: 400;
}
.history-item__meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}
.history-item__preview {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}

#audio-player,
#history-audio-player {
  width: 100%;
  margin: 0 0 14px;
}

.history-item__play-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.history-item__play-icon:hover { border-color: var(--accent); }
.history-item__play-icon:disabled { opacity: 0.5; cursor: not-allowed; }

.history-item__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* "Delete audio (12.4 MB)" is a long label next to Load and Delete —
   wrapping keeps a narrow window from squashing the title column. */
.history-item__actions .btn {
  white-space: nowrap;
}

/* The orphaned-recordings cleanup button sits inline in the storage line,
   so it has to sit on the same baseline as 12px text rather than tower
   over it. */
.meta-line .btn {
  font-size: 12px;
  padding: 2px 8px;
  vertical-align: baseline;
}

dialog.modal {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 440px;
  width: calc(100% - 40px);
}
dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
dialog.modal h3 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
}
dialog.modal p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 12px;
}
dialog.modal .btn {
  margin-top: 4px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--text);
}
.section-subtitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 22px 0 8px;
}
.section-subtitle:first-of-type { margin-top: 0; }

.code-block {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  white-space: pre;
}

.tab-copy {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 12px;
}
.tab-copy a {
  color: var(--accent);
}

.export-row { display: flex; gap: 6px; }

.transcript {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.transcript__empty {
  color: var(--text-faint);
  font-size: 13px;
  margin: 4px 0;
}

.transcript__row {
  display: flex;
  gap: 12px;
  margin: 0 0 10px;
  font-size: 14px;
}

.transcript__time {
  flex-shrink: 0;
  width: 62px;
  color: var(--text-faint);
  font-size: 12px;
  padding-top: 2px;
}

.transcript__text {
  color: var(--text);
}
.transcript__text[contenteditable="true"] {
  cursor: text;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
}
.transcript__text[contenteditable="true"]:hover {
  background: var(--surface-raised);
}
.transcript__text[contenteditable="true"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--surface-raised);
}

@media (max-width: 480px) {
  .field-label { width: 84px; font-size: 11px; }
  .rack { padding: 28px 14px 60px; }
}
