/* ===== Global Reset & Variables ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-page: #f3f4f6;
  --bg-white: #ffffff;
  --bg-sidebar: #ffffff;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-width: 240px;
  --transition: 0.18s ease;
  /* One height for every control that can sit in a row with an input. */
  --control-h: 38px;
}

html, body, #root {
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Buttons ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}
.btn-primary:active { transform: translateY(0); }
/* A disabled primary button looked exactly like an enabled one, so a control
   waiting on something read as a control that does nothing. */
.btn-primary:disabled, .btn-secondary:disabled, .btn-danger-solid:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none;
}
.btn-primary:disabled:hover { background: var(--primary); transform: none; box-shadow: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 24px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.btn-secondary:hover {
  background: var(--bg-page);
  border-color: var(--text-muted);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.btn-icon:hover { background: var(--primary-light); }
.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-icon:disabled:hover { background: none; }

/* ===== Admin Layout ===== */
.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 20px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-menu-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0 20px 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
.sidebar-nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.sidebar-nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-nav-item svg {
  flex-shrink: 0;
}

/* ===== Admin Main Content ===== */
.admin-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-topbar-left h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.admin-topbar-left p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sidebar-nav-sep {
  height: 1px;
  margin: 10px 12px;
  background: var(--border);
}

.admin-content {
  flex: 1;
  padding: 28px 32px;
}

/* ===== Card ===== */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ===== Audio Input Card ===== */
.audio-input-card {
  padding: 28px;
}

.audio-input-card-header {
  text-align: center;
  margin-bottom: 24px;
}
.audio-input-card-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.audio-input-card-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.audio-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.audio-input-divider {
  border-top: 1px solid var(--border);
  padding: 20px 28px;
  display: flex;
  justify-content: center;
}

/* ===== Selected File Display ===== */
.selected-file-display {
  padding: 18px 24px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
}

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

.selected-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.selected-file-info svg {
  color: var(--primary);
  flex-shrink: 0;
}

.selected-file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.selected-file-size {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-danger {
  color: #ef4444;
}
.btn-danger:hover {
  background: #fee2e2;
}

/* ===== Error Banner ===== */
.error-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: #dc2626;
  font-size: 14px;
  margin: 0 28px;
  margin-bottom: 16px;
}

.error-banner svg:first-child {
  flex-shrink: 0;
  color: #dc2626;
}

.btn-error-close {
  color: #dc2626;
  margin-left: auto;
}
.btn-error-close:hover {
  background: #fee2e2;
}

/* ===== Notification Toast ===== */
.notification-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  margin: 0 28px 16px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-toast.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
}

.notification-toast.success svg {
  color: #16a34a;
}

.notification-toast.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.notification-toast.error svg {
  color: #dc2626;
}

.btn-toast-close {
  color: inherit;
  margin-left: auto;
}

.btn-toast-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ===== Drop Zone ===== */
.dropzone {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: background var(--transition);
  min-height: 200px;
}
.dropzone:hover, .dropzone.dragging {
  background: var(--primary-light);
}

.dropzone-inner {
  border: 2px dashed var(--primary-border);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  transition: border-color var(--transition);
}
.dropzone:hover .dropzone-inner, .dropzone.dragging .dropzone-inner {
  border-color: var(--primary);
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.dropzone-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.dropzone-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.dropzone-formats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.format-badge {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.btn-browse {
  background: var(--bg-white);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition);
}
.btn-browse:hover { background: var(--primary-light); }

.file-selected {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  text-align: center;
  margin-top: 4px;
}

/* ===== Recorder ===== */
.recorder-zone {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 200px;
  border-left: 1px solid var(--border);
}

/* Permission Error Banner */
.permission-denied-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 8px;
  max-width: 420px;
}

.permission-denied-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.permission-denied-content strong {
  font-weight: 600;
}

.permission-denied-text {
  font-size: 13px;
  color: #dc2626;
  margin: 0;
}

.btn-permission-close {
  color: #dc2626;
  margin-left: auto;
}
.btn-permission-close:hover {
  background: #fee2e2;
}

.recorder-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}
.recorder-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.06);
}
.recorder-btn.permission-denied {
  background: #9ca3af;
  box-shadow: 0 4px 16px rgba(156,163,175,0.35);
  animation: shake-denied 0.5s ease;
}
.recorder-btn.permission-denied:hover {
  background: #6b7280;
  transform: none;
}
@keyframes shake-denied {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px) rotate(-5deg); }
  75% { transform: translateX(6px) rotate(5deg); }
}
.recorder-btn.recording {
  background: #ef4444;
  box-shadow: 0 0 0 8px rgba(239,68,68,0.15), 0 4px 16px rgba(239,68,68,0.35);
  animation: pulse-ring 1.5s ease infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.35), 0 4px 16px rgba(239,68,68,0.35); }
  70% { box-shadow: 0 0 0 14px rgba(239,68,68,0), 0 4px 16px rgba(239,68,68,0.35); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0), 0 4px 16px rgba(239,68,68,0.35); }
}

.recorder-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.recorder-timer {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-family: 'Courier New', monospace;
}

/* ===== Transcription Result ===== */
.transcription-result {
  border-top: 1px solid var(--border);
  padding: 20px 28px;
}

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

.transcription-result-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.transcription-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.transcription-textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
  background: var(--bg-white);
}
.transcription-textarea:focus { border-color: var(--primary); }
.transcription-textarea::placeholder { color: var(--text-muted); }

