/* ===== 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);
  /* Inter has no Devanagari, so Nepali falls through to Kalimati below — which
     ships with the app, so it is the same glyphs on every machine. Latin never
     reaches it: see the unicode-range on the @font-face. */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Kalimati', sans-serif;
  --font-ne: 'Kalimati', var(--font);
  --sidebar-width: 240px;
  --transition: 0.18s ease;
  /* One height for every control that can sit in a row with an input. */
  --control-h: 38px;
}

/*
 * Kalimati (GPL-2.0+, Sanir Karmacharya — see public/fonts/LICENSE-Kalimati.txt)
 * is bundled rather than looked up on the client. Mangal is Windows-only and
 * Noto is absent on plenty of machines, so a system-font stack drew the same
 * transcript differently on every desk. Regular only — there is no bold cut.
 *
 * unicode-range is what keeps this off Latin. Kalimati's cmap covers 20-7E, so
 * without it every digit, timestamp and English word inside a transcript cell
 * would leave Inter too. It also means the file is only fetched once Devanagari
 * actually renders.
 */
@font-face {
  font-family: 'Kalimati';
  src: url(/static/media/Kalimati.2d988cd4.ttf) format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0900-097F, U+200C-200D, U+25CC;
}

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

/* Prefer dynamic viewport units so mobile browser chrome does not clip the shell. */
@supports (height: 100dvh) {
  html, body, #root { height: 100dvh; }
}

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;
  height: 100dvh;
  overflow: hidden;
}

/* Scrim behind the off-canvas nav. Hidden on desktop; see responsive block. */
.sidebar-backdrop {
  display: none;
}

/* Menu control for the drawer — hidden while the sidebar is always on screen. */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  margin-right: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-page); border-color: var(--text-muted); }

.sidebar-logo-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-logo-row .sidebar-logo {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0 8px 16px 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-close-btn:hover { background: var(--bg-page); color: var(--text-primary); }

/* ===== 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;
  cursor: pointer;
}

.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;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.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;
}

/* A heading over the pages that share a section, and the indent that ties them
   to it. Not a button — there is no page behind the heading itself. */
.sidebar-nav-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 12px 4px;
}
.sidebar-nav-item.sub {
  padding-left: 24px;
  font-size: 13px;
}

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

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  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);
}

/*
 * The destructive confirm.
 *
 * This used to set `color: #ef4444` and nothing else, on the theory that it was
 * a modifier rather than a button. Nothing enforced that: two delete dialogs
 * used it on its own and rendered red text with no padding, background or
 * radius — a "Delete" that did not look like a button at all. It now carries
 * the full shape, so both `.btn-danger` and `.btn-primary.btn-danger` are
 * buttons and the pairing is belt-and-braces rather than load-bearing.
 */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ef4444;
  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(239, 68, 68, 0.25);
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}
.btn-danger:active { transform: translateY(0); }
.btn-danger:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none;
}
.btn-danger:disabled:hover { background: #ef4444; }

/* ===== 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;
}

/* The transcript list (EditTranscriptPage.js): column widths as classes, not
   inline styles, so they can actually be overridden below instead of being
   pinned regardless of viewport. */
.transcript-list-table .col-id { width: 70px; }
.transcript-list-table .col-audio { width: 110px; }
.transcript-list-table .col-state { width: 100px; }
.transcript-list-table .col-next-pass { width: 190px; }
.transcript-list-table .col-locked-by { width: 110px; }
.transcript-list-table .col-assigned { width: 190px; }
.transcript-list-table .col-training { width: 72px; }
.transcript-list-table .col-actions { width: 240px; }

.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: 100px;
}
.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; }
/* Grey until the account is actually on payroll, so the colour in a column of
   users says at a glance who is paid. */
.action-btn.pay { color: var(--text-secondary); }
.action-btn.pay.on { color: #059669; }
.action-btn.pay: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;
  max-height: 90dvh;
  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); }
/* The transcript editor's copy. The transport is a means to an end there — four
   correction boxes want the height more than the player does — so it loses the
   padding and a few pixels off the button. The base sizing above is what the
   public transcribe page wants and stays untouched. */
.audio-player-full-compact {
  padding: 7px 12px;
  gap: 10px;
  margin-bottom: 12px;
}
.audio-player-full-compact .audio-player-full-btn { width: 30px; height: 30px; }
.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;
  /* The bar is dragged, not scrolled: without this a touch drag pans the page
     instead of scrubbing, and the pointermove events never arrive. */
  touch-action: none;
  transition: height var(--transition);
}
/* A 4px target is hard to hit on purpose — grow it under the cursor. */
.audio-player-full-bar:hover { height: 6px; }
.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;
}

/* No italic: this text is usually Devanagari, Kalimati has no italic cut, and
   the browser's synthetic oblique slants the shirorekha — which reads as a
   rendering fault, not emphasis. The quotes around it already mark the quote. */
.delete-preview-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  word-break: break-word;
}

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

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

/* `.btn-danger` now carries the shape on its own, so this pairing only has to
   win the colour back from `.btn-primary`, whichever order they are written in. */
.btn-primary.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}

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

.btn-primary.btn-danger:disabled:hover {
  background: #ef4444;
}

/* ===== 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); }
/* A checkbox has no border to line up, but it still has to sit on the bar's
   shared control height or its label rides high against the selects. */
.filter-bar .checkbox-inline { height: var(--control-h); flex-shrink: 0; white-space: nowrap; }

