@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-base: #0b0f19;
  --bg-surface: #111827;
  --bg-elevated: #1f2937;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(79, 70, 229, 0.5);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #6366f1;
  --accent-glow: rgba(79, 70, 229, 0.25);
  --brand-navy: #312e81;
  --brand-navy-2: #3b2f8f;
  --brand-gold: #f5a623;
  --brand-gold-2: #ffd23f;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.3);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.08);
  --danger-border: rgba(239, 68, 68, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Beta build marker — hidden by default, revealed by JS only on the beta Space. */
.beta-ribbon {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 6px 16px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1205;
  background: linear-gradient(90deg, var(--brand-gold), var(--brand-gold-2));
  box-shadow: var(--shadow-sm);
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Column layout so the (sticky) beta ribbon and the app share the viewport
   height instead of the ribbon pushing the app-shell's bottom off-screen. */
body {
  display: flex;
  flex-direction: column;
}

/* ==================== LAYOUT ==================== */
.app-shell {
  display: flex;
  flex: 1;
  min-height: 0;   /* fill the space left by the ribbon; let children scroll */
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: 360px;
  min-width: 360px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Branded indigo hero band (alphaBT house style) */
.sidebar-hero {
  position: relative;
  overflow: hidden;
  margin: 0 -20px 18px;
  padding: 22px 20px 18px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-2));
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Gold gradient accent bar pinned to the hero's bottom edge */
.sidebar-hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-gold), var(--brand-gold-2), transparent);
}

.hero-watermark {
  position: absolute;
  top: -34px;
  right: -34px;
  width: 150px;
  height: 150px;
  opacity: 0.14;
  pointer-events: none;
}

.hero-watermark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-eyebrow {
  position: relative;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-gold);
  margin-bottom: 12px;
}

.hero-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  max-width: 100%;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
}

.hero-folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-folder-change {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0;
  color: var(--brand-gold-2, #ffd23f);
  font: inherit;
  font-size: 0.72rem;
  text-decoration: underline;
  cursor: pointer;
  opacity: 0.9;
}

.hero-folder-change:hover { opacity: 1; }

.sidebar-hero .sidebar-brand h1 {
  color: #fff;
}

.sidebar-hero .sidebar-brand h1 span {
  color: var(--brand-gold);
}

.sidebar-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sidebar-brand h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-brand h1 span {
  color: var(--accent);
}

.theme-toggle,
.hero-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  line-height: 1;
  font-family: inherit;
  color: inherit;
}

/* First button of the right-aligned group pushes both to the hero's edge */
.hero-icon-btn {
  margin-left: auto;
  font-weight: 700;
}

.theme-toggle:hover,
.hero-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

/* These buttons live on the dark hero in both themes — keep them translucent
   white. The second selector outranks the light-theme override. */
.sidebar-hero .theme-toggle,
.sidebar-hero .hero-icon-btn,
:root[data-theme="light"] .sidebar-hero .theme-toggle,
:root[data-theme="light"] .sidebar-hero .hero-icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.sidebar-hero .theme-toggle:hover,
.sidebar-hero .hero-icon-btn:hover,
:root[data-theme="light"] .sidebar-hero .theme-toggle:hover,
:root[data-theme="light"] .sidebar-hero .hero-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Chunk Control */
.chunk-control {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.workflow-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 10px;
}

.workflow-row > label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 500;
}

.workflow-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.workflow-btn {
  flex: 1;
  text-align: center;
  padding: 7px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}

.workflow-btn:hover {
  color: var(--text-secondary);
}

.workflow-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.chunk-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.chunk-size-row label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 500;
}

.chunk-size-row input[type="number"] {
  width: 84px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: right;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.chunk-size-row input[type="number"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.chunk-meta {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

.chunk-jump-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.chunk-jump-row label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 500;
  flex: 0 0 auto;
}

.chunk-jump-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 5px;
  border-radius: 999px;
  background: var(--border-subtle);
  outline: none;
  cursor: pointer;
}

.chunk-jump-slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chunk-jump-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  cursor: pointer;
}

.chunk-jump-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  cursor: pointer;
}

.chunk-jump-slider:focus { box-shadow: 0 0 0 3px var(--accent-glow); }

.chunk-nav {
  display: flex;
  gap: 6px;
}

