:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e3e6eb;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --pending: #6b7280;
  --speaker-0: #2563eb;
  --speaker-1: #db2777;
  --speaker-2: #16a34a;
  --speaker-3: #d97706;
  --speaker-4: #7c3aed;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
               "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.topbar {
  background: #111827;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.topbar .brand {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
}
.topbar .tag {
  color: #9ca3af;
  font-size: 12px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
}

.alert {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  color: #92400e;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.alert code {
  background: #fff7ed;
  padding: 1px 6px;
  border-radius: 4px;
}

.upload-form .row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.upload-form label {
  flex: 1 1 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.upload-form label.full { flex-basis: 100%; }
.upload-form label span {
  font-size: 12px;
  color: var(--muted);
}
.upload-form input[type="text"],
.upload-form input[type="number"],
.upload-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.upload-form input[type="file"] {
  padding: 6px 0;
}

button, .button {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}
button:hover:not(:disabled), .button:hover { background: #f3f4f6; }
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.danger {
  background: #fff;
  color: var(--danger);
  border-color: #fecaca;
}
button.danger:hover:not(:disabled) { background: #fef2f2; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.small { padding: 4px 10px; font-size: 12px; }

.inline { display: inline; }

table.recordings {
  width: 100%;
  border-collapse: collapse;
}
table.recordings th, table.recordings td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
table.recordings th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
table.recordings a {
  color: var(--accent);
  text-decoration: none;
}
table.recordings a:hover { text-decoration: underline; }

.muted { color: var(--muted); font-size: 12px; }

.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.status-pending { background: #f3f4f6; color: var(--pending); }
.status-running { background: #dbeafe; color: #1d4ed8; }
.status-done    { background: #dcfce7; color: var(--ok); }
.status-failed  { background: #fee2e2; color: var(--danger); }

.back { color: var(--accent); text-decoration: none; font-size: 13px; }
.back:hover { text-decoration: underline; }

dl.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 16px;
  row-gap: 4px;
  margin: 0 0 16px;
  font-size: 13px;
}
dl.meta dt { color: var(--muted); }

audio {
  width: 100%;
  margin-top: 8px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.progress {
  height: 6px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
}
.progress .bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.hidden { display: none !important; }

.segments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.segments-header h2 { margin: 0; }

ol.segments {
  list-style: none;
  margin: 0;
  padding: 0;
}
.segment {
  padding: 8px 12px;
  border-radius: 6px;
  display: grid;
  grid-template-columns: 80px 80px 1fr;
  gap: 8px;
  align-items: baseline;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.segment:hover { background: #f9fafb; }
.segment .ts {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
}
.segment .speaker {
  font-weight: 600;
  font-size: 13px;
}
.segment .text {
  font-size: 14px;
  white-space: pre-wrap;
}
.segment.speaker-0 { border-left-color: var(--speaker-0); }
.segment.speaker-0 .speaker { color: var(--speaker-0); }
.segment.speaker-1 { border-left-color: var(--speaker-1); }
.segment.speaker-1 .speaker { color: var(--speaker-1); }
.segment.speaker-2 { border-left-color: var(--speaker-2); }
.segment.speaker-2 .speaker { color: var(--speaker-2); }
.segment.speaker-3 { border-left-color: var(--speaker-3); }
.segment.speaker-3 .speaker { color: var(--speaker-3); }
.segment.speaker-4 { border-left-color: var(--speaker-4); }
.segment.speaker-4 .speaker { color: var(--speaker-4); }
.segment.active { background: #eff6ff; }

pre.error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
  padding: 12px;
  border-radius: 6px;
  white-space: pre-wrap;
  font-size: 12px;
}
