/* =============================================================================
   SomIslamic Course Pipeline — UI v2
   Design language: shadcn-inspired tokens • SISU brand (emerald + gold)
   Typography: system sans (Inter-like) + serif display fallback.
   Note: Google Fonts are blocked by the server CSP (style-src 'self'), so we
   rely on the system font stack. If self-hosted fonts are added later, drop
   them into public/fonts/ and declare @font-face here.
   ============================================================================= */

/* ------------------------------------------------------------------ Tokens -- */
:root {
  /* Brand */
  --brand-emerald:        #0f5132;
  --brand-emerald-700:    #0a3b24;
  --brand-emerald-500:    #16794c;
  --brand-emerald-50:     #ecfdf5;
  --brand-gold:           #d4af37;
  --brand-gold-50:        #fdf7e4;

  /* Neutral (slate) */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Semantic (shadcn-style) */
  --background:           #f8fafc;
  --surface:              #ffffff;
  --surface-muted:        #f1f5f9;
  --foreground:           #0f172a;
  --muted:                #f1f5f9;
  --muted-foreground:     #64748b;
  --border:               #e2e8f0;
  --border-strong:        #cbd5e1;
  --input:                #ffffff;
  --ring:                 rgba(15, 81, 50, 0.28);

  --primary:              var(--brand-emerald);
  --primary-hover:        var(--brand-emerald-700);
  --primary-foreground:   #ffffff;
  --primary-soft:         var(--brand-emerald-50);

  --accent:               var(--brand-gold);
  --accent-soft:          var(--brand-gold-50);
  --accent-foreground:    #5a4510;

  --success:              #15803d;
  --success-soft:         #dcfce7;
  --warning:              #b45309;
  --warning-soft:         #fef3c7;
  --danger:               #b91c1c;
  --danger-soft:          #fee2e2;
  --info:                 #1d4ed8;
  --info-soft:            #dbeafe;

  /* Shape & elevation */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow:    0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, .18), 0 4px 10px rgba(15, 23, 42, .05);

  /* Type */
  --font-sans:    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: Georgia, 'Times New Roman', serif;
  --font-arabic:  Tahoma, Arial, sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Layout */
  --sidebar-width: 296px;
  --sidebar-w:     var(--sidebar-width); /* internal alias */
  /* Legacy aliases (consumed by public pages + job-history + setup-guide sections) */
  --color-primary:        #0f5132;
  --color-primary-light:  #97bc62;
  --color-primary-dark:   #0a3b24;
  --color-success:        #16a34a;
  --color-warning:        #f59e0b;
  --color-error:          #dc2626;
  --color-info:           #0ea5e9;
  --color-bg:             var(--background);
  --color-surface:        var(--surface);
  --color-text:           var(--foreground);
  --color-text-light:     var(--muted-foreground);
  --color-border:         var(--border);
  --color-sidebar:        #0f172a;
  --color-sidebar-text:   #e2e8f0;
  --color-sidebar-active: var(--brand-emerald);
  --appbar-h:      60px;
  --content-max:   1200px;
}

/* ------------------------------------------------------------------- Reset -- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; color: var(--foreground); }
p { margin: 0; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
[lang="ar"], .rtl { font-family: var(--font-arabic); direction: rtl; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ring);
  border-radius: var(--radius-sm);
}

::selection { background: var(--primary-soft); color: var(--brand-emerald-700); }

/* ---------------------------------------------------------------- App shell -- */
.pipeline-app { min-height: 100vh; background: var(--background); }

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ----------------------------------------------------------------- Sidebar -- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.sidebar-brand {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-brand h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--brand-emerald);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-brand h1::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--brand-gold);
  transform: rotate(45deg);
}
.sidebar-brand p {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding-left: 16px;
}

.sidebar-status {
  flex: 0 0 auto;
  min-height: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  max-height: 62vh;
  overflow-y: auto;
}

.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  transition: background-color .15s;
}
.status-item:hover { background: var(--surface-muted); }
.status-label {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.status-text {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--foreground);
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badges -------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.5;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
}
.badge-draft       { color: var(--warning); background: var(--warning-soft); border-color: rgba(180,83,9,.15); }
.badge-publish,
.badge-success     { color: var(--success); background: var(--success-soft); border-color: rgba(21,128,61,.15); }
.badge-loading,
.badge-pending     { color: var(--muted-foreground); background: var(--muted); border-color: var(--border); }
.badge-loading::before { animation: pulse 1.3s ease-in-out infinite; }
.badge-error,
.badge-danger      { color: var(--danger); background: var(--danger-soft); border-color: rgba(185,28,28,.15); }
.badge-info        { color: var(--info); background: var(--info-soft); border-color: rgba(29,78,216,.15); }
.badge-connected   { color: var(--success); background: var(--success-soft); border-color: rgba(21,128,61,.15); }
.badge-disconnected{ color: var(--danger); background: var(--danger-soft); border-color: rgba(185,28,28,.15); }

@keyframes pulse { 50% { opacity: .35; } }

