/* VenX Studio -- design tokens from mockups + md2pdf */

:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --success: #10B981;
  --success-light: #DCFCE7;
  --error: #EF4444;
  --error-light: #FEE2E2;
  --error-bg: #FEF2F2;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-subtle: #CBD5E1;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
}

/* -- Nav bar -- */
.navbar {
  height: 56px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-beta {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
  vertical-align: super;
}

.navbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.badge-pro {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
}

.btn-nav {
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-nav:hover {
  background: var(--border-light);
}

/* -- Main container -- */
.main {
  max-width: 960px;
  margin: 32px auto;
  padding: 0 24px;
}

/* -- Card -- */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px;
}

.card-centered {
  max-width: 600px;
  margin: 80px auto;
  text-align: center;
}

/* -- Section labels -- */
.section-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* -- Example brief cards -- */
.example-cards {
  margin-bottom: 16px;
}

.example-cards-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.example-cards-label a.example-clear {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

.example-cards-row {
  display: flex;
  gap: 10px;
}

.example-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.example-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.example-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--border-light);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.example-card:hover .example-icon {
  background: white;
}

.example-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* -- Brief hint -- */
.brief-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 8px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* -- Brief textarea -- */
.brief-textarea {
  width: 100%;
  min-height: 280px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  resize: vertical;
  transition: border-color 0.15s;
}

.brief-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.brief-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.char-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* -- Brand cards -- */
.brand-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-card {
  width: 130px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 12px 0 16px;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}

.brand-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  border-radius: 2px 0 0 2px;
}

.brand-card:hover {
  border-color: var(--text-muted);
}

.brand-card.selected {
  border-color: var(--primary);
  border-width: 2px;
}

.brand-card .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.brand-card .colors {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.brand-card .check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  display: none;
  align-items: center;
  justify-content: center;
}

.brand-card.selected .check {
  display: flex;
}

.brand-more {
  width: 60px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--primary);
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.15s;
}

.brand-more:hover {
  background: #DBEAFE;
  border-color: var(--primary);
}

/* -- Output mode toggle -- */
.mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.mode-btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

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

.mode-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* -- Coming Soon engine buttons -- */
.mode-btn.coming-soon {
  position: relative;
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--border-light);
  cursor: default;
}

.mode-btn.coming-soon:hover {
  border-color: var(--text-muted);
}

.mode-btn.coming-soon.selected {
  border-color: var(--border);
  background: var(--border-light);
  color: var(--text-muted);
  font-weight: 500;
}

.soon-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 800;
  color: white;
  background: var(--text-muted);
  padding: 1px 5px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.4;
}

.coming-soon-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  padding: 10px 14px;
  background: var(--text-primary);
  color: white;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  pointer-events: none;
  text-align: left;
}

.coming-soon-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text-primary);
}

.mode-btn.coming-soon:hover .coming-soon-tooltip {
  display: block;
}

.hint-coming-soon {
  color: var(--text-muted);
  font-style: italic;
}

/* -- Slide type toggle (compact for 10 options) -- */
#type-toggle .mode-btn {
  padding: 7px 12px;
  font-size: 12px;
}

/* -- Slide count toggle -- */
.slide-count-toggle .mode-btn {
  padding: 10px 14px;
  min-width: 44px;
  text-align: center;
}

/* -- Generate button -- */
.btn-generate {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-generate:hover {
  background: var(--primary-hover);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.section-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -20px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.footer-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* -- Generating state -- */
.generating-card {
  padding: 60px 40px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 64px;
  height: 64px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}

.generating-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--border-light);
  border-radius: 18px;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.step-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.elapsed {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.time-hint {
  font-size: 12px;
  color: var(--text-subtle);
  transition: color 0.3s;
}

.btn-cancel {
  margin-top: 20px;
  padding: 8px 24px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-light);
}

/* -- Complete state -- */
.success-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--success-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.success-icon-inner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.complete-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
}

.complete-meta {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.preview-frame {
  background: var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  margin-bottom: 24px;
  overflow: hidden;
}

.preview-frame svg,
.preview-frame img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  background: white;
}

/* -- Deck thumbnails -- */
.thumb-strip {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding: 4px;
}

.thumb {
  flex-shrink: 0;
  width: 180px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}

.thumb.active {
  border-color: var(--primary);
  border-width: 2px;
}

.thumb svg {
  width: 100%;
  height: auto;
  display: block;
}

.thumb-label {
  text-align: center;
  font-size: 10px;
  padding: 4px;
  color: var(--text-secondary);
}

