* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f6f8;
  color: #222;
}
header {
  background: #1f4e79;
  color: white;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
header h1 { margin: 0; font-size: 20px; font-weight: 600; }
header nav { margin-left: auto; }
header a, header button {
  background: rgba(255,255,255,0.12);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}
header a:hover, header button:hover { background: rgba(255,255,255,0.22); }

main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

.card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}
.card h3 { margin: 0 0 4px 0; font-size: 16px; }
.card-meta { flex: 1; }
.card-meta small { color: #777; display: block; font-size: 12px; }

.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-created { background: #e8eaed; color: #555; }
.status-queued { background: #ffe8a3; color: #7a5a00; }
.status-processing { background: #fff4cf; color: #6b5600; }
.status-done { background: #d4edda; color: #155724; }
.status-error { background: #f8d7da; color: #721c24; }

button.primary {
  background: #1f4e79;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
button.primary:hover { background: #2e75b6; }
button.primary:disabled { background: #99aec3; cursor: not-allowed; }
button.secondary {
  background: #e8eaed;
  color: #222;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
button.danger {
  background: #f8d7da;
  color: #721c24;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

input[type=text], input[type=file], select, textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e8eaed;
}
.tabs button {
  background: none;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #555;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tabs button.active {
  color: #1f4e79;
  border-bottom-color: #1f4e79;
  font-weight: 600;
}

/* overflow: visible (not hidden) so autocomplete dropdowns inside a <td>
   can escape the table bounds. The square corners are a cheap cost. */
table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: visible; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; overflow: visible; }
th { background: #f5f6f8; font-weight: 600; font-size: 13px; color: #555; }
tr { overflow: visible; }
tr:last-child td { border-bottom: none; }

.segment-row {
  background: white;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: 80px 120px 1fr auto;
  gap: 12px;
  align-items: center;
}
.segment-row .timestamp { color: #777; font-size: 12px; font-family: Consolas, monospace; }
.segment-row .label { font-weight: 600; color: #1f4e79; font-size: 13px; }
.segment-row .text { font-size: 14px; }
.segment-row.excluded { opacity: 0.4; text-decoration: line-through; }

.actions { display: flex; gap: 4px; }
.empty-state { text-align: center; padding: 48px; color: #888; }
.error-banner { background: #f8d7da; color: #721c24; padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.info-banner { background: #d1ecf1; color: #0c5460; padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: white; border-radius: 8px; padding: 20px; min-width: 400px; max-width: 600px; }
.modal-header { display: flex; align-items: center; margin-bottom: 12px; }
.modal-header h2 { margin: 0; flex: 1; }
.modal-close { background: transparent; border: none; cursor: pointer; font-size: 20px; color: #666; padding: 4px 10px; border-radius: 4px; }
.modal-close:hover { background: #f0f0f0; }
.modal-close:disabled { color: #bbb; cursor: not-allowed; }
.modal .row { margin-bottom: 10px; }
.modal .row label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Debounced-edit inputs: always visible, underline-less by default. */
.inline-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.inline-input:hover { border-color: #dfe3e8; background: #fafbfc; }
.inline-input:focus { border-color: #2E75B6; background: white; outline: none; }

/* Autocomplete dropdown (voice profile search). */
.ac-wrap { position: relative; }
.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 280px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  max-height: 280px;
  overflow-y: auto;
}
.ac-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active { background: #eef3f9; }
.ac-item .ac-name { font-weight: 600; color: #1f4e79; }
.ac-item .ac-meta { color: #777; font-size: 12px; margin-top: 2px; }
.ac-empty { padding: 8px 12px; color: #888; font-size: 13px; font-style: italic; }

/* Inline spinner for processing state. */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #cfd8e3;
  border-top-color: #1f4e79;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* "?" help icon beside table headers (native title tooltip). */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #555;
  background: #e8eaed;
  border-radius: 50%;
  cursor: help;
  vertical-align: middle;
}
.help-icon:hover { background: #cfd8e3; color: #1f4e79; }

/* Form-field helper line shown under placeholders. */
.field-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #777;
}

/* Progress bar shown while a pipeline run is in flight. */
.progress-box {
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #444;
  margin-bottom: 6px;
}
.progress-step {
  font-family: Consolas, monospace;
  color: #777;
  font-size: 12px;
}
.progress-bar {
  background: #e8eaed;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  background: linear-gradient(90deg, #2e75b6, #1f4e79);
  height: 100%;
  transition: width 0.4s ease;
}

/* Activity indicator for long phases (diarize in particular). Pure CSS
   marquee so we don't burn another setInterval just to animate dots. */
.progress-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: #555;
}
.activity-dots {
  display: inline-block;
  font-family: Consolas, monospace;
  letter-spacing: 2px;
  color: #1f4e79;
  min-width: 36px;
}
.activity-dots::after {
  content: "●○○";
  animation: activity-dots 1.6s steps(1, end) infinite;
}
@keyframes activity-dots {
  0%   { content: "●○○"; }
  25%  { content: "●●○"; }
  50%  { content: "●●●"; }
  75%  { content: "○●●"; }
  100% { content: "○○●"; }
}
.activity-timer {
  color: #777;
  font-family: Consolas, monospace;
}
.long-run-banner {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  color: #664d03;
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
}

/* Admin-panel bits. */
.nav-admin { opacity: 0.55; font-size: 12px; }
.nav-admin:hover { opacity: 1; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: white;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-label { font-size: 12px; color: #777; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 600; color: #1f4e79; }

.traceback {
  background: #1f2328;
  color: #e6edf3;
  padding: 12px 14px;
  border-radius: 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}