/* Auth + System Readiness panels ------------------------------------------ */
.auth-form.pipeline-auth-panel {
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.auth-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}
.auth-status-text {
  display: block;
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.45;
  margin-bottom: 10px;
}
.auth-actions-column { display: flex; flex-direction: column; gap: 8px; }
.auth-button-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-button-group > .btn-small { width: 100%; justify-content: center; white-space: nowrap; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.panel-header h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* Preflight list ----------------------------------------------------------- */
.preflight-list { display: flex; flex-direction: column; gap: 4px; }
.preflight-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.preflight-check .check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}
.preflight-check.ok       .check-icon { background: var(--success-soft); color: var(--success); }
.preflight-check.error    .check-icon,
.preflight-check.fail     .check-icon { background: var(--danger-soft);  color: var(--danger); }
.preflight-check.warning  .check-icon,
.preflight-check.warn     .check-icon { background: var(--warning-soft); color: var(--warning); }
.preflight-check.pending  .check-icon { background: var(--muted);        color: var(--muted-foreground); }
.check-label   { font-weight: 600; color: var(--foreground); }
.check-message { font-size: 11.5px; color: var(--muted-foreground); margin-top: 1px; line-height: 1.4; }

/* Sidebar nav (tabs) ------------------------------------------------------- */
.sidebar-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 10px 14px;
  background: var(--surface);
}
.sidebar-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.sidebar-nav-btn:hover { background: var(--surface-muted); color: var(--foreground); }
.sidebar-nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-nav-btn .nav-icon { font-size: 14px; line-height: 1; }

.sidebar-tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 14px 20px;
  background: var(--surface);
}
.sidebar-panel { display: none; }
.sidebar-panel.active { display: block; animation: fadeIn .2s ease-out; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.empty-state,
.empty-lessons {
  padding: 28px 14px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 12.5px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

/* ---------------------------------------------------------------- Main area -- */
.main-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--background);
}

/* App bar above stepper --------------------------------------------------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-bar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.01em;
}
.app-bar-sub {
  font-size: 12px;
  color: var(--muted-foreground);
}
.app-bar-spacer { flex: 1; }
.app-bar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--foreground);
}
.app-bar-chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted-foreground);
}
.app-bar-chip .dot.on  { background: var(--success); box-shadow: 0 0 0 3px rgba(21,128,61,.12); }
.app-bar-chip .dot.off { background: var(--danger);  box-shadow: 0 0 0 3px rgba(185,28,28,.10); }

/* Step indicators ---------------------------------------------------------- */
.step-indicators {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 22px 28px 18px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  user-select: none;
  transition: opacity .2s;
}
.step-item .step-number {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--muted-foreground);
  font-size: 12.5px;
  font-weight: 600;
  transition: all .2s;
}
.step-item .step-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
  transition: color .2s;
}
.step-item.active .step-number {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.step-item.active .step-label { color: var(--foreground); font-weight: 600; }
.step-item.completed .step-number {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: transparent;
  position: relative;
}
.step-item.completed .step-number::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}
.step-item.completed .step-label { color: var(--foreground); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}
.step-item.completed + .step-line { background: var(--primary); }

/* Wizard container --------------------------------------------------------- */
.wizard-container {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 4px 28px 48px;
  flex: 1;
}
.wizard-step { display: none; animation: stepIn .25s ease-out; }
.wizard-step.active { display: block; }
@keyframes stepIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step-header {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.step-header h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
  margin-bottom: 4px;
}
.step-header p {
  font-size: 13.5px;
  color: var(--muted-foreground);
}

/* Cards -------------------------------------------------------------------- */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.upload-card,
.review-card,
.lesson-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s, transform .2s;
}
.upload-card:hover { box-shadow: var(--shadow-sm); }

.upload-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.upload-card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.file-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted-foreground);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}

/* Drop zones --------------------------------------------------------------- */
.drop-zone {
  margin: 16px 18px;
  padding: 28px 20px;
  background: var(--surface-muted);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  transition: all .18s ease-out;
  cursor: pointer;
  position: relative;
}
.drop-zone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.01);
  box-shadow: 0 0 0 3px var(--ring);
}
.drop-zone-content { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop-icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 4px;
  box-shadow: var(--shadow-xs);
}
.drop-title { font-size: 13.5px; font-weight: 600; color: var(--foreground); }
.drop-or {
  font-size: 11px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 2px 0;
}
.drop-hint { font-size: 11.5px; color: var(--muted-foreground); margin-top: 4px; }

/* Upload progress + file list --------------------------------------------- */
.upload-progress-list { padding: 0 18px; display: flex; flex-direction: column; gap: 8px; }
.upload-progress-list:empty { padding: 0; }

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 4px;
}
.progress-filename { font-weight: 500; color: var(--foreground); }
.progress-size, .progress-status { font-variant-numeric: tabular-nums; }
.progress-bar {
  height: 4px;
  background: var(--muted);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--brand-emerald-500));
  border-radius: 2px;
  transition: width .2s ease-out;
}

.uploaded-file-list {
  padding: 0 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.uploaded-file-list:empty { padding: 0; }
.empty-file-list { display: none; }

.uploaded-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s;
}
.uploaded-file-item:hover { background: var(--primary-soft); border-color: var(--primary); }
.file-icon {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--primary);
  flex: 0 0 auto;
}
.file-details { flex: 1 1 auto; min-width: 0; }
.file-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta { font-size: 11px; color: var(--muted-foreground); }
.btn-delete-file {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all .15s;
}
.btn-delete-file:hover { background: var(--danger-soft); color: var(--danger); }