.transcription-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.transcription-footer-left {
  font-size: 12px;
  color: var(--text-muted);
}
.transcription-footer-right {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}
.status-dot.processing { background: #f59e0b; animation: blink 1s ease infinite; }
.status-dot.error { background: #ef4444; }
.status-dot.no-result { background: #f59e0b; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-mini {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== No Transcription Message ===== */
.no-transcription-message {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.no-transcription-message svg {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.no-transcription-message h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.no-transcription-message p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.no-transcription-message ul {
  text-align: left;
  max-width: 400px;
  margin: 0 auto 16px;
  padding-left: 20px;
}

.no-transcription-message li {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.no-transcription-suggestion {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: inline-block;
  margin-top: 8px !important;
}

.no-result-label {
  color: #f59e0b;
  font-weight: 500;
}

.search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap > svg:first-child {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 48px 10px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--text-muted); }
.search-btn {
  position: absolute;
  right: 6px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.search-btn:hover {
  background: var(--bg-page);
  color: var(--primary);
}

.filter-select {
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%236b7280%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpolyline points=%276 9 12 15 18 9%27%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 140px;
}

.btn-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}
.btn-refresh:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
}
.btn-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-refresh svg.spinning {
  animation: spin 1s linear infinite;
}

/* ===== Logout Modal ===== */
.modal-logout {
  max-width: 420px;
}

.modal-logout .modal-body-logout {
  text-align: center;
  padding: 40px 32px 24px;
}

.logout-icon-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.logout-icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.logout-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-align: center;
}

.logout-warning {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  max-width: 320px;
  margin: 0 auto;
}

.modal-footer-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 32px 28px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-page);
}

.modal-footer-logout .btn-secondary {
  min-width: 100px;
}

.modal-footer-logout .btn-logout-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 110px;
  background: #dc2626;
}

.modal-footer-logout .btn-logout-confirm:hover {
  background: #b91c1c;
}

/* ===== Data Table ===== */
.data-table-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
/* Opt-in horizontal scrolling, for a table with more columns than the viewport
   has room for. It has to be a modifier: the clipping above is what keeps the
   corners rounded, and the .actions-cell tooltip rule below depends on it. */
.data-table-wrap.scroll-x { overflow-x: auto; overflow-y: visible; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  border-bottom: 1px solid var(--border);
}
.data-table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  background: var(--bg-page);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-page); }
.data-table tbody tr[style*="cursor: pointer"]:hover { cursor: pointer; }

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: top;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.source-badge.public {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.source-badge.private {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}
.source-badge:not(.public):not(.private) {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}
.source-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== Image Preview ===== */
.image-preview-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 60px;
  overflow: hidden;
}

.image-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.image-preview-zoom-icon {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.image-preview-container:hover .image-preview-zoom-icon {
  opacity: 1;
}

.image-preview-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 60px;
  background: var(--bg-page);
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--text-muted);
}

/* ===== Caption Cell ===== */
.text-full {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  white-space: normal;
  word-wrap: break-word;
  max-width: 600px;
}

/* Action buttons live further down, under "Table action buttons". */

.record-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.record-filename {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  background: var(--bg-page);
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chunk-badge {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  padding: 2px 6px;
  border-radius: 10px;
  display: inline-block;
  margin-left: 4px;
}

.empty-transcription {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

/* ===== Mini Player Chunk Navigation ===== */
.mini-player-chunk-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  justify-content: center;
}

.mini-player-chunk-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-white);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
  padding: 0;
}

.mini-player-chunk-btn:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.mini-player-chunk-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.mini-player-chunk-btn:disabled:hover {
  background: var(--bg-white);
  border-color: var(--border);
  color: var(--text-secondary);
}

.mini-player-chunk-info {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 60px;
  text-align: center;
}