.thumb.active .thumb-label {
  color: var(--primary);
  font-weight: 600;
}

/* -- Action buttons -- */
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  background: var(--border-light);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: var(--border);
}

.link-download {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  margin-bottom: 16px;
}

.stats-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-subtle);
}

/* -- Error state -- */
.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--error-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.error-icon-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: bold;
}

.error-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 16px;
}

.error-box {
  background: var(--error-bg);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 24px;
  text-align: center;
}

.error-box .msg {
  font-size: 13px;
  color: #991B1B;
  margin-bottom: 4px;
}

.error-box .hint {
  font-size: 12px;
  color: #B91C1C;
}

.help-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* -- Error diagnosis -- */
.error-diagnosis {
  text-align: left;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.diagnosis-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.diagnosis-list {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.diagnosis-list li {
  margin-bottom: 2px;
}

.error-context {
  margin-bottom: 16px;
}

.error-context-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.error-context-row strong {
  color: var(--text-secondary);
}

/* -- Auth forms (Phase 3) -- */
.auth-card {
  max-width: 420px;
  margin: 80px auto;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

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

.form-group input {
  width: 100%;
  height: 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.auth-toggle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 16px;
}

.auth-toggle a {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  height: 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
}

.btn-google:hover {
  background: var(--border-light);
}

/* -- Drop zone -- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.drop-zone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--text-secondary);
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.drop-zone svg {
  flex-shrink: 0;
}

/* -- File list -- */
#file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.file-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.file-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--text-muted);
  font-size: 11px;
}

.file-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

.file-remove:hover {
  color: var(--error);
}

/* -- Brand preview panel -- */
.brand-preview {
  margin-bottom: 20px;
}

.brand-preview-inner {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.brand-preview-colors {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.color-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 36px;
  flex-shrink: 0;
}

.brand-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch-picker {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

.swatch-picker::-webkit-color-swatch-wrapper {
  padding: 1px;
}

.swatch-picker::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.swatch-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.swatch-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.swatch-hex {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.brand-preview-fields {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.brand-field {
  flex: 1;
}

.brand-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.brand-field input,
.brand-field select {
  width: 100%;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--card);
}

.brand-field input:focus,
.brand-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

/* -- Audience detail panel -- */
.audience-detail {
  margin-bottom: 8px;
}

.audience-detail-inner {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.audience-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.audience-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* -- Deck quality badge -- */
.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
  transition: opacity 0.15s;
}

.quality-badge:hover {
  opacity: 0.85;
}

.quality-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.quality-badge-arrow {
  font-size: 10px;
  margin-left: 4px;
  color: inherit;
  opacity: 0.6;
}

.quality-good {
  background: var(--success-light);
  color: #166534;
}
.quality-good .quality-badge-dot { background: var(--success); }

.quality-acceptable {
  background: #FEF3C7;
  color: #92400E;
}
.quality-acceptable .quality-badge-dot { background: #F59E0B; }

.quality-review {
  background: #FEE2E2;
  color: #991B1B;
}
.quality-review .quality-badge-dot { background: var(--error); }

/* -- Per-slide status dots -- */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.status-dot-ok { background: var(--success); }
.status-dot-degraded { background: #F59E0B; }
.status-dot-failed { background: var(--error); }

/* -- Quality details panel -- */
.quality-details {
  text-align: left;
  margin-bottom: 20px;
}

.quality-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.quality-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.quality-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.quality-table tr:last-child td {
  border-bottom: none;
}

.qd-num {
  width: 32px;
  color: var(--text-muted);
  font-weight: 600;
}

.qd-title {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qd-status {
  white-space: nowrap;
}

.qd-time {
  text-align: right;
  color: var(--text-muted);
  font-size: 12px;
}

/* -- Backend badges -- */
.qd-backend { white-space: nowrap; }

.backend-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #FFF;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.qd-fallback {
  display: inline-block;
  font-size: 10px;
  color: #B45309;
  background: #FEF3C7;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
}

.qd-flags {
  display: inline-block;
  font-size: 10px;
  color: #6B7280;
  background: var(--bg-muted, #F3F4F6);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  cursor: help;
}

/* -- Verification metrics -- */
.quality-verify {
  display: flex;
  gap: 16px;
  padding: 10px 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.verify-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.verify-metric::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.verify-ok::before { background: var(--success); }
.verify-ok { color: #166534; }

.verify-warn::before { background: #F59E0B; }
.verify-warn { color: #92400E; }

.verify-fail::before { background: var(--error); }
.verify-fail { color: #991B1B; }

/* -- Routed slide detail (Smart engine) -- */
.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16/9;
  background: #F1F5F9;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
}
.thumb-num {
  font-size: 24px;
  font-weight: 700;
  color: #94A3B8;
}
.routed-slide-detail {
  text-align: left;
  padding: 32px;
  background: #F8FAFC;
  border-radius: 10px;
  border: 1px solid #E2E8F0;
  min-height: 200px;
}
.rsd-title {
  font-size: 18px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 20px;
  line-height: 1.4;
}
.rsd-row {
  font-size: 14px;
  color: #475569;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rsd-label {
  font-weight: 600;
  color: #334155;
  min-width: 90px;
}
.slide-flag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #FEF3C7;
  color: #92400E;
}
.slide-flag-ok {
  font-size: 11px;
  color: #059669;
}

/* -- Title slide toggle -- */
.title-slide-toggle {
  margin-bottom: 12px;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

.toggle-label {
  font-weight: 500;
}

#title-slide-fields {
  margin-top: 8px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

#title-slide-fields .form-group {
  margin-bottom: 10px;
}

#title-slide-fields .form-group:last-child {
  margin-bottom: 0;
}

/* -- Page tabs -- */
.page-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  padding: 0 24px;
}

.page-tab {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.page-tab:hover {
  color: var(--text-primary);
}

.page-tab.selected {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* -- Explore Charts -- */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.explore-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.explore-card:hover {
  box-shadow: var(--shadow-md);
}

.explore-svg {
  background: white;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.explore-svg svg {
  width: 100%;
  height: auto;
  display: block;
}

.explore-meta {
  padding: 12px;
}

.explore-type {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
  margin-bottom: 8px;
}

.explore-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.explore-score-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 32px;
}

.explore-score-bar {
  flex: 1;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.explore-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.explore-score-fill.score-good { background: var(--success); }
.explore-score-fill.score-warn { background: #F59E0B; }
.explore-score-fill.score-low { background: var(--error); }

.explore-score-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: right;
}

.explore-rationale {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* -- Library -- */
.library-search {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.library-search input {
  flex: 1;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-primary);
}

.library-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.library-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.library-card:hover {
  box-shadow: var(--shadow-md);
}

.library-thumb {
  aspect-ratio: 16/9;
  background: var(--border-light);
  overflow: hidden;
}

.library-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: capitalize;
}

.library-info {
  padding: 10px 12px;
}

.library-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.library-brand {
  text-transform: capitalize;
}

.library-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.library-tag {
  font-size: 10px;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  color: var(--text-secondary);
}

.library-actions {
  display: flex;
  gap: 6px;
  padding: 0 12px 10px;
}

.btn-lib-download {
  font-size: 11px;
  padding: 4px 12px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

.btn-lib-download:hover {
  background: var(--primary);
  color: white;
}

.btn-lib-delete {
  font-size: 11px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-lib-delete:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-light);
}

/* -- Brief quality panel -- */
.brief-quality {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--border-light);
}

.quality-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.quality-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.quality-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 24px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
}

.score-good { background: var(--success-light); color: #166534; }
.score-warn { background: #FEF3C7; color: #92400E; }
.score-low { background: var(--error-light); color: #991B1B; }

.quality-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.quality-issues {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quality-issue {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.issue-icon {
  font-weight: 700;
  font-family: monospace;
}

.issue-error .issue-icon { color: var(--error); }
.issue-warning .issue-icon { color: #F59E0B; }
.issue-info .issue-icon { color: var(--primary); }

.issue-hint {
  color: var(--text-muted);
  font-style: italic;
}

/* -- Showcase strip (compact horizontal scroll) -- */
.showcase-strip-wrapper {
  grid-column: 1 / -1;
  margin-bottom: 8px;
}

.library-section-header {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 0 4px;
}

.showcase-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: thin;
}

.showcase-strip::-webkit-scrollbar {
  height: 4px;
}

.showcase-strip::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.showcase-card {
  flex: 0 0 180px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.showcase-card:hover {
  border-color: var(--primary);
}

.showcase-thumb {
  width: 180px;
  height: 101px;
  overflow: hidden;
  background: var(--surface);
}

.showcase-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.showcase-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
}

.showcase-label {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engine-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  color: white;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.library-showcase-link {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  cursor: pointer;
}

.library-showcase-link:hover {
  color: var(--primary);
}

/* -- Utility -- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