/* Step actions ------------------------------------------------------------ */
.step-actions {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.step-actions .step-hint {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-right: auto;
  order: -1;
  flex-basis: 100%;
}
@media (min-width: 640px) {
  .step-actions .step-hint { flex-basis: auto; order: 0; }
}

/* Buttons ------------------------------------------------------------------ */
.btn-primary, .btn-secondary, .btn-success, .btn-small,
.btn-browse, .btn-auto-build, .btn-add-lesson,
.btn-auth-save, .btn-auth-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all .15s ease-out;
  line-height: 1.3;
  white-space: nowrap;
}
.btn-primary, .btn-success {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-primary:active:not(:disabled),
.btn-success:active:not(:disabled) { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  color: var(--foreground);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--muted-foreground);
}

.btn-lg {
  padding: 11px 22px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius);
}

.btn-small {
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.btn-small:hover:not(:disabled) { background: var(--surface-muted); border-color: var(--border-strong); }

.btn-auth-save {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-auth-save:hover:not(:disabled) { background: var(--primary-hover); }
.btn-auth-clear {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border);
}
.btn-auth-clear:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

.btn-browse {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.btn-browse:hover { background: var(--primary); color: var(--primary-foreground); }

.btn-auto-build {
  background: var(--accent);
  color: var(--accent-foreground);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-auto-build:hover:not(:disabled) {
  background: #c09a23;
  border-color: #c09a23;
}
.btn-add-lesson {
  background: var(--surface);
  color: var(--primary);
  border: 1px dashed var(--primary);
}
.btn-add-lesson:hover { background: var(--primary-soft); }

button:disabled, .btn-primary:disabled, .btn-success:disabled,
.btn-secondary:disabled, .btn-small:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Forms -------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-group.required > label::after {
  content: "*";
  color: var(--danger);
  font-weight: 700;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--foreground);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--slate-400); }
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--muted-foreground); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
.form-group textarea { resize: vertical; min-height: 64px; }
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 34px;
}
.field-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 1em;
}
.form-group.error input,
.form-group.error select,
.form-group.error textarea { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(185,28,28,.12); }

/* Arabic title field gets RTL + Arabic font */
#courseTitleAr { font-family: var(--font-arabic); direction: rtl; text-align: right; }

/* Lessons builder --------------------------------------------------------- */
.lessons-builder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}
.lessons-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.lesson-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: var(--radius);
}
.lesson-card:hover { border-color: var(--border-strong); }
.lesson-headers {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lesson-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--foreground);
}
.lesson-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .lesson-fields { grid-template-columns: 1fr; } }
.lesson-meta { font-size: 11.5px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.lesson-warning {
  font-size: 11.5px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(180,83,9,.2);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  margin-top: 4px;
}
.btn-remove-lesson {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.btn-remove-lesson:hover { background: var(--danger-soft); color: var(--danger); }

.lesson-builder-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.lessons-summary {
  font-size: 12.5px;
  color: var(--muted-foreground);
  padding: 10px 14px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
}
.lessons-summary strong { color: var(--foreground); font-size: 14px; font-weight: 700; }

/* Review / Publish -------------------------------------------------------- */
.review-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.review-card { padding: 20px 22px; }
.review-card h3 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.review-details { display: flex; flex-direction: column; gap: 10px; }
.review-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  font-size: 13px;
  align-items: baseline;
}
.review-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.review-value {
  color: var(--foreground);
  font-weight: 500;
  word-break: break-word;
}

.review-lessons-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
}
.review-lesson-item {
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.review-lesson-item strong { display: block; color: var(--foreground); font-size: 13px; margin-bottom: 2px; }

.publish-status {
  margin: 24px 0;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  text-align: center;
  animation: fadeIn .3s ease-out;
}
.publish-message { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.publish-status-text { font-size: 14px; color: var(--foreground); }
#publishProgressText { font-size: 13px; color: var(--muted-foreground); }
.can-close-window {
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--success-soft);
  border: 1px solid rgba(21,128,61,.15);
  border-radius: var(--radius);
  color: #14532d;
  font-size: 12.5px;
  line-height: 1.55;
}
.can-close-window p { margin: 2px 0; }
.can-close-window p:first-child { font-weight: 600; }

/* Notifications / Toasts -------------------------------------------------- */
/* (Canonical .notification-stack rule lives near line ~2199 with z-index:1000.
   Per-element styling below is shared with that rule.) */
.notification-stack > div,
.notification-stack > .notification {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted-foreground);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--foreground);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn .2s ease-out;
}
.notification-stack .notification.success { border-left-color: var(--success); }
.notification-stack .notification.error   { border-left-color: var(--danger); }
.notification-stack .notification.info    { border-left-color: var(--info); }
.notification-stack .notification.warning { border-left-color: var(--warning); }
.notification-close {
  background: transparent;
  border: 0;
  color: var(--muted-foreground);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: auto;
}
.notification-close:hover { background: var(--surface-muted); color: var(--foreground); }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* Jobs list --------------------------------------------------------------- */
.jobs-list { display: flex; flex-direction: column; gap: 10px; }

.job-stats-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px;
  margin-bottom: 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.job-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-width: 0;
}
.job-stat-num {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  line-height: 1.1;
}
.job-stat-lbl {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-top: 2px;
}
.job-stat-pill.job-stat-completed  .job-stat-num { color: var(--success); }
.job-stat-pill.job-stat-processing .job-stat-num { color: var(--info); }
.job-stat-pill.job-stat-failed     .job-stat-num { color: var(--danger); }

