/* ─── AI Influencer Ideation Pipeline — Premium Dark Theme ─── */

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

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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent-1: #a855f7;
  --accent-2: #ec4899;
  --accent-3: #3b82f6;
  --gradient-main: linear-gradient(135deg, #a855f7, #ec4899, #f97316);
  --gradient-subtle: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(236,72,153,0.15));
  --shadow-glow: 0 0 40px rgba(168, 85, 247, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Background Glow ─── */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(168,85,247,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(236,72,153,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Header ─── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.session-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  background: var(--bg-card);
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ─── Step Navigation ─── */
.step-nav {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 99;
}

.step-tab {
  flex: 1;
  padding: 1rem 0.5rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.step-tab .step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  transition: var(--transition);
}

.step-tab:hover { color: var(--text-secondary); }
.step-tab.active { color: var(--text-primary); }

.step-tab.active .step-num {
  background: var(--gradient-main);
  border-color: transparent;
  color: white;
}

.step-tab.completed .step-num {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.step-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  transition: var(--transition);
}

.step-tab.active::after {
  background: var(--gradient-main);
}

/* ─── Main Content ─── */
.main-content {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 1.25rem;
}

/* Hide ugly scrollbar, show thin one on hover */
.main-content::-webkit-scrollbar {
  width: 6px;
}
.main-content::-webkit-scrollbar-track {
  background: transparent;
}
.main-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
}
.main-content:hover::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
}
.main-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.step-panel {
  display: none;
  animation: fadeIn 0.4s ease;
}
.step-panel.active { display: block; }

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

/* ─── Glass Cards ─── */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}
.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.card + .card { margin-top: 1.5rem; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-main);
  color: white;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px rgba(168, 85, 247, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 0.8rem;
}
.btn-ghost:hover { color: var(--text-primary); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}
.btn.loading .spinner { display: block; }
.btn.loading .btn-text { opacity: 0.5; }

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

/* ─── Form Controls ─── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}
.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

select.form-control option {
  background: #1a1a2e;
  color: #f0f0f5;
  padding: 0.5rem;
}

.inline-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: end;
}
.inline-controls .form-group { flex: 1; min-width: 120px; }

/* ─── Tags Input ─── */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  align-items: center;
  cursor: text;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: var(--gradient-subtle);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--accent-1);
  font-weight: 500;
}
.tag .remove-tag {
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.9rem;
}
.tag .remove-tag:hover { opacity: 1; }

.tags-input input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  flex: 1;
  min-width: 100px;
}

/* ─── Niche Cards Grid ─── */
.niche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.niche-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.niche-card:hover {
  border-color: var(--accent-1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.niche-card.selected {
  border-color: var(--accent-1);
  background: var(--gradient-subtle);
  box-shadow: var(--shadow-glow);
}

.niche-card .niche-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.niche-card .viral-score {
  font-size: 0.75rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.niche-card .niche-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.niche-card .niche-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.niche-card .meta-tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  color: var(--text-muted);
}

/* ─── Profile Display ─── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.profile-field {
  padding: 0.8rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.profile-field .field-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.profile-field .field-value {
  font-size: 0.9rem;
  color: var(--text-primary);
}
.profile-field.full-width { grid-column: 1 / -1; }

.prompt-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

/* ─── Face Gallery ─── */
.face-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.face-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.face-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.face-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

.face-card .face-info {
  padding: 0.8rem;
}
.face-card .face-status {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-variations {
  display: block;
  width: calc(100% - 1rem);
  margin: 0 0.5rem 0.3rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  color: white;
  transition: all 0.2s ease;
  opacity: 0.85;
}
.btn-variations:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

.face-card .face-loading {
  width: 100%;
  height: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(110deg, var(--bg-card) 8%, rgba(139, 92, 246, 0.08) 18%, var(--bg-card) 33%);
  background-size: 200% 100%;
  animation: shine 1.5s linear infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}

@keyframes shine {
  to { background-position-x: -200%; }
}

.face-card .face-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius);
  pointer-events: none;
}

.face-card .face-loading .pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-main);
  animation: pulse-glow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
}

.face-card .face-loading span {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.4);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(0.85); opacity: 0.6; box-shadow: 0 0 10px rgba(139, 92, 246, 0.3); }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 25px rgba(139, 92, 246, 0.8); }
}

.face-card.failed {
  border-color: rgba(239, 68, 68, 0.3);
}

/* ─── QC Scores ─── */
.qc-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: var(--transition);
}

.qc-scores {
  display: flex;
  gap: 0.8rem;
  margin: 0.8rem 0;
  flex-wrap: wrap;
}