.btn-chunk-nav {
  flex: 1;
  padding: 9px;
  background: rgba(79, 70, 229, 0.12);
  color: var(--accent-hover);
  border: 1px solid rgba(79, 70, 229, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.btn-chunk-nav:hover:not(:disabled) {
  background: rgba(79, 70, 229, 0.2);
}

.btn-chunk-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.stat-chip {
  position: relative;
  text-align: center;
  padding: 12px 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.stat-chip:hover { border-color: var(--brand-gold); background: rgba(255, 255, 255, 0.06); }
.stat-chip:focus-visible { outline: 2px solid var(--brand-gold); outline-offset: 1px; }

/* Active filter: highlighted chip; the other chips dim to signal the filtered view. */
.stat-chip.active { border-color: var(--brand-gold); background: rgba(212, 175, 55, 0.12); }
.stats-row.filtering .stat-chip:not(.active) { opacity: 0.55; }

.stat-chip.stat-all .stat-value { color: var(--text-primary); }

/* Gold top accent bar — echoes the alphaBT stat card */
.stat-chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-gold);
  opacity: 0.85;
}

.stat-chip .stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  display: block;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-chip .stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-chip.stat-delete .stat-value { color: var(--danger); }
.stat-chip.stat-correct .stat-value { color: var(--success); }
.stat-chip.stat-tocorrect .stat-value { color: var(--warning); }
.stat-chip.stat-edited .stat-value { color: var(--accent); }

.stat-chip .stat-value { font-size: 1.1rem; }
.stat-chip .stat-label { font-size: 0.6rem; }

/* Progress */
.progress-section {
  margin-top: 4px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f7941e);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
}

/* Segment List */
.segment-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.seg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  margin-bottom: 4px;
  position: relative;
}

.seg-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.seg-item.active {
  background: var(--bg-glass);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}

.seg-item .seg-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
  transition: background var(--transition-fast);
}

.seg-item.status-delete .seg-status { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.seg-item.status-correct .seg-status { background: var(--success); box-shadow: 0 0 6px var(--success); }
.seg-item.status-to_correct .seg-status { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.seg-item.status-edited .seg-status { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.seg-item .seg-name {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  flex: 1;
}

.seg-item.active .seg-name,
.seg-item:hover .seg-name {
  color: var(--text-primary);
}

.seg-item .seg-index {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}

.btn-load-folder {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #3730a3);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-base);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
  font-family: inherit;
}

.btn-load-folder:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.5);
}

.btn-load-folder:active {
  transform: translateY(0);
}

.btn-share-progress {
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-base);
  font-family: inherit;
}

.btn-share-progress:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(79, 70, 229, 0.08);
}

.btn-share-progress:active {
  transform: translateY(1px);
}

.btn-skip-ahead {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-base);
  font-family: inherit;
}

.btn-skip-ahead:hover {
  border-color: var(--accent);
  color: var(--text-secondary);
}

.btn-skip-ahead:active {
  transform: translateY(1px);
}