.job-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.job-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.job-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.job-meta {
  font-size: 11.5px;
  color: var(--muted-foreground);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.job-meta > * { display: inline-flex; align-items: center; gap: 4px; }

.job-status-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.job-status-badge.status-pending,
.job-status-badge.status-queued    { background: var(--warning-soft); color: var(--warning); border-color: rgba(180,83,9,.2); }
.job-status-badge.status-processing,
.job-status-badge.status-running,
.job-status-badge.status-uploading { background: var(--info-soft); color: var(--info); border-color: rgba(29,78,216,.15); }
.job-status-badge.status-completed { background: var(--success-soft); color: var(--success); border-color: rgba(21,128,61,.15); }
.job-status-badge.status-failed,
.job-status-badge.status-error     { background: var(--danger-soft); color: var(--danger); border-color: rgba(185,28,28,.15); }

.job-error {
  font-size: 11.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  border: 1px solid rgba(185,28,28,.15);
}

/* Phase dots / timing ------------------------------------------------------ */
.timing-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.timing-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}
.timing-stat-icon { font-size: 14px; }
.timing-stat-label { color: var(--muted-foreground); }
.timing-stat-value { color: var(--foreground); font-weight: 600; margin-left: auto; font-variant-numeric: tabular-nums; }
.timing-projections { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.timing-proj-item {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.timing-phase-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--muted);
  overflow: hidden;
  display: flex;
}
.phase-render, .phase-upload, .phase-wp {
  height: 100%;
  transition: width .3s;
}
.phase-render { background: var(--info); }
.phase-upload { background: var(--accent); }
.phase-wp     { background: var(--primary); }
.timing-phase-legend { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--muted-foreground); }
.phase-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.phase-dot-render { background: var(--info); }
.phase-dot-upload { background: var(--accent); }
.phase-dot-wp     { background: var(--primary); }

/* Setup guide ------------------------------------------------------------- */
.setup-guide-content { display: flex; flex-direction: column; gap: 12px; font-size: 12.5px; color: var(--foreground); }
.setup-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.setup-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
}
.setup-step-title { font-weight: 600; color: var(--foreground); margin-bottom: 3px; }
.setup-step-desc { font-size: 12px; color: var(--muted-foreground); line-height: 1.45; }
.setup-link { color: var(--primary); font-weight: 500; }

.config-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 6px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
}
.config-key { color: var(--muted-foreground); font-weight: 500; }
.config-value { color: var(--foreground); font-family: var(--font-mono); font-size: 11px; }

/* --------------------------------------------------------------- Responsive -- */
@media (max-width: 1024px) {
  :root { --sidebar-width: 260px; }
  .step-indicators { padding: 18px 20px 14px; gap: 4px; }
  .step-line { margin: 0 6px; }
  .wizard-container { padding: 4px 20px 40px; }
  .app-bar { padding: 0 20px; }
}

@media (max-width: 820px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease-out;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.4);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  .step-item .step-label { display: none; }
  .step-item.active .step-label { display: inline; }
}
.menu-toggle { display: none; }
@media (max-width: 820px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--foreground);
  }
  .menu-toggle:hover { background: var(--surface-muted); }
}

/* Scrollbars -------------------------------------------------------------- */
.sidebar-status::-webkit-scrollbar,
.sidebar-tab-content::-webkit-scrollbar,
.review-lessons-list::-webkit-scrollbar { width: 8px; }
.sidebar-status::-webkit-scrollbar-thumb,
.sidebar-tab-content::-webkit-scrollbar-thumb,
.review-lessons-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.sidebar-status::-webkit-scrollbar-thumb:hover,
.sidebar-tab-content::-webkit-scrollbar-thumb:hover,
.review-lessons-list::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Motion reduction -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
/* style.css - Sidebar Layout */
/* =================== PUBLIC PAGES =================== */
body.landing-page,
body.login-page {
  font-family: 'Avenir Next', 'Trebuchet MS', 'Gill Sans', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(184, 120, 35, 0.12), transparent 32%),
    radial-gradient(circle at bottom right, rgba(44, 95, 45, 0.12), transparent 28%),
    linear-gradient(145deg, #f8f3e7 0%, #f4ecdc 48%, #fcfaf5 100%);
  color: #203126;
  overflow-x: hidden;
}

.landing-page a,
.login-page a {
  color: inherit;
  text-decoration: none;
}

.marketing-shell {
  min-height: 100vh;
  padding: 22px;
}

.marketing-frame {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 30px;
  background: rgba(255, 252, 245, 0.9);
  border: 1px solid rgba(58, 79, 60, 0.08);
  box-shadow: 0 24px 70px rgba(53, 44, 24, 0.1);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.marketing-frame::before,
.marketing-frame::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.marketing-frame::before {
  width: 300px;
  height: 300px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, rgba(184, 120, 35, 0.14), transparent 68%);
}

.marketing-frame::after {
  width: 250px;
  height: 250px;
  left: -70px;
  bottom: -90px;
  background: radial-gradient(circle, rgba(44, 95, 45, 0.12), transparent 72%);
}

.marketing-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.marketing-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.marketing-brand-kicker {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: rgba(32, 49, 38, 0.7);
}

.marketing-brand-title,
.marketing-display,
.marketing-panel-title,
.marketing-login-title {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
}