/* ----- 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); }
/* Balanced / by-percentage split between several recipients. */
.share-split { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.share-split-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; }
.share-split-rows { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.share-split-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.share-split-name { font-weight: 500; color: var(--text-primary); }
.share-split-row input { width: 72px; }
.share-total { font-size: 12px; font-weight: 600; }
.share-total.ok { color: var(--text-muted); }
.share-total.bad { color: #dc2626; }
.handoff-split-table { margin-top: 8px; max-width: 520px; }
.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; }
/* A hint about a half-finished setting rather than an error: the form still
   saves, but the result will not be what the admin is expecting. */
.field-hint.warn { color: #b45309; }

/* Secondary text sitting inline in a sentence or a filter bar. Long used in JSX
   with no rule behind it — it only had an effect nested under .assign-summary or
   .breakdown-head, so everywhere else it silently did nothing. `.cell-sub` is not
   a substitute: that is a block with its own margin, so it cannot sit mid-line. */
.muted { color: var(--text-secondary); }

/* Money and measurements read down a column, so they align on the decimal.
   `.mono-cell` is not a substitute — it switches to a monospace family meant for
   ids, which makes an amount look like a hash. */
.data-table .num-cell { text-align: right; font-variant-numeric: tabular-nums; }

/* A row whose figures just moved under a refresh. Brief, then gone — unlike
   .row-muted, which dims permanently, and .batch-row-open, which is a selection. */
.data-table tr.row-changed td {
  background: var(--primary-light);
  transition: background 600ms ease;
}

/* The in-row refresh button while it is recomputing. `svg.spinning` is defined
   only under .btn-refresh, so the action-btn variant had no spin of its own. */
.action-btn.retry.retrying svg { animation: spin 1s linear infinite; }

/* ----- pay periods: the payroll roster, and telling accounts apart ----- */

/*
 * Every payable account, as the filter for the table below it. A dropdown was
 * what this used to be, and a dropdown answers "show me one" while hiding the
 * question actually being asked — who is on payroll, on what cycle, and how much
 * of it has been settled. Wrapping chips answer both at a glance.
 */
.pay-roster {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 4px 0 14px;
}

.pay-roster-chip {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 150px; padding: 8px 12px;
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-white); color: var(--text-primary);
  font: inherit; text-align: left; cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.pay-roster-chip:hover { border-color: var(--primary-border); }
.pay-roster-chip.selected {
  border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light);
}
/* "All users" carries no account colour, so its left edge stays neutral —
   a tone there would read as a tenth person. */
.pay-roster-chip.all { border-left-color: var(--border); }

.pay-roster-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
}
.pay-roster-terms {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-secondary);
}
.pay-roster-from { white-space: nowrap; }
.pay-roster-tally { font-size: 11px; color: var(--text-muted); }

/* The cycle length, as a badge rather than a sentence: a fortnight and a month
   are different amounts of work behind the same per-minute rate, so the length
   has to be legible on every row that depends on it. */
.cycle-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; white-space: nowrap;
  background: #f5f3ff; color: #6d28d9;
}

/* Which of a period's two independent figures a row prices — normalized is
   the default/primary basis, verbatim the reference one being phased in. */
.basis-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; white-space: nowrap;
}
.basis-normalized { background: var(--primary-light); color: var(--primary); }
.basis-verbatim { background: #fef3c7; color: #b45309; }

/*
 * One colour per account, assigned by position in the payroll (see TONES in
 * PayPeriodsPage) or in the editor list (TranscriptHistoryPage). Where a table
 * mixes people the eye has to group by person before it reads anything; the dot
 * and the row's left edge do that, and the name is always beside them because a
 * colour is never an identifier.
 */
.pay-tone-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--tone, var(--text-muted)); flex: none;
}
.pay-roster-chip.tone-0, .data-table tr.pay-row.tone-0, .user-badge.tone-0 { --tone: #2563eb; }
.pay-roster-chip.tone-1, .data-table tr.pay-row.tone-1, .user-badge.tone-1 { --tone: #059669; }
.pay-roster-chip.tone-2, .data-table tr.pay-row.tone-2, .user-badge.tone-2 { --tone: #d97706; }
.pay-roster-chip.tone-3, .data-table tr.pay-row.tone-3, .user-badge.tone-3 { --tone: #7c3aed; }
.pay-roster-chip.tone-4, .data-table tr.pay-row.tone-4, .user-badge.tone-4 { --tone: #db2777; }
.pay-roster-chip.tone-5, .data-table tr.pay-row.tone-5, .user-badge.tone-5 { --tone: #0891b2; }
.pay-roster-chip.tone-6, .data-table tr.pay-row.tone-6, .user-badge.tone-6 { --tone: #65a30d; }
.pay-roster-chip.tone-7, .data-table tr.pay-row.tone-7, .user-badge.tone-7 { --tone: #e11d48; }

.pay-roster-chip[class*="tone-"] { border-left-color: var(--tone); }
/* Only the first cell is tinted. A whole row in the account's colour would
   compete with .row-changed and with the status badges, which carry meaning. */
.data-table tr.pay-row td:first-child { box-shadow: inset 3px 0 0 var(--tone); }
.pay-user { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* The divider between work in progress and settled history. A <tr> rather than a
   second <table> so both groups keep one set of column widths — two tables would
   drift apart the moment a username got longer. */
.data-table tr.group-row td {
  padding: 7px 10px;
  background: var(--border-light);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-secondary);
}
.data-table tr.group-row .group-count {
  margin-left: 8px;
  font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--text-muted);
}
.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: the compact destructive button for a
 * toolbar or a row, where `.btn-danger`'s dialog-sized 12px/28px padding is too
 * big. Same colour, smaller box.
 */
.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; }
.state-training { background: #eff6ff; color: #1e40af; }

/* Training export — layers icon in its own column (admin Edit Transcript). */
.training-cell {
  text-align: center;
  vertical-align: middle;
}
.training-cell-empty {
  color: var(--text-muted, #94a3b8);
}
.training-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.training-mark-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  color: #1e40af;
  flex: 0 0 auto;
}
/* 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; }

/* Who did a piece of work, where the work itself is what the cell is for —
   the account leads the cell and the text follows underneath, so the name has
   to read as a label rather than as the first line of the transcript. */
.user-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-page); color: var(--text-secondary); white-space: nowrap;
}

.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; }
/* The editor's normalized row — a human text like `edited`, one step past it. */
.source-tag.source-normalized { background: #ecfdf5; color: #047857; }
.source-tag.source-llm1,
.source-tag.source-llm2 { background: #f5f3ff; color: #6d28d9; }

/* 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;
}

/* Words an editor could not hear, and tags two editors disagreed about.
 *
 * `.review-tag` had been rendering as unstyled inline text since it was added —
 * the class was used in two places and defined in none. It gets its rule here
 * alongside the one it is now read next to, so the pairing holds: red is "this
 * text was doubted", amber is "the two passes disagreed about the audio", and
 * both mean the same thing on a row as they do inside the editor. */
.review-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; background: #fef2f2; color: #b91c1c;
}
.tag-diff-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; background: #fff7ed; color: #c2410c;
}
.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); }
/* Fluid instead of a fixed cap: grows on a wide monitor (460px left the rest
   of the row unused), shrinks on a narrower one instead of staying pinned. */
.transcript-cell { max-width: clamp(240px, 38vw, 620px); }
.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.
   Header and footer stay put; only the body scrolls — Save must stay reachable
   on a short laptop or a phone in landscape. */
.modal-wide {
  max-width: 1320px;
  width: min(1320px, 97vw);
  /* Beats the 90dvh on .modal-content: two correction rows need the height, and
     the body scrolls rather than the dialog growing past the viewport. */
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-wide .modal-header,
.modal-wide .modal-footer { flex-shrink: 0; }
/* Tighter than the shared dialog chrome. This one carries four editing boxes
   and no header subtitle, so the padding written for a short confirm dialog is
   just height the transcript could have had. */
.modal-wide .modal-header { padding: 16px 22px 0; }
.modal-wide .modal-footer { padding: 12px 22px 16px; }
.modal-wide .modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 22px;
}
.modal-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.modal-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ----- audio ----- */
/* The "there is nothing to play" row, shared by the editor and FullAudioPlayer.
   The transport itself is `.audio-player-full*` further up this file. */
.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; }
.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; }
/* One autosave covers every box, so its state is reported once, in the dialog
   header rather than on a field. Colours come from .preeti-save-* below. */