.mini-player {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-width: 130px;
}
.mini-player-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--transition);
}
.mini-player-btn:hover { background: var(--primary-hover); }
.mini-player-info {
  flex: 1;
  min-width: 0;
}
.mini-player-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 3px;
}
.mini-player-progress {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.1s linear;
}
.mini-player-time {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.text-truncate {
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  font-size: 14px;
}

.text-full {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  white-space: normal;
  word-wrap: break-word;
  max-width: 600px;
}

.created-at {
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

/* ===== Table action buttons ===== */
.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/*
 * Icon-only square. The box is deliberately fixed and the glyph inside is a
 * 16px SVG from components/Icons.js — putting a text label in here overflows
 * the box and collides with the neighbouring button.
 */
.action-btn {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  background: none;
  color: var(--text-secondary);
  padding: 0;
  position: relative;
}
.action-btn svg { display: block; }
.action-btn:hover:not(:disabled) { background: var(--bg-page); }
.action-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.action-btn.edit { color: var(--primary); }
.action-btn.edit:hover:not(:disabled) { background: var(--primary-light); }
.action-btn.delete { color: #ef4444; }
.action-btn.delete:hover:not(:disabled) { background: #fef2f2; }
.action-btn.lock { color: #f59e0b; }
.action-btn.lock:hover:not(:disabled) { background: #fffbeb; }
.action-btn.unlock { color: #10b981; }
.action-btn.unlock:hover:not(:disabled) { background: #ecfdf5; }
.action-btn.flag { color: #ea580c; }
.action-btn.flag:hover:not(:disabled) { background: #fff7ed; }
.action-btn.unflag { color: var(--text-secondary); }
.action-btn.clean { color: #0891b2; }
.action-btn.clean:hover:not(:disabled) { background: #ecfeff; }
.action-btn.correct { color: #16a34a; }
.action-btn.correct:hover:not(:disabled) { background: #f0fdf4; }
.action-btn.incorrect { color: #dc2626; }
.action-btn.incorrect:hover:not(:disabled) { background: #fef2f2; }
.action-btn.retry { color: #8b5cf6; }
.action-btn.retry:hover:not(:disabled) { background: #f5f3ff; }
.action-btn.retry.retrying {
  cursor: default;
  opacity: 1;
}
.action-btn.retry.retrying:hover { background: #f5f3ff; }
.action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.action-btn:disabled:hover {
  background: none;
}
.action-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: #fff;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  margin-bottom: 6px;
  box-shadow: var(--shadow-md);
  z-index: 100;
}
.action-btn[title]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text-primary);
  margin-bottom: -4px;
  z-index: 100;
}
/*
 * An actions column sits at the right edge of a table, and .data-table-wrap
 * clips overflow, so a centred nowrap bubble would be cut off. Grow leftwards
 * from the button and wrap instead of running off the edge.
 */
.actions-cell .action-btn[title]:hover::after {
  left: auto;
  right: 0;
  transform: none;
  white-space: normal;
  width: max-content;
  max-width: 230px;
  text-align: left;
  line-height: 1.45;
}

/* ===== Pagination ===== */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-size-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-white);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.page-size-select:hover {
  border-color: var(--primary);
}

.page-size-select:focus {
  border-color: var(--primary);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn:disabled:hover {
  background: var(--bg-white);
  border-color: var(--border);
  color: var(--text-primary);
}

.pagination-page-info {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state svg {
  color: var(--text-muted);
  margin-bottom: 16px;
}
.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/*
 * The dialog panel. Both class names are live: LogoutModal/DeleteModal render
 * `.modal`, while Modal/EditModal render `.modal-content` — which used to match
 * no rule at all, leaving those two dialogs with a transparent, unpadded box
 * that the page showed straight through.
 */
.modal,
.modal-content {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal.modal-small,
.modal-content.modal-small {
  max-width: 500px;
}

@keyframes slideUp { from{transform:translateY(16px);opacity:0} to{transform:translateY(0);opacity:1} }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.modal-meta-sep { color: var(--border); }
.modal-id { color: var(--primary); font-weight: 500; }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-page); }

.modal-body {
  padding: 20px 28px;
}

.audio-player-full {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.audio-player-full-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--transition);
}
.audio-player-full-btn:hover { background: var(--primary-hover); }
.audio-player-seek-btn {
  background: #f9fafb;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.audio-player-seek-btn:hover { background: var(--primary); color: #fff; }
.audio-player-speed-btn {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  background: #f9fafb;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.audio-player-speed-btn:hover { background: var(--primary); color: #fff; }
.audio-player-full-track {
  flex: 1;
}
.audio-player-full-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 5px;
  cursor: pointer;
}
.audio-player-full-progress {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
}
.audio-player-full-times {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  gap: 6px;
}
.audio-player-full-times span:nth-child(2) {
  color: var(--text-secondary);
}
.audio-player-full-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.audio-ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.audio-ctrl-btn:hover { color: var(--primary); }

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.confidence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.confidence-dot.low { background: #f59e0b; }
.confidence-dot.medium { background: #3b82f6; }
.confidence-dot.high { background: #22c55e; }

.modal-edit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Generated Transcription Section ===== */
.generated-transcription-section {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  overflow: hidden;
}

.generated-transcription-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.generated-transcription-header svg {
  color: var(--primary);
  flex-shrink: 0;
}

.generated-transcription-content {
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 200px;
  overflow-y: auto;
  font-family: var(--font);
}

/* ===== Caption Image Preview in Modal ===== */
.caption-image-preview {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 400px;
}

.caption-image {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
}

/* ===== Delete Preview Section ===== */
.delete-preview {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 8px;
}

.delete-preview p {
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.delete-preview p strong {
  color: var(--text-primary);
  display: inline-block;
  min-width: 120px;
}

/* ===== Manual Correction Section ===== */
.manual-correction-section {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  overflow: hidden;
}

.manual-correction-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.manual-correction-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-correction-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

.locked-warning {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #ef4444;
  font-weight: 500;
}

.manual-correction-frame {
  padding: 16px;
  background: var(--bg-page);
}

.manual-correction-frame .modal-textarea {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  line-height: 1.7;
  transition: border-color var(--transition);
  background: var(--bg-white);
}
.manual-correction-frame .modal-textarea:focus { border-color: var(--primary); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.modal-footer-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.modal-footer-actions {
  display: flex;
  gap: 10px;
}

/* ===== Delete Modal ===== */
.modal-delete {
  max-width: 440px;
}

.modal-header-delete {
  padding: 12px 20px 0;
  justify-content: flex-end;
}

.modal-header-delete .modal-close {
  position: static;
  margin-left: auto;
}

.modal-body-delete {
  padding: 32px 32px 24px;
  text-align: center;
}

.delete-icon-wrapper {
  margin-bottom: 20px;
}

.delete-icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fef2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: #ef4444;
}

.delete-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.delete-warning {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 24px;
}

.delete-preview {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
}

.delete-preview-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.delete-preview-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  font-style: italic;
  word-break: break-word;
}

.modal-footer-delete {
  padding: 20px 28px 28px;
  margin-top: 0;
}

.modal-footer-delete .btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.modal-footer-delete .btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 16px rgba(239,68,68,0.35);
}

.modal-footer-delete .btn-danger svg {
  flex-shrink: 0;
}

/* ===== Topbar avatar ===== */
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 2px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.topbar-help {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.topbar-help:hover { color: var(--text-primary); }

/* ===== Audio Player ===== */
.audio-player {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.audio-player-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.audio-player-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.audio-player-progress {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
  transition: height var(--transition);
}
.audio-player-progress:hover {
  height: 8px;
}

.audio-player-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.1s linear;
}

.audio-player-time {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 85px;
  text-align: right;
}

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}

.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.login-logo p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin: 6px 0 0;
}

.login-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-card-header {
  padding: 32px 32px 24px;
  text-align: center;
}

.login-card-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.login-card-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 8px 0 0;
}

.login-form {
  padding: 0 32px 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
}

.login-input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.login-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--primary);
}

.login-input:disabled {
  background: var(--bg-page);
  cursor: not-allowed;
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #dc2626;
  font-size: 13px;
  margin-bottom: 20px;
}

.login-error svg {
  flex-shrink: 0;
}

.login-submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.login-submit-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

.login-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-footer {
  padding: 20px 32px;
  background: var(--bg-page);
  text-align: center;
}

.login-footer p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* ===== Loading Screen ===== */
.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
}

.loading-spinner {
  text-align: center;
}

.loading-spinner p {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.spinner-small {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-large {
  width: 48px;
  height: 48px;
  border-width: 3px;
  border-color: rgba(37, 99, 235, 0.2);
  border-top-color: var(--primary);
}

/* ===== Sidebar Footer ===== */
.sidebar-footer {
  margin-top: auto;
  padding: 16px 10px;
  border-top: 1px solid var(--border);
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 2px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Stacked: the name and its role badge are two inline spans, so without a
   direction they butt straight together and read as one word. */
.sidebar-user-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.sidebar-user-email {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-logout-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.sidebar-logout-btn svg {
  flex-shrink: 0;
}

/* The topbar's user chip and logout button lived here; both now exist only in
   the sidebar footer, so their rules are gone. */

/* ===== Bulk Upload Styles ===== */
.file-selected-multi {
  margin-top: 8px;
  width: 100%;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.file-item {
  font-size: 12px;
  color: var(--text-primary);
  padding: 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid var(--border-light);
}

.file-item:last-child {
  border-bottom: none;
}

.file-more {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 0;
  font-style: italic;
}

.selected-file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
}

.file-item-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.file-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.file-item-number {
  font-weight: 700;
  color: var(--primary);
  min-width: 20px;
}

.file-item-name {
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-size {
  color: var(--text-secondary);
  font-size: 12px;
}

.file-item-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--primary-border);
}

.selected-file-list-single {
  max-height: none;
}

.selected-file-list-single .file-item-row {
  gap: 14px;
}

.media-preview {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0b1220;
  border: 1px solid var(--border);
}

.media-preview-compact .media-preview-video {
  max-height: 220px;
}

.media-preview-video {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #0b1220;
}

.transcription-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 160px;
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-page);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.transcription-processing p {
  margin: 0;
  font-size: 14px;
  max-width: 360px;
}

/* ===== Multiple Transcriptions ===== */
.multiple-transcriptions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.transcription-item {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.transcription-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.transcription-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-border);
}

.transcription-item-actions {
  display: flex;
  gap: 6px;
}

.btn-icon-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-white);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--primary);
  padding: 4px;
  border-radius: 4px;
  transition: background var(--transition);
  width: 26px;
  height: 26px;
}

.btn-icon-small:hover {
  background: var(--primary-light);
}

.transcription-textarea-small {
  min-height: 100px;
}

.transcription-item-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.single-transcription {
  display: flex;
  flex-direction: column;
}

/* ===== Completed Count ===== */
.completed-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Info Banner ===== */
.info-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: #2563eb;
  font-size: 14px;
  margin: 0 28px;
  margin-bottom: 16px;
}

.info-banner svg:first-child {
  flex-shrink: 0;
  color: #2563eb;
}

.btn-info-close {
  color: #2563eb;
  margin-left: auto;
}

.btn-info-close:hover {
  background: #dbeafe;
}

/* ===== Nepali Unicode Converter ===== */
.nepali-unicode-section {
  margin-top: 20px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

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

.nepali-unicode-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.nepali-unicode-title svg {
  color: var(--primary);
}

.nepali-unicode-frame {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.nepali-unicode-frame iframe {
  display: block;
}

.nepali-unicode-credit {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.nepali-unicode-credit a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.nepali-unicode-credit a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ===== Object Detection Specific Styles ===== */

/* Detection image preview with bounding box */
.detection-image-preview {
  position: relative;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 400px;
}

.detection-image {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
}

.detection-bbox-overlay {
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

/* Bounding box coordinates display */
.bbox-info {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.bbox-coords {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.bbox-coords span {
  background: var(--bg-white);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

/* Bounding box code display in table */
.bbox-code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-page);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Image Preview Modal */
.image-preview-modal {
  width: min(90vw, 960px);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.image-preview-modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-white);
}

.image-preview-modal-title {
  margin: 0;
  font-size: 18px;
}

.image-preview-modal-subtitle {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.image-preview-modal-body {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  max-height: 80vh;
  overflow: auto;
  background: #f8fafc;
}

.image-preview-frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 70vh;
  padding: 12px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.image-preview-modal-image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
}


/* =====================================================================
   Verification platform — shared UI added with the Edit/Verify Transcript,
   Users, User Stat, User Log and Guidance pages.
   ===================================================================== */

/* ----- generic page scaffolding ----- */
.page { display: flex; flex-direction: column; gap: 24px; }

.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.page-meta { color: var(--text-secondary); font-size: 13px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }

.panel-section {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px 22px; display: flex;
  flex-direction: column; gap: 18px;
}
/*
 * Card headings sit tighter to their own content than to the card edge, so the
 * heading reads as a label for what follows rather than a floating title.
 */
.panel-section h3 {
  font-size: 14px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-primary); margin-bottom: -6px;
}
.panel-hint { color: var(--text-secondary); font-size: 13px; line-height: 1.55; }

/* ----- tabs ----- */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: 9px 16px; background: none; border: none; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--text-secondary);
  border-bottom: 2px solid transparent; transition: var(--transition);
}
.tab-btn:hover:not(:disabled) { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- filter bar ----- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar select,
.filter-bar input[type="search"],
.filter-bar input[type="date"],
.filter-bar input[type="number"] {
  padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; background: var(--bg-white); color: var(--text-primary);
}
.filter-bar input[type="search"] { min-width: 240px; flex: 1; }

/*
 * Height comes from --control-h rather than from each control's own padding and
 * font size. A 13px input padded 8px and a 15px button padded 12px land ~8px
 * apart, which is what made a Search button overhang the box beside it.
 * Vertical padding is zeroed so the flex/inline centring does the work.
 */
.filter-bar select,
.filter-bar input[type="search"],
.filter-bar input[type="date"],
.filter-bar input[type="number"],
.filter-bar .btn-primary,
.filter-bar .btn-secondary,
.filter-bar .btn-success,
.filter-bar .btn-danger-solid,
.filter-bar .date-multi-trigger,
.page-toolbar .btn-primary,
.page-toolbar .btn-secondary,
.toolbar-actions .btn-primary,
.toolbar-actions .btn-secondary,
.selection-bar .btn-primary,
.selection-bar .btn-secondary,
.selection-bar .btn-success,
.selection-bar .btn-danger-solid {
  height: var(--control-h);
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
  flex-shrink: 0;
}
/* Buttons carry a larger type scale than the inputs; pull them into the same
   set so a bar reads as one row of controls. */
.filter-bar .btn-primary,
.filter-bar .btn-secondary,
.page-toolbar .btn-primary,
.page-toolbar .btn-secondary,
.toolbar-actions .btn-primary,
.toolbar-actions .btn-secondary {
  font-size: 14px;
  padding-left: 20px;
  padding-right: 20px;
}
/* The search field is the one control that should still absorb spare width. */
.filter-bar input[type="search"] { flex-shrink: 1; }
.filter-date { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }

/* ----- multi-date calendar ----- */
.date-multi { position: relative; }
.date-multi-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-white); color: var(--text-secondary);
  font: inherit; font-size: 13px; cursor: pointer; transition: var(--transition);
}
.date-multi-trigger:hover, .date-multi-trigger.open {
  border-color: var(--primary); color: var(--primary);
}
.date-multi-trigger strong { color: var(--text-primary); font-weight: 600; }
.date-multi-trigger.open strong { color: var(--primary); }
.date-multi-label { color: var(--text-muted); }

.date-multi-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 200;
  width: 268px; padding: 12px;
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
}
.date-multi-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 10px;
}
.date-multi-nav {
  width: 24px; height: 24px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-white);
  color: var(--text-secondary); font-size: 15px; line-height: 1; cursor: pointer;
}
.date-multi-nav:hover { background: var(--bg-page); color: var(--text-primary); }

.date-multi-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.date-multi-weekday {
  text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--text-muted); text-transform: uppercase; padding-bottom: 4px;
}
.date-multi-day {
  height: 30px; border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text-primary);
  font: inherit; font-size: 12.5px; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.date-multi-day:hover:not(:disabled) { background: var(--primary-light); color: var(--primary); }
.date-multi-day.today { box-shadow: inset 0 0 0 1px var(--primary-border); font-weight: 600; }
.date-multi-day.selected {
  background: var(--primary); color: #fff; font-weight: 600;
}
.date-multi-day.selected:hover { background: var(--primary-hover); color: #fff; }
.date-multi-day:disabled { color: var(--text-muted); opacity: 0.4; cursor: not-allowed; }

.date-multi-hint {
  margin-top: 10px; font-size: 11px; line-height: 1.45; color: var(--text-muted);
}
.date-multi-hint strong { color: var(--text-secondary); }
.date-multi-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-light);
}

/* ----- multi-user picker (shares the calendar's trigger and panel) ----- */
/* A long roster scrolls inside the popover rather than running off the page. */
.user-multi-panel { width: 260px; max-height: 320px; overflow-y: auto; }
.user-multi-row { padding: 5px 2px; cursor: pointer; }
.user-multi-row span:first-of-type { color: var(--text-primary); font-weight: 500; }
.user-multi-load { margin-left: auto; font-size: 11px; color: var(--text-muted); }

/* ----- assignment work panel ----- */
/* The summary line above the action buttons: what is picked, where it goes. */
.assign-summary { margin-bottom: 12px; }
.assign-summary .muted { font-weight: 400; color: var(--text-secondary); }
.handoff-scope-hint { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }
.handoff-preview {
  margin: 12px 0 0; padding: 10px 14px; font-size: 13px;
  background: var(--bg-page); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
}
.handoff-preview strong { color: var(--text-primary); }
.batch-row { cursor: pointer; }
.batch-row-open { background: var(--primary-light); }

/* An opened batch: one block per recipient, their videos under them, and their
   audio under that when the header is clicked. */
.batch-breakdown { display: flex; flex-direction: column; gap: 14px; }
.breakdown-user {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-white); overflow: hidden;
}
.breakdown-head {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; border-bottom: 1px solid var(--border);
  background: var(--bg-page); font: inherit; font-size: 13px;
  color: var(--text-primary); text-align: left; cursor: pointer;
}
.breakdown-head:hover { background: var(--primary-light); }
.breakdown-head.open { background: var(--primary-light); }
.breakdown-head .muted { font-size: 12px; color: var(--text-secondary); }
.breakdown-head::after {
  content: '▸'; margin-left: auto; color: var(--text-muted); font-size: 11px;
}
.breakdown-head.open::after { content: '▾'; }
.breakdown-audio { border-top: 1px solid var(--border); padding: 4px 0; }

/* ----- forms ----- */
.field-label {
  display: block; font-size: 13px; font-weight: 600;
  margin: 14px 0 6px; color: var(--text-primary);
}
.field-label:first-child { margin-top: 0; }
.field-hint { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.form-input, .form-textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: inherit; font-size: 14px;
  background: var(--bg-white); color: var(--text-primary);
}
.form-input:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { resize: vertical; line-height: 1.6; }
.inline-select {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; background: var(--bg-white);
}
/* Text counterpart to .inline-select, for a value edited in place in a table. */
.inline-input {
  width: 100%; max-width: 110px;
  padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; background: var(--bg-white); color: var(--text-primary);
}
.inline-input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.inline-input::placeholder { color: var(--text-secondary); font-size: 12px; }
/* A model name is a good deal longer than a temperature. */
.inline-input-wide { max-width: 220px; }
.checkbox-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }

/* ----- buttons ----- */
.btn-success {
  padding: 8px 14px; border: none; border-radius: var(--radius-sm);
  background: #16a34a; color: #fff; font: inherit; font-size: 13px;
  font-weight: 500; cursor: pointer; transition: var(--transition);
}
.btn-success:hover:not(:disabled) { background: #15803d; }
/*
 * Solid-red counterpart to .btn-success. Bare `.btn-danger` is only a colour
 * tweak intended to sit on `.btn-icon`, so a verdict button that uses it alone
 * falls back to default browser button chrome — use this instead.
 */
.btn-danger-solid {
  padding: 8px 14px; border: none; border-radius: var(--radius-sm);
  background: #dc2626; color: #fff; font: inherit; font-size: 13px;
  font-weight: 500; cursor: pointer; transition: var(--transition);
}
.btn-danger-solid:hover:not(:disabled) { background: #b91c1c; }
.btn-danger-solid:disabled { opacity: 0.5; cursor: not-allowed; }
/* Label preceded by an inline SVG glyph, kept on the text's baseline. */
.btn-with-icon { display: inline-flex; align-items: center; gap: 6px; }
.btn-large { padding: 12px 22px; font-size: 15px; align-self: flex-start; }
.btn-link {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font: inherit; font-size: 13px; padding: 2px 6px; border-radius: 4px;
}
.btn-link:hover:not(:disabled) { background: var(--primary-light); }
.btn-link.danger { color: #dc2626; }
.btn-link.danger:hover { background: #fef2f2; }
.btn-link:disabled, .btn-success:disabled, .btn-large:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- background worker note -----
   One line above the page saying what the worker is doing. A note, never a
   modal: the job runs whether or not anyone acknowledges it, so this must not
   take focus or move the page under someone's cursor. */
.worker-note {
  position: relative;
  margin: 0 24px 12px; padding: 8px 40px 8px 12px;
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius-sm); background: var(--bg-white);
}
.worker-note-running { border-left-color: var(--primary); }
.worker-note-failed  { border-left-color: #dc2626; background: #fef2f2; }
.worker-note-done    { border-left-color: #16a34a; }

.worker-note-line {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 0; border: none; background: none; font: inherit;
  font-size: 13px; color: var(--text-primary); text-align: left; cursor: pointer;
}
.worker-note-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worker-note-more { font-size: 12px; color: var(--primary); flex: none; }

.worker-note-dismiss {
  position: absolute; top: 4px; right: 8px;
  border: none; background: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--text-muted);
}
.worker-note-dismiss:hover { color: var(--text-primary); }

.worker-note-detail {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-light);
  display: flex; flex-direction: column; gap: 6px;
}
.worker-note-row { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.worker-note-row-text { flex: 1; min-width: 0; color: var(--text-secondary); }
.worker-note-error {
  display: block; margin-top: 2px; color: #b91c1c; word-break: break-word;
}

/* What a delete is about to take with it, one line per kind. */
.delete-summary {
  margin: 10px 0 0; padding-left: 20px;
  font-size: 13px; color: var(--text-primary); line-height: 1.8;
}

/* ----- badges ----- */
.state-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: capitalize; white-space: nowrap;
}
.state-pending  { background: var(--primary-light); color: #1d4ed8; }
.state-locked   { background: #ecfdf5; color: #047857; }
.state-flagged  { background: #fffbeb; color: #b45309; }
/* A step that is on or off. Off is a setting, not a disabled row — the model
   and temperature beside it are still what it would run with, so only the badge
   is greyed, never the text. */
.state-active   { background: #ecfdf5; color: #047857; }
.state-inactive { background: #f1f5f9; color: #475569; }

.role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.role-admin { background: #f5f3ff; color: #6d28d9; }
.role-user  { background: #f1f5f9; color: #475569; }

.method-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; font-family: ui-monospace, monospace;
}
.method-post   { background: #ecfdf5; color: #047857; }
.method-put,
.method-patch  { background: var(--primary-light); color: #1d4ed8; }
.method-delete { background: #fef2f2; color: #b91c1c; }

.source-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  background: #f1f5f9; color: #475569;
}
.source-tag.source-edited { background: var(--primary-light); color: #1d4ed8; }
.source-tag.source-llm1,
.source-tag.source-llm2 { background: #f5f3ff; color: #6d28d9; }
/* A human pass on the Transcript History rail — green, like a locked chunk. */
.source-tag.source-pass { background: #ecfdf5; color: #047857; }

/* Who is speaking in this chunk, when diarization cut it. */
.speaker-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
  background: #eef2ff; color: #4338ca;
}

.warn-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; background: #fffbeb; color: #b45309;
}
.hint-badge {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px;
  font-size: 10px; background: #f1f5f9; color: #64748b; cursor: help;
}

/* ----- tables ----- */
.data-table.compact td, .data-table.compact th { padding: 8px 10px; font-size: 13px; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono-cell { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; }
.cell-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
/* For a sub-line that is part of the answer rather than a footnote to it —
   "from .env" says where a live setting comes from and has to be readable. */
.cell-sub.cell-note { color: var(--text-secondary); font-size: 12px; }
/*
 * Laid out inline, NOT with `display: flex` on the <td>. A flex <td> stops being
 * a table cell, and two adjacent ones get absorbed into a single anonymous cell
 * and stack vertically — which put the Actions icons under the Assigned-to
 * column. Children are inline-level already (.action-btn is inline-flex), so
 * vertical-align plus a margin does the job and the cells stay real cells.
 */
.actions-cell, .assign-cell { white-space: nowrap; }
.actions-cell > *, .assign-cell > * { vertical-align: middle; }
.actions-cell > * + *, .assign-cell > * + * { margin-left: 4px; }
.assign-cell .inline-select { max-width: 118px; }
.row-selected { background: var(--primary-light) !important; }
.row-divider td { border-top: 2px solid var(--border); }
.transcript-cell { max-width: 460px; }
.transcript-text {
  line-height: 1.55; max-height: 4.7em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.transcript-meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

/* ----- selection bar ----- */
.selection-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--primary-light); border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
}

/* ----- pagination ----- */
.pagination-info { color: var(--text-secondary); font-size: 13px; }
.pagination-controls { display: flex; gap: 4px; }
.pagination-btn {
  min-width: 32px; padding: 6px 9px; border: 1px solid var(--border);
  background: var(--bg-white); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; cursor: pointer; transition: var(--transition);
}
.pagination-btn:hover:not(:disabled) { background: var(--bg-page); }
.pagination-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-size { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.pagination-size select {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit;
}

/* ----- toast ----- */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 1200;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); background: var(--bg-white);
  border-left: 4px solid var(--primary); max-width: 460px; font-size: 14px;
}
.toast-success { border-left-color: #16a34a; }
.toast-error   { border-left-color: #dc2626; }
.toast-info    { border-left-color: var(--primary); }
.toast-close {
  background: none; border: none; font-size: 20px; line-height: 1;
  cursor: pointer; color: var(--text-muted);
}

/* ----- modal additions ----- */
/* Wide enough to give the editor's two columns a readable width each. */
.modal-wide { max-width: 1040px; width: 94%; }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.modal-header-right { display: flex; align-items: center; gap: 10px; }

/* ----- audio ----- */
.audio-pane {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--bg-page); border-radius: var(--radius-sm);
}
.audio-pane-empty { color: var(--text-muted); font-size: 13px; }
.audio-play-btn {
  width: 34px; height: 34px; flex-shrink: 0; border: none; border-radius: 50%;
  background: var(--primary); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.audio-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; cursor: pointer; }
.audio-progress { height: 100%; background: var(--primary); border-radius: 3px; }
.audio-time { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.mini-player-missing { font-size: 11px; color: var(--text-muted); font-style: italic; }
.mini-player-loading { font-size: 12px; color: var(--text-muted); }

/* ----- transcript variants ----- */
.variant-tabs { display: flex; align-items: center; gap: 4px; margin-top: 16px; }
.variant-tab {
  padding: 5px 12px; border: 1px solid var(--border); background: var(--bg-white);
  border-radius: var(--radius-sm); font: inherit; font-size: 12px; cursor: pointer;
}
.variant-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.variant-tab:disabled { opacity: 0.4; cursor: not-allowed; }
/* Editors get one variant, so its name is a label rather than a tab to click. */
.variant-tab-static { cursor: default; background: var(--bg-page); color: var(--text-secondary); }
.variant-action { margin-left: auto; }
.reference-block {
  margin-top: 10px; padding: 12px; background: var(--bg-page);
  border-radius: var(--radius-sm); flex: 1; min-height: 0; overflow: auto;
}
.reference-text {
  white-space: pre-wrap; word-break: break-word; font: inherit;
  font-size: 13px; line-height: 1.6; color: var(--text-secondary);
}
.reference-meta { margin-top: 8px; font-size: 11px; color: var(--text-muted); }
.transcript-editor { font-size: 15px; line-height: 1.7; flex: 1; min-height: 0; }
.editor-meta {
  display: flex; gap: 16px; margin-top: 8px;
  font-size: 12px; color: var(--text-muted);
}

/*
 * Model output beside the correction. Equal-height columns so the read-only
 * reference and the textarea line up, collapsing to one column when the
 * viewport can no longer give each side a usable width.
 */
.editor-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  margin-top: 16px;
  min-height: 340px;
}
@media (max-width: 900px) {
  .editor-columns { grid-template-columns: 1fr; min-height: 0; }
}
.editor-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  overflow: hidden;
}
.editor-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}
.editor-card-head label { font: inherit; color: inherit; }
.editor-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 12px 14px 14px;
}
/* The tab row is the card's first element here, so it needs no top offset. */
.editor-card-body .variant-tabs { margin-top: 0; }
.warn-strip {
  margin-top: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: #fffbeb; color: #b45309; font-size: 13px;
}

/* ----- transcribe page ----- */
.transcribe-options { display: flex; gap: 24px; flex-wrap: wrap; }
.option-group { min-width: 280px; flex: 1; }
.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* The three ways of handing over audio, side by side — alternatives, not steps.
   The dropzone needs the most room and the URL field the least, so the columns
   are weighted rather than equal; they stack on a narrow screen. */
.source-grid {
  display: grid; gap: 16px; align-items: stretch;
  grid-template-columns: minmax(320px, 1.4fr) minmax(200px, 0.8fr) minmax(260px, 1fr);
}
@media (max-width: 1100px) {
  .source-grid { grid-template-columns: 1fr; }
}
.source-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px;
}
.source-card h4 {
  margin: 0; font-size: 13px; font-weight: 600; color: var(--text-primary);
}
/* The dropzone and the recorder fill the card they were given; a text field
   keeps its own height — stretching it to match a dropzone makes it read as a
   textarea for pasting many URLs, which it is not. */
.source-card > .dropzone,
.source-card > .recorder-zone { flex: 1; }
.source-card .field-hint { margin-top: 0; }
.youtube-form { display: flex; flex-direction: column; gap: 4px; max-width: 640px; }
.selected-files {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px;
}
.selected-files-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 14px; font-weight: 500;
}
.selected-file {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--border-light);
}
.selected-file-name { flex: 1; font-size: 13px; }
.selected-file-size { font-size: 12px; color: var(--text-muted); }
.status-strip {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--primary-light); border-radius: var(--radius-sm); font-size: 14px;
}
.results-block { display: flex; flex-direction: column; gap: 10px; }

/* ----- stats ----- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.stat-card {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px;
  display: flex; flex-direction: column; gap: 16px;
}
.stat-card-header { display: flex; align-items: center; justify-content: space-between; }
.stat-card-header h3 { font-size: 16px; font-weight: 600; }
.stat-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.metric-value { font-size: 22px; font-weight: 600; }
.metric-sub { font-size: 11px; color: var(--text-secondary); }
.stat-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-chart h4 { font-size: 13px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.chart-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px;
}
.stat-breakdown td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* ----- user log diff ----- */
.diff-row td { background: var(--bg-page); }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 6px 0; }
.diff-label { font-size: 11px; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.diff-old { color: #b91c1c; }
.diff-new { color: #047857; }
.diff-text {
  white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 13px;
  line-height: 1.6; background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px; max-height: 240px; overflow: auto;
}
.diff-meta { font-size: 11px; color: var(--text-muted); padding-top: 6px; }

/* ----- transcript history: text as columns -----
   Every version of a chunk side by side, so the table is as wide as the
   comparison being made and scrolls sideways inside its wrapper. */
.page-caption {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  margin: 0 0 14px; max-width: 780px;
}
/* Without a min-width the browser squeezes the text columns to fit instead of
   overflowing, and .scroll-x would have nothing to scroll. */
.history-table { min-width: 100%; width: max-content; }
.history-table th, .history-table td { vertical-align: top; }

/* An action column stays reachable however far the table is scrolled. */
.scroll-x .sticky-col {
  position: sticky; left: 0; z-index: 2;
  background: var(--bg-white); border-right: 1px solid var(--border);
}
.scroll-x thead .sticky-col { z-index: 3; }
.scroll-x .row-expanded .sticky-col { background: var(--primary-light); }

/* Same, pinned to the right edge — for a details button that reads as the end
   of the row rather than the start of it. */
.scroll-x .sticky-col-right {
  position: sticky; right: 0; z-index: 2;
  background: var(--bg-white); border-left: 1px solid var(--border);
}
.scroll-x thead .sticky-col-right { z-index: 3; background: var(--bg-page); }
.scroll-x .row-expanded .sticky-col-right { background: var(--primary-light); }
.scroll-x .diff-row td { background: var(--bg-page); }

.text-cell { cursor: pointer; }
/* Whole-row version of the same affordance, where every cell belongs to one
   chunk and there is nothing else in the row to click. */
.row-text-toggle { cursor: pointer; }
.row-text-toggle:hover { background: var(--bg-page); }
.cell-text {
  font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  margin-top: 4px;
  /* Three lines at rest keeps 20 rows scannable; the row-level class below
     releases every cell in a row together, so the versions stay aligned. */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.cell-text.empty { color: var(--text-muted); }
.row-text-open .cell-text { -webkit-line-clamp: unset; overflow: visible; }

.editor-pass + .editor-pass {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.editor-pass-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.edit-metric {
  display: inline-block; margin-top: 6px; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
}
.edit-metric-none { background: #ecfdf5; color: #047857; }
.edit-metric-low { background: var(--primary-light); color: var(--primary); }
.edit-metric-high { background: #fef3c7; color: #b45309; }
.edit-metric-unknown { background: var(--bg-page); color: var(--text-muted); font-weight: 500; }

/* The metadata the table used to spend its columns on. */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 24px; margin: 0; padding: 6px 0;
}
.detail-grid dt {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); margin-bottom: 2px;
}
.detail-grid dd { margin: 0; font-size: 13px; color: var(--text-primary); }
.detail-heading {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); margin: 16px 0 6px;
}

/* ----- speakers ----- */
.speaker-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.speaker-card {
  display: flex; flex-direction: column; gap: 2px; min-width: 170px;
  padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: inherit; transition: var(--transition);
}
.speaker-card:hover { border-color: var(--primary); }
.speaker-card.selected { border-color: var(--primary); background: var(--primary-light); }
.speaker-card strong { font-size: 14px; color: var(--text-primary); }

/* A card does two things — open this speaker's clips, and tick it as one of
   several that are really the same person — so the tick box sits outside the
   button rather than inside it, which would be a button within a button. */
.speaker-card { flex-direction: row; align-items: flex-start; gap: 10px; }
.speaker-card.picked { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.speaker-card-open {
  display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0;
  padding: 0; border: none; background: none; font: inherit;
  text-align: left; cursor: pointer;
}
.speaker-card-pick { display: flex; align-items: center; padding-top: 2px; }

/* An Edit Transcript row is ~114px: 28px of cell padding plus a 3-line
   transcript clamp. A speaker row is twice that, because the thing being judged
   is a clip to watch rather than a line to skim. */
.speaker-clips td { height: 228px; vertical-align: middle; }
/* vertical-align on the cells above is why this is not the table default:
   .data-table td is `top`, which leaves everything stranded at the ceiling once
   a row is this tall. */
.clip-player {
  display: block; width: 100%; max-width: 280px; max-height: 200px;
  border-radius: var(--radius-sm); background: #000;
}
/* The clip is one chunk, so this is that chunk's transcript. Scrolls inside the
   cell rather than stretching the row: rows here are already 228px of video. */
.speaker-clips .clip-text {
  max-height: 200px; overflow-y: auto; white-space: pre-wrap;
  line-height: 1.5; font-size: 0.9rem;
}

/* ----- models ----- */
/* A retired model still explains transcripts it made, so it stays listed —
   just dimmed, rather than hidden. */
.row-muted td { opacity: 0.55; }

/* ----- column picker ----- */
.column-picker-panel { width: 280px; max-height: 380px; overflow-y: auto; }
.column-picker-group + .column-picker-group {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-light);
}
.column-picker-group-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); margin-bottom: 4px;
}

/* ----- guidance ----- */
.guidance-view, .guidance-preview {
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 24px;
}
.guidance-editor { display: grid; grid-template-columns: 1fr; gap: 16px; }
.guidance-editor.with-preview { grid-template-columns: 1fr 1fr; }
.guidance-pane { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pane-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.guidance-textarea {
  min-height: 460px; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius-md); font-family: ui-monospace, monospace;
  font-size: 13px; line-height: 1.7; resize: vertical;
}
.guidance-preview { min-height: 460px; overflow: auto; }

.markdown-body { line-height: 1.7; }
.markdown-body h1 { font-size: 26px; margin: 0 0 14px; }
.markdown-body h2 { font-size: 20px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.markdown-body h3 { font-size: 16px; margin: 20px 0 8px; }
.markdown-body p  { margin: 0 0 12px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 12px; padding-left: 24px; }
.markdown-body li { margin-bottom: 5px; }
.markdown-body code {
  background: var(--bg-page); padding: 2px 5px; border-radius: 4px;
  font-family: ui-monospace, monospace; font-size: 0.9em;
}
.markdown-body pre {
  background: var(--bg-page); padding: 14px; border-radius: var(--radius-sm);
  overflow-x: auto; margin: 0 0 12px;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote {
  border-left: 3px solid var(--primary-border); padding-left: 14px;
  color: var(--text-secondary); margin: 0 0 12px;
}
.markdown-body table { border-collapse: collapse; margin: 0 0 12px; width: 100%; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.markdown-body th { background: var(--bg-page); font-weight: 600; }
.markdown-body a { color: var(--primary); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* .sidebar-user-role is gone — the footer shows a .role-badge now. */

@media (max-width: 900px) {
  .stat-charts, .diff-grid, .guidance-editor.with-preview { grid-template-columns: 1fr; }
}