.reporting-as {
  margin-top: 8px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.reporting-as strong {
  color: var(--text-primary);
  font-weight: 600;
}

.reporting-as-change {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.reporting-as-change:hover {
  opacity: 0.8;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at top, #131b2e 0%, var(--bg-base) 70%);
  position: relative;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;   /* row-gap when the kbd hints wrap to a 2nd line, column-gap otherwise */
  padding: 16px 32px;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Mode / step toggle */
.mode-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  flex-shrink: 0;
}

.mode-btn {
  padding: 7px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}

.mode-btn:hover {
  color: var(--text-secondary);
}

.mode-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-nav {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-size: 1rem;
  font-family: inherit;
}

.btn-nav:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: scale(1.05);
}

.btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.current-file-info {
  text-align: center;
  flex: 1 1 auto;
  /* Keep a floor width so the filename never gets crushed: when the row runs out
     of room the kbd hints wrap to a 2nd line instead, and the name grows to fill.
     Below this floor the name still ellipsizes (bounded box). */
  min-width: 260px;
}

.current-file-name {
  font-size: 0.95rem;
  font-weight: 500;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-file-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Keyboard-hint bar, pinned to the bottom of the main pane */
.kbd-bar {
  border-top: 1px solid var(--border-subtle);
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(12px);
  padding: 10px 32px;
}
/* No hints until a folder is loaded — don't show an empty strip. */
.kbd-bar:has(#kbd-hints:empty) { display: none; }

/* Floating "Prepare Export" button, bottom-right, above the kbd bar */
.btn-prepare-export {
  position: fixed;
  right: 24px;
  bottom: 64px;   /* clears the ~44px kbd bar + gap */
  z-index: 50;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--accent), #3730a3);
  color: white;
  border: none;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 28px rgba(79, 70, 229, 0.45);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
  font-family: inherit;
}
.btn-prepare-export:hover { transform: translateY(-1px); box-shadow: 0 10px 34px rgba(79, 70, 229, 0.55); }
.btn-prepare-export:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn-prepare-export[hidden] { display: none; }

.kbd-hints {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.kbd-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

kbd {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.68rem;
  color: var(--text-secondary);
}

/* ==================== WORKSPACE ==================== */
.workspace {
  flex: 1;
  min-height: 0;   /* allow the card to scroll instead of shoving the kbd bar off-screen */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 40px;
  overflow-y: auto;
}

.workspace-card {
  width: 100%;
  max-width: 800px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
}

.workspace-card.status-correct {
  border-color: var(--success-border);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(16, 185, 129, 0.06);
}

.workspace-card.status-edited {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(79, 70, 229, 0.06);
}

.workspace-card.status-to_correct {
  border-color: var(--warning-border);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(245, 158, 11, 0.06);
}

.workspace-card.status-delete {
  border-color: var(--danger-border);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(239, 68, 68, 0.06);
}

/* Audio Player */
.audio-section {
  margin-bottom: 24px;
}

.audio-section audio {
  width: 100%;
  height: 44px;
  border-radius: 22px;
  outline: none;
}

.autoplay-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.autoplay-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Textarea */
.editor-section {
  margin-bottom: 24px;
  position: relative;
}

.editor-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.editor-label span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.transliterate-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.transliterate-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.text-editor {
  width: 100%;
  min-height: 140px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  line-height: 1.8;
  resize: vertical;
  transition: all var(--transition-fast);
  outline: none;
}

.text-editor:focus {
  border-color: var(--border-focus);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.text-editor.readonly {
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-secondary);
  cursor: default;
  opacity: 0.85;
}

/* Action Buttons */
.actions-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-action {
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn-action::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-action:hover::after {
  opacity: 1;
}

.btn-action:active {
  transform: scale(0.97);
}

.btn-correct,
.btn-save {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.btn-already {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-delete {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.btn-needs {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.btn-skip {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-action .btn-kbd {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-left: 4px;
}

/* ==================== EMPTY / WELCOME STATE ==================== */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 60px 40px;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.15), rgba(247, 148, 30, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: pulse-icon 3s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
}

.welcome-state h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

.welcome-state p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 400px;
  line-height: 1.6;
}

.welcome-load-btn {
  padding: 16px 36px;
  background: linear-gradient(135deg, var(--accent), #3730a3);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-base);
  box-shadow: 0 8px 32px rgba(79, 70, 229, 0.4);
  font-family: inherit;
  margin-top: 8px;
}

.welcome-load-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(79, 70, 229, 0.55);
}

/* ==================== TRANSLITERATION DROPDOWN ==================== */
.translit-dropdown {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 6px 0;
  z-index: 9999;
  min-width: 160px;
  max-height: 220px;
  overflow-y: auto;
  animation: dropdown-in 0.15s ease-out;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.translit-dropdown .dd-item {
  padding: 8px 14px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--transition-fast);
  color: var(--text-primary);
}

.translit-dropdown .dd-item:hover,
.translit-dropdown .dd-item.selected {
  background: rgba(79, 70, 229, 0.15);
  color: var(--accent-hover);
}

.translit-dropdown .dd-loading {
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 10000;
  animation: toast-in 0.3s ease-out, toast-out 0.3s ease-in 2.2s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.toast.toast-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.toast.toast-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.toast.toast-info {
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent-hover);
  border: 1px solid rgba(79, 70, 229, 0.3);
}

/* Celebratory milestone blast (every 50 files) — center screen, loud */
.cheer-blast {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cheer-blast .cheer-text {
  max-width: 80vw;
  text-align: center;
  padding: 28px 48px;
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--brand-gold));
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 70px rgba(79, 70, 229, 0.45), 0 0 0 6px rgba(255, 255, 255, 0.08);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  animation: cheer-pop 2s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes cheer-pop {
  0%   { opacity: 0; transform: scale(0.4) rotate(-4deg); }
  12%  { opacity: 1; transform: scale(1.08) rotate(2deg); }
  22%  { transform: scale(1) rotate(0deg); }
  80%  { opacity: 1; transform: scale(1) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.15); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(20px); }
}

/* ==================== INSTRUCTIONS OVERLAY ==================== */
.instructions-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  animation: toast-in 0.2s ease-out;
}

.instructions-card {
  position: relative;
  overflow: hidden auto;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  padding: 32px 34px 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

/* Gold top accent bar, like the stat cards */
.instructions-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-gold), var(--brand-gold-2), transparent);
}

.instructions-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.instructions-close:hover {
  color: var(--text-primary);
  background: rgba(127, 127, 127, 0.12);
}

.instructions-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-gold);
  margin-bottom: 6px;
}

.instructions-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.instructions-intro {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 18px;
}

.instructions-section {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.instructions-section h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.instructions-section p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 8px;
}

.instructions-section ul {
  margin: 0 0 4px;
  padding-left: 18px;
}

.instructions-section li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 6px;
}