.marketing-brand-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.marketing-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.marketing-nav-link,
.marketing-pill-link,
.marketing-access-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 999px;
  border: 1px solid rgba(32, 49, 38, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: #203126;
  font-size: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.marketing-nav-link:hover,
.marketing-pill-link:hover,
.marketing-access-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(53, 44, 24, 0.12);
  background: rgba(255, 255, 255, 0.95);
}

.landing-hero,
.login-panel {
  position: relative;
  z-index: 1;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(290px, 0.88fr);
  gap: 20px;
  align-items: stretch;
}

.marketing-card,
.login-panel,
.marketing-stats,
.marketing-access-strip,
 .marketing-step-card,
.login-source-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(32, 49, 38, 0.1);
  border-radius: 24px;
  box-shadow: 0 16px 36px rgba(53, 44, 24, 0.07);
}

.marketing-card {
  padding: 30px;
}

.marketing-card-hero {
  display: flex;
  flex-direction: column;
}

.marketing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(44, 95, 45, 0.08);
  color: #28452a;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.marketing-eyebrow-icon,
.marketing-return-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.marketing-display {
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  line-height: 0.94;
  margin-bottom: 14px;
  color: #1d2f25;
}

.marketing-copy,
.marketing-list,
.marketing-proof-copy,
.marketing-login-copy,
.marketing-return-pill {
  font-size: 1rem;
  color: rgba(32, 49, 38, 0.82);
}

.marketing-copy {
  max-width: 40rem;
  margin-bottom: 18px;
}

.marketing-highlight-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.marketing-highlight-pill,
.marketing-mini-item,
.login-guidance-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.marketing-highlight-pill {
  padding: 14px;
  border-radius: 18px;
  background: rgba(247, 244, 236, 0.9);
  border: 1px solid rgba(32, 49, 38, 0.08);
}

.marketing-highlight-pill strong,
.marketing-mini-item strong,
.login-guidance-item strong,
.marketing-compact-note strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.marketing-highlight-pill span,
.marketing-mini-item span,
.login-guidance-item span,
.marketing-compact-note span {
  color: rgba(32, 49, 38, 0.76);
}

.marketing-icon-badge,
.marketing-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(35, 77, 43, 0.12), rgba(184, 120, 35, 0.12));
  color: #234d2b;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(35, 77, 43, 0.08);
}

.marketing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.marketing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.marketing-button:hover {
  transform: translateY(-1px);
}

.marketing-button-primary {
  background: linear-gradient(135deg, #234d2b 0%, #2f6c39 100%);
  color: #fff7eb;
  box-shadow: 0 18px 40px rgba(44, 95, 45, 0.24);
}

.marketing-button-secondary {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(32, 49, 38, 0.14);
}

.marketing-list {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.marketing-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.marketing-list li::before {
  content: '\2713';
  color: #2f6c39;
  font-size: 1rem;
  line-height: 1;
  margin-top: 0.1rem;
}

.marketing-stats {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.marketing-compact-panel {
  align-content: start;
}

.marketing-section-label,
.marketing-feature-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: #b87823;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.marketing-mini-list {
  display: grid;
  gap: 14px;
}

.marketing-compact-note {
  padding: 16px;
  border-radius: 18px;
  background: rgba(247, 244, 236, 0.88);
  border: 1px solid rgba(32, 49, 38, 0.08);
}

.marketing-panel-title,
.marketing-login-title {
  font-size: 1.7rem;
  line-height: 1.08;
  margin-bottom: 8px;
}

.marketing-step-grid {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.marketing-step-card {
  padding: 20px;
}

.marketing-step-card h3 {
  margin: 14px 0 8px;
  font-size: 1.05rem;
}

.marketing-step-card p {
  color: rgba(32, 49, 38, 0.78);
}

.marketing-access-strip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding: 22px 24px;
}

.marketing-access-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.marketing-access-caption {
  max-width: 31rem;
  color: rgba(32, 49, 38, 0.8);
}

.marketing-access-link::before {
  content: '\2197';
  font-size: 0.92rem;
  color: #b87823;
}

.login-shell {
  display: grid;
  place-items: center;
}

.login-panel {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 30px;
}

.marketing-return-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(247, 244, 236, 0.92);
  border: 1px solid rgba(32, 49, 38, 0.08);
}

.login-guidance-grid,
.login-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.login-guidance-grid {
  margin-bottom: 18px;
}

.login-guidance-item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(247, 244, 236, 0.9);
  border: 1px solid rgba(32, 49, 38, 0.08);
}

.login-source-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}

.login-source-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 156px;
  padding: 20px 20px 20px 72px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.login-source-card::before {
  content: '\2197';
  position: absolute;
  top: 20px;
  left: 20px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(35, 77, 43, 0.12), rgba(184, 120, 35, 0.12));
  color: #234d2b;
  font-weight: 700;
}

.login-source-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(53, 44, 24, 0.12);
  border-color: rgba(44, 95, 45, 0.28);
}

.login-source-card strong {
  font-size: 1.15rem;
}

.login-source-card span {
  color: rgba(32, 49, 38, 0.78);
}

.login-source-card em {
  margin-top: auto;
  color: #234d2b;
  font-style: normal;
  font-weight: 700;
  font-size: 0.92rem;
}

.login-source-card.is-secondary {
  background: linear-gradient(180deg, rgba(255, 248, 235, 0.9) 0%, rgba(255, 255, 255, 0.82) 100%);
}