.score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  min-width: 70px;
}
.score-badge .score-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.score-badge .score-value {
  font-size: 1.2rem;
  font-weight: 700;
}
.score-badge .score-value.high { color: #22c55e; }
.score-badge .score-value.mid { color: #eab308; }
.score-badge .score-value.low { color: #ef4444; }

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.verdict-badge.approved { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.verdict-badge.fixable { background: rgba(234, 179, 8, 0.15); color: #eab308; border: 1px solid rgba(234, 179, 8, 0.3); }
.verdict-badge.rejected { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

.feedback-list { margin-top: 0.8rem; }
.feedback-list li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.3rem 0;
  padding-left: 1.2rem;
  position: relative;
  line-height: 1.4;
}
.feedback-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.feedback-list.issues li::before { background: #ef4444; }
.feedback-list.strengths li::before { background: #22c55e; }
.feedback-list.improvements li::before { background: var(--accent-1); }

/* ─── Upload Zone ─── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent-1);
  background: var(--gradient-subtle);
}
.upload-zone .upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.upload-zone .upload-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.upload-zone .upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.ref-thumbs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.ref-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ref-thumb:hover {
  transform: translateY(-2px);
  border-color: var(--accent-1);
}
.ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--radius-xs) - 1px);
}
.ref-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  transform: scale(0.8);
}
.ref-thumb:hover .ref-remove {
  opacity: 1;
  transform: scale(1);
}
.ref-remove:hover {
  background: #ef4444;
  transform: scale(1.1) !important;
}

/* ─── Report ─── */
.report-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-height: 600px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

/* ─── Progress Bar ─── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-bar .progress-fill {
  height: 100%;
  background: var(--gradient-main);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ─── Status Messages ─── */
.status-msg {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin: 1rem 0;
}
.status-msg.info { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.2); color: var(--accent-3); }
.status-msg.success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.2); color: #22c55e; }
.status-msg.error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: #ef4444; }

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

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .niche-grid { grid-template-columns: 1fr; }
  .face-gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .profile-grid { grid-template-columns: 1fr; }
  .inline-controls { flex-direction: column; }
  .step-tab .step-label { display: none; }
  .attr-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Face Design: Attribute Grid ─── */
.attr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}
.attr-grid .form-group {
  margin-bottom: 0;
}
.attr-grid .form-group label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.attr-grid .form-control {
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
}

/* ─── Prompt Block ─── */
.prompt-block {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── Upload Zone ─── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.02);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.05);
}
.upload-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.upload-text { font-size: 0.82rem; color: var(--text-secondary); }
.upload-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ─── Ghost Button ─── */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.2s;
}
.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* ─── Face Iteration Thread ─── */
.face-thread {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}
.face-thread-history {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}
.thread-item {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  padding: 0.3rem;
  border-radius: 6px;
  font-size: 0.72rem;
}
.thread-item.prompt-msg {
  background: rgba(139, 92, 246, 0.08);
  color: var(--text-secondary);
}
.thread-item.result-msg {
  background: rgba(34, 197, 94, 0.08);
}
.thread-item img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.thread-input {
  display: flex;
  gap: 0.3rem;
}
.thread-input textarea {
  flex: 1;
  resize: none;
  min-height: 32px;
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
}
.thread-input button {
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.thread-input button:hover {
  background: var(--primary-hover);
}
.face-card {
  position: relative;
  min-height: 180px;
}
.face-card.with-thread {
  min-height: auto;
}

/* Face Selection */
.face-select-overlay {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
  cursor: pointer;
}
.face-checkbox {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: transparent;
  transition: all 0.15s ease;
  backdrop-filter: blur(4px);
}
.face-card:hover .face-checkbox {
  border-color: rgba(255,255,255,0.8);
}
.face-card.selected .face-checkbox {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
}
.face-card.selected {
  outline: 2px solid #22c55e;
  outline-offset: -2px;
  border-radius: 12px;
}
.face-card.selected img {
  opacity: 0.92;
}

/* Prompt Preview Click */
.prompt-preview-click {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
  overflow: hidden;
}
.prompt-preview-click:hover {
  border-color: var(--primary);
}
.prompt-preview-text {
  flex: 1;
  font-size: 0.68rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prompt-edit-icon {
  flex-shrink: 0;
  font-size: 0.7rem;
}

/* Prompt Editor Modal */
.prompt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.prompt-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.prompt-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.prompt-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}
.prompt-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
.prompt-modal-close:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.prompt-modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

/* Custom dropdown input */
.custom-dropdown-input {
  font-size: 0.8rem !important;
  padding: 0.3rem 0.5rem !important;
  border: 1px dashed var(--accent-1) !important;
  background: rgba(168, 85, 247, 0.05) !important;
}

/* ─── Auth Overlay ─── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 90%;
  max-width: 400px;
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 80px rgba(0,0,0,0.6);
}
.auth-logo {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.5rem;
}
.auth-title {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.auth-subtitle {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}
.auth-toggle {
  text-align: center;
  margin-top: 1.2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.auth-toggle .btn-ghost {
  color: var(--accent-1);
  text-decoration: underline;
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-family: inherit;
}
.btn-google:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── App Shell — 3-Column Layout ─── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  transition: all 0.25s ease;
}
.center-content .main-content {
  flex: 1;
  overflow-y: auto;
}
.center-content .app-header {
  position: sticky;
  top: 0;
  z-index: 20;
}
.center-content .step-nav {
  position: sticky;
  top: 0;
  z-index: 19;
}

/* ─── Sidebars ─── */
.sidebar {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.25s, margin-right 0.25s, opacity 0.25s;
}
.sidebar-right {
  border-right: none;
  border-left: 1px solid var(--border);
  width: 240px;
  min-width: 240px;
  max-width: 240px;
}
.sidebar.collapsed-left {
  margin-left: -220px;
  opacity: 0;
  pointer-events: none;
}
.sidebar.collapsed-right {
  margin-right: -240px;
  opacity: 0;
  pointer-events: none;
}
.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-footer {
  margin-top: auto;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
}
.sidebar-footer-btn {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.sidebar-footer-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.sidebar-toggle {
  font-size: 1.1rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
}
.sidebar-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 0.8rem 1rem 0.3rem;
}
.sidebar-new-btn {
  margin: 0.8rem 1rem;
  width: calc(100% - 2rem);
  justify-content: center;
  font-size: 0.82rem;
}

/* User profile in sidebar */
.user-profile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}
.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.user-email {
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

/* Session list */
.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.3rem 0.6rem;
}
.session-list-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.session-card {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 0.2rem;
  position: relative;
}
.session-card:hover {
  background: rgba(255,255,255,0.05);
}
.session-card.active {
  background: rgba(168, 85, 247, 0.1);
  border-left: 3px solid var(--accent-1);
}
.session-card-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-card-date {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.session-card-status {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
}
.session-card-status.draft { background: rgba(245,158,11,0.15); color: #f59e0b; }
.session-card-status.complete { background: rgba(34,197,94,0.15); color: #22c55e; }
.session-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  display: none;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
.session-card:hover .session-delete { display: block; }
.session-delete:hover { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Deliverables / right sidebar */
.deliverables-list, .saved-reports-list {
  padding: 0.3rem 0.6rem;
}
.deliverable-card {
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  margin-bottom: 0.3rem;
  cursor: pointer;
  transition: background 0.15s;
}
.deliverable-card:hover {
  background: rgba(255,255,255,0.06);
}
.deliverable-title {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
}
.deliverable-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1100px) {
  .sidebar-right { margin-right: -300px; opacity: 0; pointer-events: none; }
}
@media (max-width: 900px) {
  .sidebar-left { margin-left: -280px; opacity: 0; pointer-events: none; }
}

/* ─── Image Lightbox ─── */
.lightbox-modal {
  display: none; position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.92); backdrop-filter: blur(10px);
  justify-content: center; align-items: center; flex-direction: column;
}
.lightbox-modal.active { display: flex; }
.lightbox-image {
  max-width: 90vw; max-height: 85vh; object-fit: contain;
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: lightboxIn 0.2s ease;
}
@keyframes lightboxIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lightbox-close {
  position: absolute; top: 20px; right: 30px;
  background: none; border: none; color: #fff; font-size: 2.5rem;
  cursor: pointer; z-index: 10001; line-height: 1;
  transition: transform 0.2s, color 0.2s;
}
.lightbox-close:hover { transform: scale(1.2); color: #f87171; }
.lightbox-caption {
  margin-top: 1rem; color: rgba(255,255,255,0.7); font-size: 0.85rem;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  font-size: 3rem; cursor: pointer; padding: 0.5rem 1rem;
  border-radius: 8px; line-height: 1; z-index: 10001;
  transition: background 0.2s, transform 0.2s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ─── Topic Autosuggestions ─── */
.suggestions-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: rgba(20, 16, 32, 0.98); backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: 10px;
  max-height: 250px; overflow-y: auto; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.suggestion-item {
  padding: 0.55rem 0.8rem; cursor: pointer; font-size: 0.82rem;
  color: var(--text-secondary); transition: background 0.15s, color 0.15s;
}
.suggestion-item:hover { background: var(--accent-primary); color: #fff; }
.suggestion-item:first-child { border-radius: 10px 10px 0 0; }
.suggestion-item:last-child { border-radius: 0 0 10px 10px; }

/* ─── Session Favorites & Rename ─── */
.session-card-header {
  display: flex; justify-content: space-between; align-items: center;
}
.session-fav {
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  color: var(--text-muted); padding: 0; line-height: 1;
  transition: color 0.2s, transform 0.2s;
}
.session-fav:hover { transform: scale(1.2); }
.session-fav.favorited { color: #fbbf24; }
.session-rename-input {
  width: 100%; font-size: 0.78rem; padding: 0.2rem 0.4rem;
  background: var(--bg-primary); border: 1px solid var(--accent-primary);
  border-radius: 4px; color: var(--text-primary); outline: none;
}

/* ─── LoRa Selection Grids ─── */
.lora-selection-grid {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.5rem; background: var(--bg-secondary); border-radius: 10px;
  min-height: 60px; align-items: center;
}
.lora-thumb {
  width: 80px; height: 80px; border-radius: 8px; overflow: hidden;
  border: 2px solid var(--border-color); cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.lora-thumb:hover { border-color: var(--accent-primary); transform: scale(1.05); }
.lora-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ─── Niche Context Banner ─── */
.niche-context-banner {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 8px; padding: 0.6rem 1rem; margin-bottom: 1rem;
}
