:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --green: #2ecc71;
  --red: #ff5f56;
  --amber: #f5a623;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

h1 { font-size: 1.6rem; margin: 0.2em 0; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.subtitle { color: var(--muted); margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin: 20px 0;
}

.field { display: block; margin-bottom: 16px; }
.field > span, legend { display: block; font-weight: 600; margin-bottom: 6px; }

input[type="file"], textarea {
  width: 100%;
  background: #0d0f13;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px;
  font: inherit;
}

textarea { resize: vertical; }

fieldset { border: none; padding: 0; margin: 0 0 16px; }
.radio { margin-right: 18px; font-weight: 400; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: default; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: none;
}

.error { color: var(--red); margin-top: 12px; }
.muted { color: var(--muted); }

/* History */
.history-head { display: flex; align-items: center; justify-content: space-between; }
.history-list { list-style: none; padding: 0; margin: 8px 0 0; }
.history-list li { margin: 6px 0; }
.history-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.history-item:hover { border-color: var(--accent); }
.hi-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-date { color: var(--muted); font-size: 0.85rem; }

/* Status badges */
.status-badge {
  font-size: 0.78rem;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.status-queued { background: #2a2f3a; color: var(--muted); }
.status-transcribing, .status-analyzing { background: rgba(245,166,35,0.15); color: var(--amber); }
.status-completed { background: rgba(46,204,113,0.15); color: var(--green); }
.status-failed { background: rgba(255,95,86,0.15); color: var(--red); }

/* Stepper */
.stepper {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0 0 14px;
  counter-reset: step;
}
.stepper li {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-radius: 8px;
  background: #0d0f13;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}
.stepper li.active { border-color: var(--amber); color: var(--amber); }
.stepper li.done { border-color: var(--green); color: var(--green); }
.stepper li.failed { border-color: var(--red); color: var(--red); }

.status-line { font-weight: 600; margin: 0; }
.status-line.status-completed { color: var(--green); }
.status-line.status-failed { color: var(--red); }

.failure {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: rgba(255,95,86,0.08);
}
.failure p { margin: 6px 0 0; color: var(--text); }
.failure button { margin-top: 12px; }

/* Meta */
.meta dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 16px; margin: 0; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.meta dd a { color: var(--accent); margin-right: 16px; }
.pre { white-space: pre-wrap; }

/* Result + transcript */
.result {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0d0f13;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  max-height: 480px;
  overflow: auto;
}
summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