.marketing-note {
  margin-top: 10px;
  color: rgba(32, 49, 38, 0.72);
  font-size: 0.94rem;
}

@media (max-width: 1040px) {
  .landing-hero,
  .marketing-highlight-row,
  .marketing-step-grid,
  .login-guidance-grid,
  .login-source-grid {
    grid-template-columns: 1fr;
  }

  .marketing-access-strip,
  .marketing-nav {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .marketing-shell {
    padding: 12px;
  }

  .marketing-frame,
  .marketing-card,
  .marketing-stats,
  .login-panel,
  .marketing-access-strip,
  .marketing-step-card {
    padding: 20px;
  }

  .marketing-display {
    font-size: clamp(2.1rem, 15vw, 3.2rem);
  }

  .marketing-actions,
  .marketing-access-links,
  .marketing-nav-links {
    width: 100%;
  }

  .marketing-nav-links {
    justify-content: flex-start;
  }

  .marketing-button,
  .marketing-access-link,
  .login-source-card {
    width: 100%;
  }

  .marketing-nav-link,
  .marketing-pill-link {
    width: auto;
    min-height: 42px;
  }

  .marketing-return-pill {
    width: 100%;
    justify-content: flex-start;
    border-radius: 18px;
  }
}

/* =================== JOB HISTORY CARDS =================== */

/* Stats summary bar above job list */
.job-stats-header {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.job-stat-pill {
  flex: 1;
  min-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.job-stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.job-stat-lbl {
  font-size: 10px;
  color: var(--color-text-light);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.job-stat-completed .job-stat-num { color: var(--color-success); }
.job-stat-processing .job-stat-num { color: #1976d2; }
.job-stat-failed .job-stat-num { color: var(--color-error); }

/* Individual job card */
.job-item {
  padding: 12px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.job-item:hover {
  box-shadow: var(--shadow-md);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 5px;
  gap: 8px;
}

.job-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-status-badge {
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-processing, .status-uploading, .status-publishing { background: #e3f2fd; color: #1565c0; }
.status-failed { background: #ffebee; color: #c62828; }
.status-pending { background: #fff8e1; color: #e65100; }

.job-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--color-text-light);
  flex-wrap: wrap;
  margin-bottom: 10px;
  align-items: center;
}

.job-meta a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.job-meta a:hover { text-decoration: underline; }

/* Phase timing bar */
.timing-phase-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
  gap: 1px;
}

.phase-render  { background: #4caf50; border-radius: 4px 0 0 4px; min-width: 4px; }
.phase-upload  { background: #2196f3; min-width: 4px; }
.phase-wp      { background: #9c27b0; border-radius: 0 4px 4px 0; min-width: 4px; }

.timing-phase-legend {
  display: flex;
  gap: 10px;
  font-size: 10px;
  color: var(--color-text-light);
  margin-bottom: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.phase-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 2px;
}

.phase-dot-render { background: #4caf50; }
.phase-dot-upload { background: #2196f3; }
.phase-dot-wp     { background: #9c27b0; }

/* 2×2 stats grid */
.timing-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.timing-stat {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.timing-stat-icon {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.timing-stat-label {
  font-size: 10px;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.timing-stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

/* Projections row */
.timing-projections {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: #f0f7ff;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #1565c0;
  margin-bottom: 6px;
}

.timing-proj-label {
  font-weight: 600;
  margin-right: 2px;
  color: var(--color-text-light);
}

.timing-proj-item {
  background: rgba(33,150,243,0.1);
  padding: 2px 7px;
  border-radius: 12px;
  white-space: nowrap;
}

.timing-proj-item strong {
  color: #1565c0;
}

.job-error {
  margin-top: 6px;
  font-size: 11px;
  color: var(--color-error);
  background: #fff5f5;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-error);
}

/* =================== SETUP GUIDE =================== */
.setup-guide-content { font-size: 13px; line-height: 1.7; }
.setup-step { margin-bottom: 16px; padding: 12px; background: var(--color-bg); border-radius: var(--radius-md); }
.setup-step-number { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--color-primary); color: #fff; font-size: 12px; font-weight: 600; margin-right: 8px; }
.setup-step-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.setup-step-desc { color: var(--color-text-light); margin-bottom: 6px; }

.setup-link { display: inline-block; padding: 4px 10px; background: var(--color-primary); color: #fff; border-radius: var(--radius-sm); font-size: 12px; text-decoration: none; margin: 2px; }
.setup-link:hover { background: var(--color-primary-dark); }

.config-card { padding: 8px 12px; background: var(--color-surface); border-radius: var(--radius-sm); margin: 4px 0; font-size: 12px; }
.config-card .config-key { font-weight: 600; }
.config-card .config-value { color: var(--color-text-light); }
.config-ok { color: var(--color-success); }
.config-missing { color: var(--color-error); }

/* =================== NOTIFICATIONS =================== */
.notification-stack { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }

.notification {
  background: var(--color-surface);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  font-size: 13px;
}

.notification-success { border-left: 3px solid var(--color-success); }
.notification-error { border-left: 3px solid var(--color-error); }
.notification-warning { border-left: 3px solid var(--color-warning); }
.notification-info { border-left: 3px solid var(--color-info); }

.notification-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--color-text-light); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =================== EMPTY STATES =================== */
.empty-state, .empty-file-list { text-align: center; padding: 16px; color: var(--color-text-light); font-size: 13px; }

/* =================== RESPONSIVE =================== */
@media (max-width: 920px) {
  .upload-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .lesson-fields { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 180px; }
  .wizard-container { padding: 16px; }
  .step-indicators { padding: 12px 16px; }
  .step-label { display: none; }
  .step-line { width: 24px; }
}

@media (max-width: 600px) {
  .app-layout { flex-direction: column; }
  .sidebar { position: static; width: 100%; flex-direction: row; align-items: flex-start; padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .sidebar-brand { border-bottom: none; padding: 0; margin-right: 12px; }
  .sidebar-brand p { display: none; }
  .sidebar-status {
    display: flex;
    width: 100%;
    order: 3;
    border-bottom: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 8px 0 0;
  }
  .sidebar-nav { flex-direction: row; padding: 0; gap: 4px; flex: 1; justify-content: flex-end; }
  .sidebar-nav-btn { padding: 6px 10px; font-size: 12px; }
  .nav-label { display: none; }
  .nav-icon { font-size: 18px; }
  .main-content { margin-left: 0; }
  .sidebar-panel { max-height: 50vh; }
  .step-actions { flex-wrap: wrap; }
  .step-hint { margin-left: 0; width: 100%; }
  .auth-input-row, .auth-actions { flex-direction: column; align-items: stretch; }
}

/* === UX Overhaul 2026-04 ============================================== */
:root {
  --statusbar-h: 38px;
  --popover-shadow: 0 14px 32px rgba(15, 23, 42, .22);
  --drawer-w: min(680px, 78vw);
  --lightbox-bg: rgba(15, 16, 17, 0.92);
}

/* Slim sidebar status hint replaces the old cluttered status panel. */
.sidebar-status-slim {
  border-bottom: 1px solid var(--border);
  padding: 14px 22px;
}
.sidebar-status-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted-foreground);
}
.legacy-status-shim { position: absolute; left: -9999px; }

/* Reserve space at the bottom so the wizard isn't covered. */
body.pipeline-app { padding-bottom: var(--statusbar-h); }

/* ---- Status bar ------------------------------------------------------- */
.status-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--statusbar-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 1100;
  box-shadow: 0 -2px 6px rgba(15,23,42,.04);
}
.status-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  padding: 0 14px;
  overflow-x: auto;
}
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--foreground);
  white-space: nowrap;
  cursor: pointer;
  transition: background 120ms ease;
}
.status-indicator:hover { background: var(--surface-muted); }
.status-indicator[aria-expanded="true"] { background: var(--surface-muted); }
.status-indicator .indicator-icon { color: var(--muted-foreground); display: inline-flex; }
.status-indicator .indicator-label { color: var(--muted-foreground); }
.status-indicator .indicator-value { font-weight: 600; }
.status-indicator .indicator-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate-300);
}
.indicator-dot[data-state="ok"]       { background: var(--success); box-shadow: 0 0 0 2px rgba(21,128,61,.18); }
.indicator-dot[data-state="warn"]     { background: var(--warning); box-shadow: 0 0 0 2px rgba(180,83,9,.18); }
.indicator-dot[data-state="error"]    { background: var(--danger);  box-shadow: 0 0 0 2px rgba(185,28,28,.18); }
.indicator-dot[data-state="checking"] { background: var(--slate-500, #64748b); animation: indicatorPulse 1.4s ease-in-out infinite; will-change: opacity; }
.indicator-dot[data-state="unknown"]  { background: var(--slate-500, #64748b); }
@keyframes indicatorPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* a11y: visible focus on overhaul interactives */
.status-indicator:focus-visible,
.popover-close:focus-visible,
.job-drawer-close:focus-visible,
.media-lightbox-close:focus-visible,
.history-row:focus-visible,
.lesson-thumb:focus-visible,
.lesson-audio-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Touch target floor for status indicators */
.status-indicator { min-height: 32px; }

/* Status bar: visible scroll affordance on narrow viewports */
.status-bar-inner { scrollbar-width: thin; scroll-snap-type: x proximity; }
.status-bar-inner::-webkit-scrollbar { height: 6px; }
.status-bar-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.status-indicator { scroll-snap-align: start; }

/* Reduced motion: kill pulses + drawer/lightbox transitions */
@media (prefers-reduced-motion: reduce) {
  .indicator-dot[data-state="checking"],
  .timeline-active .timeline-dot { animation: none !important; }
  .job-drawer { transition: none !important; }
  .media-lightbox { transition: none !important; }
}
.status-bar-spacer { flex: 1; }
.status-link {
  font-size: 12px;
  color: var(--primary);
  white-space: nowrap;
  text-decoration: none;
}
.status-link:hover { text-decoration: underline; }

/* ---- Popovers --------------------------------------------------------- */
.popover-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.04);
  z-index: 1199;
}
.status-popover {
  position: fixed;
  width: 320px;
  max-width: calc(100vw - 16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--popover-shadow);
  padding: 14px;
  z-index: 1200;
}
.status-popover.status-popover-wide { width: 420px; }
.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.popover-header h4 { margin: 0; font-size: 13px; font-weight: 600; }
.popover-header-actions { display: inline-flex; gap: 6px; align-items: center; }
.popover-close {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 18px;
  line-height: 1;
}
.popover-close:hover { background: var(--surface-muted); color: var(--foreground); }
.popover-body { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.popover-text { margin: 0; color: var(--foreground); line-height: 1.45; }
.popover-meta { margin: 0; font-size: 11px; color: var(--muted-foreground); }
.popover-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
}
.popover-kv:last-child { border-bottom: 0; }
.popover-kv span { color: var(--muted-foreground); }
.popover-kv strong { font-weight: 600; }
.popover-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.quota-meter { width: 100%; height: 6px; background: var(--surface-muted); border-radius: 3px; overflow: hidden; }
.quota-meter-fill { height: 100%; background: var(--primary); transition: width 200ms ease; }

/* ---- Job drawer ------------------------------------------------------- */
.job-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.32);
  z-index: 1300;
}
.job-drawer {
  position: fixed;
  top: 0; right: 0; bottom: var(--statusbar-h);
  width: var(--drawer-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 32px rgba(15,23,42,.18);
  display: flex;
  flex-direction: column;
  z-index: 1301;
  transform: translateX(8px);
  transition: transform 180ms ease;
}
.job-drawer.open { transform: translateX(0); }
.job-drawer-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.job-drawer-header h3 { font-size: 16px; }
.job-drawer-sub { color: var(--muted-foreground); font-size: 12px; margin: 4px 0 0; }
.job-drawer-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted-foreground);
}
.job-drawer-close:hover { background: var(--surface-muted); }
.job-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.job-drawer-footer {
  border-top: 1px solid var(--border);
  padding: 10px 20px;
  display: flex; justify-content: space-between; gap: 8px;
}

.drawer-section { display: flex; flex-direction: column; gap: 8px; }
.drawer-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); }
.drawer-grid { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; margin: 0; }
.drawer-grid dt { color: var(--muted-foreground); }
.drawer-grid dd { margin: 0; font-weight: 500; }
.drawer-error { background: var(--danger-soft); border-radius: var(--radius); padding: 12px; }
.drawer-meta { font-size: 12px; color: var(--muted-foreground); margin: 4px 0; }

.lesson-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
}
.lesson-card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lesson-card-header h5 { margin: 0; font-size: 14px; }
.lesson-card.lesson-status-completed { border-color: var(--success); }
.lesson-card.lesson-status-failed { border-color: var(--danger); background: var(--danger-soft); }

.lesson-media-tray { display: flex; flex-wrap: wrap; gap: 8px; }
.lesson-thumb {
  position: relative;
  width: 132px; height: 74px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--slate-100);
  padding: 0;
}
.lesson-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lesson-thumb-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 22px;
  background: rgba(0,0,0,.32);
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.lesson-thumb:hover .lesson-thumb-play { background: rgba(0,0,0,.18); }
.lesson-audio-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  background: var(--surface);
}
.lesson-audio-btn:hover { background: var(--surface-muted); }

.lesson-timeline {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px;
}
.timeline-step { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--slate-300); margin-left: 2px; }
.timeline-done .timeline-dot { background: var(--success); }
.timeline-active .timeline-dot { background: var(--info); animation: indicatorPulse 1.4s infinite; }
.timeline-done .timeline-label { color: var(--foreground); }
.timeline-pending .timeline-label { color: var(--muted-foreground); }
.timeline-meta { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

.lesson-links { font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lesson-eta { color: var(--muted-foreground); }
.lesson-error { font-size: 12px; color: var(--danger); margin: 0; }

.job-item-clickable { cursor: pointer; }
.job-item-clickable:hover { background: var(--surface-muted); }
.job-item-clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---- Lightbox --------------------------------------------------------- */
.media-lightbox {
  position: fixed; inset: 0;
  background: var(--lightbox-bg);
  z-index: 1400;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px;
  gap: 12px;
}
.media-lightbox-close {
  position: absolute; top: 16px; right: 20px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.4);
  color: white;
  font-size: 22px;
}
.media-lightbox-close:hover { background: rgba(0,0,0,.6); }
.media-lightbox-title { color: white; font-size: 14px; margin: 0; }
.media-lightbox-stage { max-width: min(1200px, 92vw); max-height: 78vh; display: flex; align-items: center; justify-content: center; }
.media-lightbox-stage video,
.media-lightbox-stage img { max-width: 100%; max-height: 78vh; border-radius: var(--radius); }
.media-lightbox-stage audio { width: min(560px, 90vw); }
.media-lightbox-meta { color: rgba(255,255,255,.85); font-size: 12px; }

/* ---- History page ----------------------------------------------------- */
.history-page { display: flex; flex-direction: column; gap: 16px; padding: 8px 0; }
.history-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.history-header h2 { font-size: 22px; }
.history-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.history-controls input[type="search"] {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px;
  min-width: 220px; background: var(--surface);
}
.history-controls select {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; background: var(--surface);
}
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.history-row:hover { background: var(--surface-muted); }
.history-row h3 { font-size: 14px; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.history-row-main { min-width: 0; flex: 1; }
.history-row-meta { margin: 0; font-size: 12px; color: var(--muted-foreground); }
.history-row-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; flex-shrink: 0; }
.timeline-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mobile tuning */
@media (max-width: 700px) {
  .status-bar-inner { gap: 6px; padding: 0 8px; }
  .status-indicator .indicator-label { display: none; }
  .status-link { display: none; }
  .job-drawer { width: 100vw; }
  .job-drawer-close { position: sticky; top: 8px; align-self: flex-end; right: 8px; background: var(--surface); border-radius: 50%; padding: 6px; }
}