.editor-save-hint {
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--text-muted, var(--text-secondary));
}

/*
 * Model / LLM reference sits full-width under the audio. Correction is the next
 * row (Preeti | Unicode), not a side column beside the reference.
 */
.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-reference {
  margin-top: 12px;
  max-height: 200px;
}
/* Collapsed to its header: the machine text is a reference, and the two
   correction rows want the height more than it does. */
.editor-card-reference.is-collapsed { max-height: none; }
.editor-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
.editor-card-head label { font: inherit; color: inherit; }
/* The header doubles as the expand control, so it is a real button. */
.editor-card-toggle {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  /* The card clips to its own radius, so a UA button radius would leave a
     sliver of card background in each top corner. */
  border-radius: 0;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.editor-card-toggle:hover { background: var(--bg-page); }
.editor-card-reference.is-collapsed .editor-card-toggle { border-bottom: none; }
.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;
}

/*
 * ----- Preeti | Unicode correction rows -----
 * Two rows, one per transcript: Verbatim (what was said, the transcript of
 * record) and Normalized (its written form). In each, Preeti is scratch —
 * in-app keyboard → ASCII, auto-converting into the Unicode box beside it.
 */
@font-face {
  font-family: 'Preeti';
  src: url(/static/media/Preeti.97b1fd07.ttf) format('truetype');
  font-display: swap;
}
.transcript-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.transcript-row { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* Names the pair below it. The field labels are deliberately quieter than this
   so the two rows read as two transcripts, not four unrelated boxes. */
.transcript-row-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.transcript-row-hint {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted, var(--text-secondary));
}
.preeti-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
.preeti-boxes-single { grid-template-columns: 1fr; }
.preeti-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.preeti-field .symbol-picker,
.preeti-field .preeti-field-body { flex: 1; min-height: 0; min-width: 0; }
.preeti-field .preeti-textarea { flex: 1; }
/* A highlighted box is wrapped, so the wrapper is what stretches. */
.preeti-field .hl-wrap { flex: 1; }
.preeti-field-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  min-width: 0;
}
.preeti-field-head label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
/*
 * The small controls that live in a box's header: the Preeti symbol palette on
 * the scratch side, the <inaudible> insert and Highlight on the Unicode side.
 * Quiet by default — they are tools an editor reaches for occasionally, and four
 * boxes' worth of them would shout over the transcript if they read as primary
 * buttons.
 */