.instructions-card code {
  font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.82em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.14);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  white-space: nowrap;
}

.instructions-cta {
  margin-top: 22px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #3730a3);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
  font-family: inherit;
}

.instructions-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.5);
}

.instructions-credits {
  margin-top: 16px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar-credits {
  margin-top: 12px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.scan-status {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* ==================== LIGHT THEME (alphaBT house style) ==================== */
:root[data-theme="light"] {
  --bg-base: #ece9f6;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --border-subtle: rgba(49, 46, 129, 0.1);
  --text-primary: #1e1b4b;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --shadow-sm: 0 1px 3px rgba(49, 46, 129, 0.08);
  --shadow-md: 0 8px 24px rgba(49, 46, 129, 0.1);
  --shadow-lg: 0 16px 48px rgba(49, 46, 129, 0.14);
}

/* Main backdrop — soft lavender */
:root[data-theme="light"] .main-content {
  background: radial-gradient(ellipse at top, #f4f2fb 0%, var(--bg-base) 70%);
}

/* White elevated cards on lavender */
:root[data-theme="light"] .stat-chip,
:root[data-theme="light"] .chunk-control {
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Top bar (hardcoded dark glass in dark mode) */
:root[data-theme="light"] .top-bar,
:root[data-theme="light"] .kbd-bar {
  background: rgba(255, 255, 255, 0.7);
}

/* Surfaces that relied on white overlays in dark mode */
:root[data-theme="light"] .seg-item:hover {
  background: rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .seg-item.active {
  background: #ffffff;
}

:root[data-theme="light"] .progress-track {
  background: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .btn-nav,
:root[data-theme="light"] .btn-already,
:root[data-theme="light"] .btn-skip {
  background: rgba(15, 23, 42, 0.04);
}

:root[data-theme="light"] .btn-nav:hover {
  background: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .mode-toggle,
:root[data-theme="light"] .workflow-toggle {
  background: rgba(15, 23, 42, 0.06);
}

:root[data-theme="light"] kbd {
  background: rgba(15, 23, 42, 0.06);
}

:root[data-theme="light"] .text-editor,
:root[data-theme="light"] .text-editor:focus,
:root[data-theme="light"] .chunk-size-row input[type="number"] {
  background: #ffffff;
}

:root[data-theme="light"] .text-editor.readonly {
  background: rgba(15, 23, 42, 0.04);
}

:root[data-theme="light"] .theme-toggle {
  background: rgba(15, 23, 42, 0.04);
}

:root[data-theme="light"] .theme-toggle:hover {
  background: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.15);
}

:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.25);
}

/* ==================== PROFILE MODAL ==================== */
.profile-card { max-width: 440px; }
.profile-field { margin-bottom: 16px; }
.profile-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.profile-optional { font-weight: 400; color: var(--text-muted); }
.profile-field input[type="text"],
.profile-field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  outline: none;
}
.profile-field input[type="text"]:focus,
.profile-field select:focus { border-color: var(--brand-gold); }
.profile-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: 10px;
}
.profile-check input { width: 16px; height: 16px; accent-color: var(--brand-gold); }
.profile-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.profile-actions button {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.profile-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.profile-actions .btn-save {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.profile-actions button:hover { filter: brightness(1.1); }

/* ==================== HIDDEN UTILITY ==================== */
.hidden { display: none !important; }