.field-tool {
  border: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.field-tool:hover:not(:disabled) { background: var(--bg-page, #f8fafc); color: var(--text-primary); }
.field-tool:disabled { opacity: 0.45; cursor: default; }
/* The tag button while the caret is inside a tag, i.e. while it means "remove".
   Marked out the same way Clear mark is, so the two toggles in one header read
   as the same kind of control. */
.field-tool-on { border-color: var(--primary); color: var(--primary); }
.field-tool-mark:not(:disabled) { color: #b91c1c; border-color: #fecaca; }
.field-tool-mark:hover:not(:disabled) { background: #fef2f2; color: #b91c1c; }

/* `<inaudible>` and Highlight stay right-aligned; pinned words scroll in
   .word-chip-scroll between the Unicode label and these tools. */
.preeti-field-tools {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.preeti-field-tools > .field-tool {
  flex-shrink: 0;
}

.symbol-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.preeti-field-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
}
.preeti-field-body > .preeti-textarea { min-width: 0; }
.symbol-picker-toggle {
  border: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font: inherit; font-size: 11px; font-weight: 600;
  color: var(--text-secondary); cursor: pointer; white-space: nowrap;
}
.symbol-picker-toggle:hover:not(:disabled) { background: var(--bg-page, #f8fafc); color: var(--text-primary); }
.symbol-picker-toggle:disabled { opacity: 0.45; cursor: default; }
.symbol-picker-toggle-on { border-color: var(--primary); color: var(--primary); }
/* In-flow beside the Preeti box so the modal body is not the scrollport.
   Height follows the textarea; only this panel scrolls. */
.symbol-picker-panel {
  flex: 0 0 188px;
  width: 188px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.symbol-group { display: flex; flex-direction: column; gap: 4px; }
.symbol-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-muted, var(--text-secondary));
}
.symbol-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
/* Drawn in the real font, so the button shows the glyph that will land in the
   box rather than its Unicode twin. Preeti's em-square is small — hence 22px
   here against the 11px everything else in this header uses. */
.symbol-key {
  font-family: Preeti, Kantipur, sans-serif;
  font-size: 22px; line-height: 1;
  min-width: 32px; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-white); color: var(--text-primary); cursor: pointer;
}
.symbol-key:hover { background: var(--primary-light); border-color: var(--primary); }

.preeti-auto-hint {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted, var(--text-secondary));
  opacity: 0.85;
}
/* Autosave state. Worn by .editor-save-hint in the dialog header — the save
   covers every box, so it is not a per-field chip. */
.preeti-save-dirty,
.preeti-save-saving { opacity: 0.85; }
.preeti-save-saved { color: var(--success, #2f6b3a); }
.preeti-save-error { color: var(--danger, #a33); }
.preeti-unicode-head { color: var(--primary); }
.preeti-unicode-head label { color: inherit; }
/* Fluid rather than fixed: two rows share the viewport, so a laptop gets four
   comfortable boxes and a short screen shrinks them all instead of pushing Save
   off the bottom. This is the only min-height for these boxes — the responsive
   overrides that used to re-tune it are gone. */
.preeti-textarea { min-height: clamp(84px, 13vh, 150px); font-size: 15px; line-height: 1.5; }
/* Far tighter than .form-textarea's 9px 11px: four of these boxes share the
   viewport, so every pixel of inner gutter is a pixel of transcript that does
   not fit. Left just wide enough that the caret at column 0 is not on the
   border and a red mark's wash does not bleed into it. Kept in step with the
   .hl-wrap padding below — the Unicode half is a mirror pair, and the two boxes
   should read as the same box. */
.preeti-textarea { padding: 2px 6px; }
/* Read-only locked/flagged view — same grid, muted fields, no caret affordance. */
.preeti-boxes-readonly .preeti-textarea[readonly] {
  background: var(--bg-page, #f8fafc);
  cursor: default;
  resize: none;
  color: var(--text-primary);
}
.preeti-boxes-readonly .preeti-auto-hint {
  text-transform: uppercase;
}
/*
 * Bundled Preeti.ttf draws ASCII Preeti bytes as Nepali glyphs. Its em-square
 * is much smaller than the Unicode face, so it needs a far larger CSS size to
 * match the column beside it optically (22px/1.30 Preeti ≈ 16px/1.6 Kalimati).
 *
 * The size and the line-height are both part of that match: at 26px/1.45 the
 * Preeti half read as the larger of the pair and its rows stood noticeably
 * taller than the Unicode column's. The pair was closed the rest of the way by
 * moving both sides — 2px off here, 2.5px onto .preeti-unicode-face — because
 * the Preeti face was still the heavier read at 24/13.5.
 *
 * This rule and its 640px override move together — they are what legacy Preeti
 * input depends on, so re-tune the two in one pass or not at all.
 */
.preeti-textarea.preeti-source {
  font-family: Preeti, Kantipur, sans-serif;
  font-size: 22px;
  line-height: 1.30;
  color: var(--text-primary);
}
/*
 * Real Devanagari code points, in the same bundled face every other transcript
 * on the site is drawn in — this box is the reference for what "correct" looks
 * like, so it must not be the one place using a different font.
 *
 * 16px, against 14px for the site's own fields: Kalimati's क is 0.700em to
 * Noto's 0.622em, so this face already draws ~12.5% larger at a given size —
 * 13.5px was the size that matched the rest of the site optically. It runs
 * deliberately above that here. This is the box a verifier reads the corrected
 * Devanagari in, and it is the half of the pair that had to grow to stop the
 * Preeti column reading as the larger one.
 */
.preeti-unicode-face {
  font-family: var(--font-ne);
  font-size: 16px;
  /* Kalimati's worst-case ink extent is 1.506em (ौ over ृ); 1.5 collided. */
  line-height: 1.6;
  color: var(--text-primary);
}
/*
 * ----- Red review marks -----
 *
 * A mirror div behind the textarea paints a wash behind the marked words; the
 * textarea itself stays transparent-backgrounded and draws all the text. See
 * components/HighlightTextarea.js for why it is done this way round.
 *
 * Everything that affects where a line breaks is declared ONCE below, for both
 * elements at the same time. Two rules would eventually be edited apart, and
 * the failure mode is silent: the wash simply stops sitting under its word.
 * Font, size and line-height are deliberately absent — the component puts the
 * caller's own class on both elements, so those arrive from .preeti-unicode-face
 * and .preeti-textarea for both halves at once.
 */
.hl-wrap { position: relative; display: flex; min-width: 0; }
.hl-wrap > .hl-input,
.hl-wrap > .hl-mirror {
  box-sizing: border-box;
  /* Mirrors .form-textarea's box exactly. Width and style only — the colour is
     set per element below, so the mirror can reserve the same 1px invisibly
     without stripping the real border off the textarea. */
  width: 100%;
  /* 2px 6px, not .form-textarea's 9px 11px — see .preeti-textarea above. This
     one value feeds both elements, which is what keeps the wash under its
     word; changing it for the input alone would shift every line break. */
  padding: 2px 6px;
  border-width: 1px;
  border-style: solid;
  border-radius: var(--radius-sm);
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  tab-size: 8;
  text-align: left;
  direction: ltr;
  text-indent: 0;
  letter-spacing: normal;
  word-spacing: normal;
  /* Reserved in both, always. Without it the first line that overflows takes
     ~15px off the textarea's content width and rewraps it — but not the mirror. */
  scrollbar-gutter: stable;
  overflow-y: auto;
}
.hl-wrap > .hl-mirror {
  position: absolute;
  inset: 0;
  overflow: hidden; /* scrolled from JS, never by the user */
  pointer-events: none;
  /* The mirror keeps the field's white background and the textarea goes
     transparent over it, so the washes it paints are behind the real text. */
  border-color: transparent;
  color: transparent;
}
.hl-wrap > .hl-input {
  position: relative;
  z-index: 1;
  flex: 1;
  background: transparent;
  border-color: var(--border);
  /* .form-textarea allows resize: vertical (see above); a dragged textarea
     would grow away from the absolutely-positioned mirror behind it. */
  resize: none;
}
/* Re-stated because the rule above matches .form-textarea:focus's specificity
   and comes later in the file, which would otherwise swallow the focus ring. */
.hl-wrap > .hl-input:focus { border-color: var(--primary); }
/* Locked and flagged chunks still show their marks, so the muted background has
   to move to the mirror — on the textarea it would cover them. */
.preeti-boxes-readonly .hl-wrap > .hl-input[readonly] { background: transparent; }
.preeti-boxes-readonly .hl-wrap > .hl-mirror { background: var(--bg-page, #f8fafc); }
/* A wash plus an underline, not red type: the Devanagari has to stay readable,
   and a background rectangle hides the sub-pixel drift that red glyphs show. */
.hl-mark {
  background: #fee2e2;
  box-shadow: inset 0 -2px 0 #dc2626;
  border-radius: 2px;
  color: inherit;
}

/* The marked phrases, listed under the box — how a mark gets removed, and the
   plain-text version of what the red is saying. */
.hl-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.hl-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 4px 1px 6px; border-radius: 4px;
  font-size: 11px; background: #fef2f2; color: #b91c1c;
  max-width: 100%;
}
.hl-chip > span {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hl-chip button {
  border: 0; background: none; cursor: pointer; padding: 0 2px;
  font-size: 12px; line-height: 1; color: inherit; opacity: 0.7;
}
.hl-chip button:hover { opacity: 1; }
.hl-chip-orphan { background: #f1f5f9; color: #475569; text-decoration: line-through; }
.hl-chips-clear { font-size: 11px; }
/* Says why some chips are struck through — without it the editor sees a mark
   they made stop working and reads it as a bug. */
.hl-orphan-note { font-size: 11px; color: var(--text-muted, var(--text-secondary)); }

/* ----- a finished pass, read rather than edited -----
 *
 * `.hl-static` is the read-only twin of the mirror above, and it deliberately
 * reuses `.hl-mark` untouched: red has to mean the same thing in the editor and
 * in the history, and the cheapest way to guarantee that is for it to be the
 * same rule. What it does not reuse is the two-layer trick — there is no
 * textarea here, so the `<mark>` holds real glyphs and the block grows to its
 * content instead of scrolling inside itself. */
.hl-static {
  font-size: 13px; line-height: 1.7;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.hl-static-empty { color: var(--text-muted, var(--text-secondary)); font-style: italic; }

/* `<inaudible>` inside a pass's text, tinted by how it compared with the pass
   before. Monospace because it is a literal the editor typed, not prose. */
.tag-token {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; padding: 0 2px; border-radius: 3px;
}
.tag-agreed { color: var(--text-secondary); background: #f1f5f9; }
.tag-added { color: #047857; background: #ecfdf5; }
.tag-moved { color: #b45309; background: #fef3c7; }

.pass-timeline { display: flex; flex-direction: column; gap: 14px; }
.pass-entry {
  border: 1px solid var(--border, #e2e8f0); border-radius: 6px; padding: 10px 12px;
}
/* An abandoned pass reads as an aside, not as a version of the transcript. */
.pass-entry-flagged { background: #fffbeb; border-color: #fde68a; }
.pass-entry-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px;
}
.pass-field { margin-top: 8px; }
.pass-field-label {
  display: block; margin-bottom: 2px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted, var(--text-secondary));
}
.pass-tag-changes { margin-top: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (max-width: 900px) {
  .preeti-boxes { grid-template-columns: 1fr; }
  .preeti-field-body { flex-direction: column; }
  .symbol-picker-panel {
    flex: 0 0 auto;
    width: auto;
    max-height: 180px;
  }
  .symbol-grid { grid-template-columns: repeat(8, 1fr); }
}

/* ----- 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; }

/* ----- overall logs ----- */
.overall-logs-page { display: flex; flex-direction: column; gap: 18px; }
.overall-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.overall-users-card { gap: 12px; }
.overall-week-table { margin: 4px 0; background: var(--bg-white); }

/* ----- today's allocation, above the Pending table ----- */
.allocation-progress { margin-bottom: 18px; gap: 12px; }
.allocation-cap { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.allocation-bar {
  height: 8px; border-radius: 999px; background: var(--border); overflow: hidden;
}
.allocation-bar-fill {
  height: 100%; background: var(--primary); border-radius: 999px;
  transition: width var(--transition);
}

/* ----- 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); }

.scroll-x .diff-row td { background: var(--bg-page); }

/* The row itself is the control now, so a cell carries no affordance of its own. */
.text-cell { cursor: inherit; }
/* 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; }

/* Who did this edit, then when — above the text, on one line if it fits. */
.editor-pass-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* The date is a footnote to the badge, not a line under the text. */
.editor-pass-head .cell-sub { margin-top: 0; }

.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; }
/* Inside a table cell the pill is the whole content, so it brings no top gap. */
.edit-metric-inline { margin-top: 0; }
.edit-metric-from { font-weight: 500; opacity: 0.75; }

/*
 * Word operations: +added, −deleted, ~replaced.
 * The same green and red the user-log diff uses, so "this was taken out" reads
 * the same everywhere, with the warning amber for a replacement.
 */
.word-ops { display: inline-flex; gap: 6px; font-variant-numeric: tabular-nums; }
.word-ops-none { font-weight: 500; }
.ops-added { color: #047857; }
.ops-deleted { color: #b91c1c; }
.ops-edited { color: #b45309; }
/* Not error colours: spacing and punctuation are shown but not scored, and a
   red or amber numeral would say the opposite. */
.ops-typography, .ops-none { color: var(--text-muted); font-weight: 500; }
.ops-typography::before { content: '· '; }
.ops-typography-plain { color: var(--text-secondary); }

/* Character counts: the same three colours a step down in weight. They explain
   the word chips rather than compete with them, and reading as loud would put
   two rival "how much changed" figures on one line again. */
.char-ops {
  display: inline-flex; gap: 6px; font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Only rows with something to show are clickable, so the cursor is the hint. */
.row-clickable { cursor: pointer; }
.row-clickable:hover td { background: var(--bg-page); }
.row-clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.word-changes { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.word-change .detail-heading {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
}
.word-list { display: flex; gap: 10px; padding: 2px 0; font-size: 13px; }
.word-list-label {
  flex: 0 0 76px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); padding-top: 2px;
}
.word-list-body { min-width: 0; word-break: break-word; line-height: 1.6; }
.word-pair + .word-pair::before { content: ' · '; color: var(--text-muted); }

/* The note beside a normalized WER badge once a regression verdict has
   lowered what it prices — never a replacement for the raw pill above it. */
.edit-metric-corrected { color: var(--primary); font-weight: 500; }

/* One row per reviewable diff span, with its "earlier was correct" control. */
.span-verdicts { display: flex; flex-direction: column; gap: 4px; padding: 8px 0 2px; }
.span-verdict-row {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.span-verdict-row .btn-link { padding: 1px 8px; font-size: 12px; }
.span-verdict-active { color: #b45309; }
.span-verdict-corrected { font-size: 12px; color: var(--primary); font-weight: 500; }

/*
 * The five rates for one step: WER, MER, WIL/WIP, CER.
 * Uncoloured on purpose — the badge above already carries the verdict, and five
 * numbers tinted by five thresholds is a panel nobody finishes reading.
 */
.rate-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px 16px; padding: 6px 0 2px;
}
.rate-cell { display: flex; flex-direction: column; gap: 2px; }
.rate-label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted);
}
.rate-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Lost and preserved are one measurement said twice, so they share a cell. */
.rate-sep { color: var(--text-muted); font-weight: 500; }
/* A high WIP is good news, so it must not borrow an error colour. */
.rate-value-good { color: #047857; }

/* 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: 268px; 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: 360px; max-height: 240px;
  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 tall for video. */
.speaker-clips .clip-text {
  max-height: 240px; overflow-y: auto; white-space: pre-wrap;
  /* 1.6, not 1.5: Kalimati's ink runs to 1.506em (ौ over ृ) and collided. */
  line-height: 1.6; 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-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
.guidance-view-columns .guidance-view,
.guidance-preview-columns .guidance-preview {
  flex: 1;
  min-height: 0;
}
.guidance-editor { display: grid; grid-template-columns: 1fr; gap: 16px; }
.guidance-editor.bilingual.with-preview {
  grid-template-columns: 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; }
/* Still names the family explicitly: .guidance-textarea sets ui-monospace,
   which has no Devanagari of its own to fall through from. */
.guidance-view[lang="ne"] .markdown-body,
.guidance-preview[lang="ne"] .markdown-body,
.guidance-textarea[lang="ne"] {
  font-family: var(--font-ne);
  line-height: 1.85;
}

/*
 * Marking a node Nepali is what puts it in the Devanagari face — which is what
 * the comment on TranscriptTurns always claimed the attribute did. --font
 * already reaches Kalimati, so this is the belt to those braces: it also covers
 * anything that sets font-family (or the `font:` shorthand) locally.
 *
 * Element selector, not `[lang="ne"] *` — TranscriptTurns puts the attribute on
 * the container, and a descendant selector would drag the ASCII speaker label
 * in with it. It must stay below the rules it needs to beat: it is specificity
 * 0,1,0, the same as .diff-text and .reference-text, so source order decides.
 */
[lang="ne"] { font-family: var(--font-ne); }

.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,
  .guidance-columns { grid-template-columns: 1fr; }
}

/* ----- public transcribe page (PLAN.md §2.13) -----
   A standalone page with no sidebar and no topbar, so it brings its own shell.
   Everything else here composes classes the app already has; only the pieces
   that genuinely do not exist elsewhere are defined. */
.public-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
}
.public-header {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 20px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 600; color: var(--text-primary);
}
.public-logo {
  width: 32px; height: 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
}
/* The transcript is prose. Left to fill a wide monitor it would run to a line
   length nobody can track back from, so the column is capped. */
.public-main {
  width: 100%; max-width: 880px; margin: 0 auto;
  padding: 40px 20px 56px;
  display: flex; flex-direction: column; gap: 20px; flex: 1;
}
/*
 * The access key, on a gated deployment. A field on the page rather than the
 * modal this used to be: a required input that only appears once you press
 * Transcribe is a rule you learn by breaking it.
 *
 * Full width above the two source cards, deliberately outside .public-sources —
 * that grid means "these are alternatives, pick one", and the key is neither an
 * alternative nor optional.
 */
.public-key-card { gap: 10px; }
.public-key-card h2 {
  display: flex; align-items: center; gap: 6px;
  margin: 0; font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.public-key-lock { display: inline-flex; color: var(--text-secondary); }
/* The accepted state reads as one line, so the hint sits beside the badge
   rather than under it — .source-card already zeroes its top margin. */
.public-key-ok { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.public-hero { text-align: center; }
.public-hero h1 { margin: 0 0 8px; font-size: 30px; font-weight: 700; color: var(--text-primary); }
.public-hero p { margin: 0 auto; max-width: 560px; color: var(--text-secondary); font-size: 15px; line-height: 1.6; }

/* Two cards here, not the three the admin page weights its columns for. */
.public-sources { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.public-sources .source-card h2 {
  margin: 0; font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.public-actions { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }

.public-error {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: var(--radius-md);
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 14px;
}
.public-error-actions { display: flex; gap: 8px; align-items: center; }

.public-result { display: flex; flex-direction: column; gap: 12px; }
.public-result h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text-primary); }
.public-result h2:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }

.run-progress-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.run-progress-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.run-progress-clock { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* One line per speaker turn: label in a fixed column so the text starts at the
   same place every row, which is what makes the transcript scannable. */
.transcript-turns {
  display: grid;
  grid-template-columns: minmax(104px, 124px) 1fr;
  row-gap: 4px; column-gap: 14px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.turn {
  display: contents;
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; text-align: left; cursor: pointer;
}
.turn > * { padding: 6px 8px; border-radius: var(--radius-sm); transition: background var(--transition); }
.turn:hover > *, .turn:focus-visible > * { background: var(--primary-light); }
.turn.active > * { background: #eef2ff; }
.turn-speaker {
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--text-secondary); white-space: nowrap;
}
.turn-text { font-size: 15px; line-height: 1.75; color: var(--text-primary); }
.turn-empty { color: var(--text-muted); }

/* Six tints, assigned by order of first appearance. The label is always
   spelled out beside them — colour reinforces, never carries. */
.turn-speaker--0 { color: #1d4ed8; }
.turn-speaker--1 { color: #b45309; }
.turn-speaker--2 { color: #15803d; }
.turn-speaker--3 { color: #a21caf; }
.turn-speaker--4 { color: #0f766e; }
.turn-speaker--5 { color: #be123c; }

.public-footer {
  padding: 20px; text-align: center;
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}

@media (max-width: 560px) {
  .public-hero h1 { font-size: 24px; }
  /* Label above text: two columns leave the text nine characters wide. */
  .transcript-turns { grid-template-columns: 1fr; row-gap: 2px; padding: 12px; }
  .turn > *:first-child { padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .turn > * { transition: none; }
}

/* =====================================================================
   Responsive layout — phones, tablets, short viewports, and ultrawide.
   The shell keeps one composition: sidebar + main. Below ~960px the sidebar
   becomes an off-canvas drawer so the work surface keeps the full width.
   ===================================================================== */

/* Wide monitors: cap the content column so tables do not stretch endlessly. */
@media (min-width: 1600px) {
  .admin-content {
    max-width: 1480px;
    width: 100%;
  }
}

/* Tablet and below: drawer nav, tighter chrome, stack multi-column work. */
@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1100;
    height: 100vh;
    height: 100dvh;
    width: min(var(--sidebar-width), 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-close-btn { display: inline-flex; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(15, 23, 42, 0.4);
    border: none;
    padding: 0;
    cursor: pointer;
  }
  .sidebar-backdrop[hidden] { display: none !important; }

  .sidebar-toggle { display: inline-flex; }

  .admin-topbar {
    padding: 14px 16px;
    gap: 8px;
  }
  .admin-topbar-left { min-width: 0; flex: 1; }
  .admin-topbar-left h1 {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .admin-topbar-left p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .admin-content { padding: 16px; }

  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .error-banner,
  .notification-toast { margin-left: 16px; margin-right: 16px; }

  .filter-bar input[type="search"] { min-width: 0; width: 100%; flex: 1 1 100%; }
  .filter-bar select,
  .filter-bar input[type="date"],
  .filter-bar input[type="number"],
  .filter-bar .date-multi-trigger {
    flex: 1 1 calc(50% - 10px);
    min-width: 0;
  }

  .page-toolbar { gap: 10px; }
  .toolbar-actions { flex-wrap: wrap; width: 100%; }

  .stats-grid { grid-template-columns: 1fr; }
  .stat-charts { grid-template-columns: 1fr; }
  .overall-kpi-grid { grid-template-columns: 1fr; }

  .audio-input-grid { grid-template-columns: 1fr; }

  .modal-overlay { padding: 12px; align-items: flex-start; overflow-y: auto; }
  .modal-header { padding: 18px 18px 0; }
  .modal-body { padding: 16px 18px; }
  .modal-footer {
    padding: 12px 18px 18px;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
  }
  .modal-wide { width: 100%; max-width: 100%; max-height: calc(100dvh - 24px); }
  /* The editor's own padding above is more specific than the shared rules in
     this block, so it has to come down to the narrow gutter itself. */
  .modal-wide .modal-header,
  .modal-wide .modal-body,
  .modal-wide .modal-footer { padding-left: 18px; padding-right: 18px; }
  .editor-card-reference { max-height: 170px; }

  .toast {
    left: 12px;
    right: 12px;
    max-width: none;
    top: 12px;
  }
}

/* Phones: full-bleed work surface, stacked controls, readable edit modal. */
@media (max-width: 640px) {
  .admin-content { padding: 12px; }
  .panel-section { padding: 14px; gap: 14px; }

  .filter-bar select,
  .filter-bar input[type="date"],
  .filter-bar input[type="number"],
  .filter-bar .date-multi-trigger,
  .filter-bar .btn-primary,
  .filter-bar .btn-secondary,
  .filter-bar .btn-success,
  .filter-bar .btn-danger-solid {
    flex: 1 1 100%;
  }

  /* Full-width primary actions on forms / empty states — not table icon rows. */
  .page-toolbar .btn-primary,
  .page-toolbar .btn-secondary,
  .toolbar-actions .btn-primary,
  .toolbar-actions .btn-secondary,
  .public-actions .btn-primary,
  .public-actions .btn-secondary,
  .login-card .btn-primary {
    width: 100%;
  }

  .modal-footer .btn-primary,
  .modal-footer .btn-secondary { flex: 1; min-width: 120px; }

  .modal-header h2 { font-size: 17px; }
  .modal-subtitle { font-size: 12px; line-height: 1.45; }
  .variant-tabs { flex-wrap: wrap; }
  .variant-action { margin-left: 0; width: 100%; }

  /* Full-width single column here, so it can afford to run larger than the
     desktop 22px — kept 6px above it, as it was when that was 26/30. */
  .preeti-textarea.preeti-source { font-size: 26px; }

  .data-table th,
  .data-table td { padding: 10px 12px; }

  /* Drop the numeric time label so the play button + progress bar fit a
     narrower Audio column, leaving more of the row for the transcript. */
  .transcript-list-table .mini-player-time { display: none; }
  .transcript-list-table .col-audio { width: 72px; }
  .transcript-list-table .mini-player { min-width: 64px; padding: 6px 8px; }

  .speaker-clips td { height: auto; min-height: 160px; }
  .clip-player { max-width: 100%; max-height: 220px; }

  .option-group { min-width: 0; }
  .upload-grid { grid-template-columns: 1fr; }

  .public-main { padding: 24px 14px 40px; }
}

/* Short viewports (landscape phones, short laptops): keep Save on screen. */
@media (max-height: 700px) {
  .modal-wide { max-height: calc(100dvh - 16px); }
  .editor-card-reference { max-height: 120px; }
  .admin-topbar { padding-top: 10px; padding-bottom: 10px; }
  .admin-topbar-left p { display: none; }
}

@media (max-height: 700px) and (max-width: 960px) {
  .sidebar { overflow-y: auto; }
}

/* ===== Training Dataset — upload / import flow =====
 *
 * The tab shows only the cards the user can act on: a section whose
 * prerequisite is not met is not rendered, so the page grows as choices are
 * made rather than opening as a column of placeholders.
 */
.training-dataset-page .flow-step {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  padding: 16px 18px;
  margin-top: 14px;
}
.training-dataset-page .flow-step-head {
  margin-bottom: 12px;
}
.training-dataset-page .flow-step-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.training-dataset-page .flow-step-hint {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  max-width: 70ch;
}
.training-dataset-page .flow-step-result {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.training-dataset-page .flow-step-result strong { color: var(--text-primary); }

/* Corpus totals, above the steps rather than inside step 1: they describe the
   whole locked corpus, not the current selection. */
.training-dataset-page .corpus-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.training-dataset-page .corpus-strip strong { color: var(--text-primary); }

.training-dataset-page .scope-mode-grid { display: grid; gap: 8px; max-width: 720px; }
.training-dataset-page .scope-mode-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.training-dataset-page .scope-mode-label {
  flex: 1 1 220px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-secondary);
}
/* Says an "editor" is a model, so a name with no account behind it is not read
   as a colleague. */
.training-dataset-page .tag-machine {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.training-dataset-page .split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.training-dataset-page .stacked-fields {
  display: grid;
  gap: 12px;
  max-width: 560px;
  margin-top: 12px;
}

/* ===== Audio Sources — read-only inventory ===== */
.audio-sources-page .clickable-row { cursor: pointer; }
.audio-sources-page .clickable-row:hover { background: var(--primary-light); }
.audio-sources-page .source-title {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Editors and lockers as chips: a source is routinely held by several people,
   and a comma list of names with counts is unreadable at a glance. Unscoped —
   `components/PeopleCell` serves Audio Sources and Transcription work alike. */
.people-cell { display: flex; flex-wrap: wrap; gap: 4px; }
.people-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-page);
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.people-chip-count {
  font-weight: 700;
  color: var(--text-primary);
}
/* Take this one person off this one source. Quiet until hovered: the cell is
   read far more often than it is acted on. */
.people-chip-action {
  display: inline-flex;
  align-items: center;
  margin: 0 -2px 0 1px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  line-height: 0;
  cursor: pointer;
}
.people-chip-action svg { width: 12px; height: 12px; }
/* The "Locked by" caption above a second chip row in the same cell. */
.people-cell-label { display: block; margin-bottom: 2px; }
.cell-sub .people-chip { font-size: 11px; }
.people-chip-action:hover:not(:disabled) { color: #ef4444; }
.people-chip-action:disabled { opacity: 0.4; cursor: not-allowed; }
/* Same badge as the Training Dataset filter: says this "editor" is a model. */
.people-chip .tag-machine {
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.audio-sources-page .mini-bar {
  margin-top: 4px;
  width: 90px;
  height: 5px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
}
.audio-sources-page .mini-bar-fill { height: 100%; background: var(--primary); }

.audio-sources-page .detail-row > td { background: var(--bg-page); }
.audio-sources-page .source-detail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px 18px;
  padding: 6px 2px;
}
.audio-sources-page .source-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

/* ===========================================================================
   Word suggestions in the editor, and the Vocabulary page that curates them
   =========================================================================== */

/* The typeahead strip sits *in flow* under its box, not floating over it.
   SymbolPicker records why (see its docstring): an absolutely-positioned panel
   in this modal is clipped by .modal-wide / .modal-body overflow, and a
   dropdown nobody can see is worse than a row that costs a little height. */
.suggestion-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page, #f8fafc);
}

.suggestion-item {
  border: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  /* The suggestions are Devanagari whichever box raised them — the Preeti side
     is matched on its conversion — so they are drawn in the Nepali face rather
     than in Preeti.ttf, which would render them as Latin nonsense. */
  font-family: var(--font-ne);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}
.suggestion-item:hover { border-color: var(--primary); }

.suggestion-item-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* A near-miss replaces what was typed instead of completing it, so it is marked
   as a different kind of offer rather than left to look like a completion. */
.suggestion-item-near { border-style: dashed; color: var(--text-secondary); }
.suggestion-item-near.suggestion-item-active { color: #fff; border-style: solid; }

.suggestion-dismiss {
  margin-left: auto;
  border: none;
  background: none;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
}
.suggestion-dismiss:hover { color: var(--text-primary); }

/* Pinned words between the Unicode label and the right-aligned tag/mark
   tools. Scrollbar is hidden; a caret appears when more chips sit off-screen. */
.word-chip-strip {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}
.word-chip-scroll {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.word-chip-scroll::-webkit-scrollbar { display: none; }
.word-chip-more {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  padding: 0 2px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 0;
}
.word-chip-more:hover { color: var(--text-primary); }
.field-tool-word {
  font-family: var(--font-ne);
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

/* --- Vocabulary page ---------------------------------------------------- */

.field-toggle { display: inline-flex; gap: 0; }
.field-toggle-btn {
  border: 1px solid var(--border);
  background: var(--bg-white);
  padding: 0 12px;
  height: var(--control-h);
  font: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.field-toggle-btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.field-toggle-btn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; margin-left: -1px; }
.field-toggle-btn-on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  position: relative;
}

.vocab-search { display: inline-flex; gap: 6px; align-items: center; flex: 1; }
.vocab-search .form-input { min-width: 200px; font-family: var(--font-ne); }

.vocab-term { font-family: var(--font-ne); font-size: 15px; }

.vocab-pin-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.vocab-pin-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  padding: 3px 6px 3px 10px;
}
.vocab-pin-term { font-family: var(--font-ne); font-size: 14px; }
.vocab-pin-tools { display: inline-flex; gap: 2px; }

/* ----- parliamentarians ----- */
/* Speaker-name search: a text box with the matching members under it. */
.profile-select { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.profile-select .form-input { width: 100%; }
.profile-select-meta { display: block; margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
.profile-select-panel {
  position: absolute; top: calc(var(--control-h) + 2px); left: 0; right: 0; z-index: 30;
  margin: 0; padding: 4px 0; list-style: none;
  max-height: 300px; overflow-y: auto;
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.profile-select-option { padding: 6px 10px; cursor: pointer; font-size: 13px; line-height: 1.4; }
.profile-select-option.active { background: var(--primary-light); }
.profile-select-option .cell-sub { display: block; }

.match-list { display: flex; flex-wrap: wrap; gap: 6px; }
.match-chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 5px 9px; font-size: 13px; text-align: left; cursor: pointer;
  background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.match-chip:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.match-score { font-size: 11px; font-weight: 600; color: var(--primary); }

.cell-clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tbody tr.row-selected { background: var(--primary-light); }

.profile-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; }
.profile-head h2 { margin: 0; font-size: 20px; color: var(--text-primary); }
.profile-head-np { margin: 2px 0; font-size: 16px; font-family: var(--font-ne); color: var(--text-primary); }
.profile-tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.profile-tile {
  display: flex; flex-direction: column; min-width: 96px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-page);
}
.profile-tile strong { font-size: 18px; color: var(--text-primary); }
.profile-tile span { font-size: 12px; color: var(--text-secondary); }
.speaker-card .speaker-card-party { color: var(--primary); }

/* Video clip and speaker-name box on the Edit Transcript rows (admin opt-in per user).
   Scoped to the list table so Speakers / profile clip-player sizing stays intact. */
.transcript-list-table .col-video { width: 280px; }
.transcript-list-table .clip-player {
  width: 260px; max-width: 260px; max-height: 150px;
  background: #000; border-radius: 4px;
}
.yt-clip { position: relative; width: 260px; }
.yt-clip iframe { width: 260px; height: 146px; border: 0; border-radius: 4px; display: block; }
.yt-clip-poster {
  height: 146px; border: 0; border-radius: 4px; padding: 0; cursor: pointer;
  background-color: #1f2937; background-size: cover; background-position: center;
}
/* Edit dialog: larger than the row thumbnail so faces and lips are readable. */
.modal-media-row .clip-player {
  width: 100%; max-width: 480px; max-height: 280px;
}
.modal-media-row .yt-clip { width: 480px; }
.modal-media-row .yt-clip iframe,
.modal-media-row .yt-clip-poster { width: 480px; height: 270px; }
.yt-clip-play {
  display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 14px;
}
.yt-clip-link { display: block; font-size: 10px; margin-top: 2px; }

.speaker-box { position: relative; display: inline-flex; align-items: center; gap: 2px; }
.speaker-box-input {
  width: 200px; padding: 1px 6px; font-size: 11px; border: 1px solid #c7d2fe;
  border-radius: 4px; background: #eef2ff; color: #3730a3;
}
.speaker-box-all {
  border: 1px solid #c7d2fe; background: #fff; border-radius: 4px; cursor: pointer;
  font-size: 10px; padding: 1px 4px; color: #4338ca;
}
.speaker-box-list {
  position: absolute; top: 100%; left: 0; z-index: 60; margin: 2px 0 0; padding: 2px;
  list-style: none; min-width: 260px; max-height: 240px; overflow-y: auto;
  background: #fff; border: 1px solid #c7d2fe; border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}
.speaker-box-list button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 4px 8px; font-size: 12px; cursor: pointer; border-radius: 4px;
}
.speaker-box-list button:hover { background: #eef2ff; }
.speaker-box-np { color: #4b5563; }
.speaker-box-party { color: #9ca3af; font-size: 10px; }
.speaker-box-large { display: flex; flex-wrap: wrap; flex: 1 1 320px; gap: 4px 8px; align-items: center; }
.speaker-box-label { font-size: 12px; font-weight: 600; color: #374151; }
.speaker-box-large .speaker-box-input { flex: 1 1 240px; width: auto; min-width: 240px; padding: 8px 10px; font-size: 14px; }
.speaker-box-large .speaker-box-all { font-size: 14px; padding: 6px 10px; }
.speaker-box-meta { flex-basis: 100%; font-size: 12px; color: #6b7280; }
.speaker-box-input:disabled { background: #f3f4f6; border-color: #e5e7eb; color: #6b7280; cursor: not-allowed; }
.speaker-box-empty { padding: 6px 8px; font-size: 12px; color: #6b7280; }
.modal-media-row { display: flex; gap: 12px; align-items: flex-start; margin: 8px 0; flex-wrap: wrap; }
.speaker-box-add { font-weight: 600; color: #1d4ed8; }

