/* ═══════════════════════════════════════════════════════════
   QALEB (قالب) — Styles
   Portal HUD Dark Theme
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-0: #0a0f1a;
  --bg-1: #0f1729;
  --bg-2: #141e33;
  --bg-3: #1a2740;
  --bg-4: #213050;
  --border-1: #1e2d48;
  --border-2: #263a5a;
  --text-1: #e2eaf6;
  --text-2: #9aadcc;
  --text-3: #607a9e;
  --gold: #C9A227;
  --teal: #00d4aa;
  --cyan: #00d4ff;
  --green: #00e88f;
  --red: #ff4d5e;
  --amber: #ffb830;
  --purple: #a78bfa;
  --font: 'DM Sans', sans-serif;
  --font-head: 'Orbitron', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --sidebar-w: 220px;
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text-1);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-1);
  border-right: 1px solid var(--border-1);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 20px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 12px;
}

.brand-icon {
  font-family: 'Noto Kufi Arabic', var(--font);
  font-size: 20px;
  font-weight: 700;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: var(--bg-0);
  border-radius: 10px;
}

.brand-name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-1);
}

.brand-sub {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.brand-text { display: flex; flex-direction: column; gap: 2px; }

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-3);
  padding: 16px 8px 6px;
  text-transform: uppercase;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.nav-btn:hover { background: var(--bg-3); color: var(--text-1); }
.nav-btn.active {
  background: linear-gradient(135deg, rgba(0,212,255,0.12), rgba(0,212,170,0.08));
  color: var(--cyan);
  border: 1px solid rgba(0,212,255,0.2);
}

/* ── Main ── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
#topbar {
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-1);
}

#topTitle {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}

#topSub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-2);
}

.status-badge.connected { color: var(--green); border-color: rgba(0,232,143,0.3); }
.status-badge.disconnected { color: var(--text-3); }
.status-badge.vision { color: var(--purple); border-color: rgba(167,139,250,0.3); }

/* ── Pages ── */
.page {
  display: none;
  padding: 28px 32px;
  flex: 1;
  animation: fadeIn 0.25s ease;
}

.page.show { display: block; }

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

/* ── Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--bg-1);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--cyan);
  background: rgba(0,212,255,0.04);
}

.drop-icon { font-size: 40px; margin-bottom: 12px; }
.drop-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.drop-sub { font-size: 13px; color: var(--text-3); }

/* ── File Cards ── */
.imported-files-list { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }

.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.file-card:hover { border-color: var(--border-2); background: var(--bg-3); }
.file-card.active { border-color: var(--cyan); background: rgba(0,212,255,0.06); }

.file-icon { font-size: 28px; }
.file-info { flex: 1; }
.file-name { font-size: 14px; font-weight: 600; }
.file-meta { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); margin-top: 3px; }

.btn-icon {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-icon:hover { background: var(--bg-4); }

/* File Type Badge */
.file-type-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  margin-left: 6px;
}

.file-type-badge.pptx { background: rgba(0,212,170,0.15); color: var(--teal); border: 1px solid rgba(0,212,170,0.25); }
.file-type-badge.pdf { background: rgba(255,77,94,0.15); color: var(--red); border: 1px solid rgba(255,77,94,0.25); }

/* ── Progress ── */
.parse-progress { margin-top: 20px; }

.progress-bar {
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--teal));
  border-radius: 3px;
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 6px;
}

/* ── Quick Stats ── */
.quick-stats {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-card.wide { grid-column: 1 / -1; }
.stat-card.action-card { display: flex; gap: 12px; justify-content: center; padding: 20px; }

.stat-value {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--cyan);
}

.stat-label {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.capitalize { text-transform: capitalize; }

/* ── Layout Flow ── */
.layout-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.flow-tag {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  font-family: var(--font-mono);
  text-transform: capitalize;
  white-space: nowrap;
}

.flow-tag.sm { font-size: 9px; padding: 2px 6px; }

.flow-tag.title-slide { border-color: var(--gold); color: var(--gold); }
.flow-tag.title-bullets { border-color: var(--teal); color: var(--teal); }
.flow-tag.title-content { border-color: var(--cyan); color: var(--cyan); }
.flow-tag.two-column { border-color: var(--purple); color: var(--purple); }
.flow-tag.title-with-image { border-color: var(--green); color: var(--green); }
.flow-tag.title-image-split { border-color: var(--amber); color: var(--amber); }

.flow-arrow { color: var(--text-3); font-size: 11px; }

/* ── Buttons ── */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: var(--bg-0);
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-accent {
  background: linear-gradient(135deg, var(--gold), #e0b82a);
  color: var(--bg-0);
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border-2);
}

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

.btn-danger {
  background: rgba(255,77,94,0.15);
  color: var(--red);
  border: 1px solid rgba(255,77,94,0.3);
}

.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Analysis Page ── */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.analysis-panel {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.analysis-panel.full-width { grid-column: 1 / -1; }

.panel-title {
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--cyan);
  margin-bottom: 16px;
  text-transform: uppercase;
}

/* Slide Map */
.slide-map {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.slide-thumb {
  position: relative;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  overflow: hidden;
}

.thumb-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  z-index: 2;
}

.thumb-shape {
  position: absolute;
  border-radius: 2px;
  pointer-events: none;
}

.thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10,15,26,0.85);
  font-size: 9px;
  color: var(--text-2);
  padding: 3px 6px;
  text-align: center;
  font-family: var(--font-mono);
}

/* PDF page preview thumbnail */
.slide-thumb.has-preview { overflow: hidden; }

.thumb-preview-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

/* Distribution Bars */
.dist-bars { display: flex; flex-direction: column; gap: 10px; }

.dist-row { display: flex; align-items: center; gap: 10px; }

.dist-label {
  font-size: 12px;
  color: var(--text-2);
  min-width: 140px;
  text-transform: capitalize;
}

.dist-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--teal));
  border-radius: 4px;
  transition: width 0.5s;
}

.dist-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  min-width: 60px;
  text-align: right;
}

/* Color Palette */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
}

.color-swatch { text-align: center; }

.swatch-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 6px;
  border: 2px solid var(--border-2);
}

.swatch-label { font-size: 10px; color: var(--text-3); }
.swatch-hex { font-size: 9px; color: var(--text-3); font-family: var(--font-mono); }

/* Font List */
.font-list { display: flex; flex-direction: column; gap: 12px; }

.font-item {
  padding: 10px;
  background: var(--bg-2);
  border-radius: 6px;
}

.font-preview { font-size: 18px; margin-bottom: 4px; color: var(--text-1); }
.font-role { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); }

.size-summary {
  display: flex;
  gap: 20px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-1);
}

.size-item { font-size: 12px; color: var(--text-2); }
.size-val { font-family: var(--font-head); font-size: 16px; color: var(--cyan); margin-right: 4px; }

/* Content Stats */
.content-stats { display: flex; flex-direction: column; gap: 10px; }

.cs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-1);
  font-size: 13px;
  color: var(--text-2);
}

.cs-val {
  font-family: var(--font-mono);
  color: var(--text-1);
  font-weight: 600;
}

/* Image Grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.image-thumb {
  background: var(--bg-2);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-1);
}

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

.image-caption {
  padding: 4px 6px;
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* Slide Details */
.slide-details-list { display: flex; flex-direction: column; gap: 8px; }

.slide-detail {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
}

.slide-detail summary {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  list-style: none;
}

.slide-detail summary::-webkit-details-marker { display: none; }
.slide-detail[open] summary { border-bottom: 1px solid var(--border-1); }

.sd-num { font-family: var(--font-head); font-size: 11px; color: var(--cyan); min-width: 60px; }
.sd-layout { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--bg-3); }
.sd-meta { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); margin-left: auto; }

.sd-body { padding: 14px 16px; }

.sd-section { margin-bottom: 12px; }
.sd-section strong { font-size: 12px; color: var(--text-2); display: block; margin-bottom: 6px; }
.sd-text { font-size: 12px; color: var(--text-3); line-height: 1.6; }

.shape-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}

.shape-type { color: var(--text-2); }
.shape-pos { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }

/* ── AI Feedback ── */
.ai-response-container {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ai-header {
  padding: 14px 20px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-1);
}

.ai-badge {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--teal);
}

.ai-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-mode-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 12px;
}

.ai-mode-badge.vision { background: rgba(167,139,250,0.15); color: var(--purple); border: 1px solid rgba(167,139,250,0.3); }
.ai-mode-badge.text { background: rgba(0,212,170,0.12); color: var(--teal); border: 1px solid rgba(0,212,170,0.25); }

.ai-model {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.ai-body {
  padding: 24px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  max-height: 70vh;
  overflow-y: auto;
}

.ai-body h3.md-h2 {
  font-family: var(--font-head);
  font-size: 13px;
  color: var(--cyan);
  margin: 24px 0 10px;
  letter-spacing: 0.5px;
}

.ai-body h4.md-h3 {
  font-size: 14px;
  color: var(--text-1);
  margin: 16px 0 8px;
}

.ai-body strong { color: var(--text-1); }
.ai-body ul { padding-left: 20px; margin: 8px 0; }
.ai-body li { margin: 4px 0; }

.ai-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--border-1);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-3);
  font-size: 14px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse 1.2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.ai-error {
  padding: 20px;
  background: rgba(255,77,94,0.08);
  border: 1px solid rgba(255,77,94,0.2);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
}

/* ── Run Analysis Prompt ── */
.run-analysis-prompt {
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
}

.rap-icon { font-size: 48px; margin-bottom: 16px; }
.run-analysis-prompt h3 { font-family: var(--font-head); font-size: 18px; margin-bottom: 10px; }
.run-analysis-prompt p { color: var(--text-3); font-size: 14px; margin-bottom: 20px; }
.rap-hint { font-size: 12px; color: var(--text-3); margin-top: 12px; }

/* ── Generator ── */
.generator-controls {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.gen-ref-info { margin-bottom: 20px; }
.gen-ref-info h3 { font-size: 15px; margin-bottom: 4px; }
.gen-ref-info p { font-size: 12px; color: var(--text-3); font-family: var(--font-mono); }

.gen-input-group { margin-bottom: 16px; }
.gen-input-group label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }

.gen-options { display: flex; gap: 24px; margin-bottom: 20px; }
.gen-opt { display: flex; align-items: center; gap: 10px; font-size: 13px; }

/* Generated Outline */
.generated-outline {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.go-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-1);
}

.go-header h3 { font-size: 15px; margin-bottom: 4px; }
.go-header p { font-size: 12px; color: var(--text-3); }

.go-slides { padding: 16px 24px; display: flex; flex-direction: column; gap: 12px; }

.go-slide {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--bg-2);
  border-radius: var(--radius);
  border: 1px solid var(--border-1);
}

.go-slide-num {
  font-family: var(--font-head);
  font-size: 18px;
  color: var(--cyan);
  min-width: 36px;
  text-align: center;
  padding-top: 2px;
}

.go-slide-content { flex: 1; }
.go-slide-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.go-slide-sub { font-size: 12px; color: var(--teal); margin-bottom: 6px; }
.go-slide-layout { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); margin-bottom: 6px; }

.go-bullets { padding-left: 18px; font-size: 12px; color: var(--text-2); }
.go-bullets li { margin: 3px 0; }

.go-body { font-size: 12px; color: var(--text-2); line-height: 1.5; }

.go-image-note {
  font-size: 11px;
  color: var(--amber);
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(255,184,48,0.08);
  border-radius: 4px;
  display: inline-block;
}

.go-notes {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  font-style: italic;
}

.go-actions {
  padding: 20px 24px;
  border-top: 1px solid var(--border-1);
  display: flex;
  gap: 12px;
}

/* ── Library ── */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.library-card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.lc-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.lc-header h4 { font-size: 14px; }
.lc-date { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); }

.lc-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}

.lc-layouts { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }

.lc-actions { display: flex; gap: 8px; }

/* ── Settings ── */
.settings-panel { max-width: 680px; }

.settings-section {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.settings-section h3 { font-size: 14px; margin-bottom: 16px; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.setting-row label { font-size: 13px; color: var(--text-2); }
.hint { font-size: 10px; color: var(--text-3); }

.setting-input {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  color: var(--text-1);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  width: 320px;
}

.setting-input.large { width: 100%; margin-top: 4px; }
.setting-input.small { width: 100px; }

.setting-input:focus { outline: none; border-color: var(--cyan); }

.setting-range { width: 200px; accent-color: var(--cyan); }

.range-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  min-width: 30px;
}

/* Toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-3);
  border-radius: 22px;
  transition: 0.3s;
  border: 1px solid var(--border-2);
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: var(--text-3);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider { background: rgba(0,212,255,0.2); border-color: var(--cyan); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); background: var(--cyan); }

.conn-result { margin-top: 12px; font-size: 13px; }
.conn-result .connected { color: var(--green); }
.conn-result .error { color: var(--red); }
.conn-result .connecting { color: var(--amber); }

/* Connection Result Cards */
.conn-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.conn-result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.conn-result-card:hover { filter: brightness(1.1); }
.conn-result-card.vision {
  background: rgba(167,139,250,0.06);
  border: 1px solid rgba(167,139,250,0.2);
}
.conn-result-card.text {
  background: rgba(0,232,143,0.04);
  border: 1px solid rgba(0,232,143,0.15);
}
.conn-result-card.error {
  background: rgba(255,77,94,0.04);
  border: 1px solid rgba(255,77,94,0.15);
}
.conn-result-card.active {
  border-width: 2px;
}
.conn-result-card.active.vision { border-color: var(--purple); }
.conn-result-card.active.text { border-color: var(--green); }

.crc-icon { font-size: 24px; flex-shrink: 0; }
.crc-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.crc-info strong { font-family: var(--font-mono); font-size: 12px; color: var(--text-0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crc-type {
  display: inline-block;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 1.5px;
  padding: 2px 10px;
  border-radius: 4px;
  width: fit-content;
}
.crc-type.vision { background: rgba(167,139,250,0.2); color: var(--purple); border: 1px solid rgba(167,139,250,0.3); }
.crc-type.text { background: rgba(0,232,143,0.15); color: var(--green); border: 1px solid rgba(0,232,143,0.25); }
.crc-type.error { background: rgba(255,77,94,0.15); color: var(--red); border: 1px solid rgba(255,77,94,0.25); }
.crc-note { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.crc-active {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  color: var(--cyan);
}

.conn-summary {
  font-size: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 8px;
}
.conn-summary.good { background: rgba(0,232,143,0.06); color: var(--green); border: 1px solid rgba(0,232,143,0.15); }
.conn-summary.warn { background: rgba(255,180,0,0.06); color: var(--amber); border: 1px solid rgba(255,180,0,0.15); }

/* Settings hints & vision recommendation box */
.settings-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 16px;
  line-height: 1.5;
}

.vision-rec-box {
  margin-top: 18px;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
}

.vision-rec-box h4 {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
}

.rec-models { display: flex; flex-direction: column; gap: 8px; }

.rec-model {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-3);
  border-radius: 6px;
  font-size: 12px;
}

.rec-model strong { color: var(--text-1); }
.rec-model span { color: var(--text-3); font-size: 11px; font-family: var(--font-mono); }

/* Analysis mode info on feedback page */
.rap-mode-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  justify-content: center;
}

.rap-detail {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* Select dropdown styling */
select.setting-input {
  width: 200px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23607a9e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

select.setting-input option {
  background: var(--bg-2);
  color: var(--text-1);
}

.model-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.model-input-row .setting-input { flex: 1; }
.btn-sm { padding: 6px 12px; font-size: 11px; white-space: nowrap; }

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-text { font-size: 14px; color: var(--text-3); max-width: 400px; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  max-width: 400px;
}

.toast.show { opacity: 1; transform: translateY(0); }

.toast-success { background: rgba(0,232,143,0.15); color: var(--green); border: 1px solid rgba(0,232,143,0.3); }
.toast-error { background: rgba(255,77,94,0.15); color: var(--red); border: 1px solid rgba(255,77,94,0.3); }
.toast-info { background: rgba(0,212,255,0.15); color: var(--cyan); border: 1px solid rgba(0,212,255,0.3); }

/* ═══════════════════════════════════════
   DUAL-PHASE PIPELINE UI
   ═══════════════════════════════════════ */

/* Phase Divider */
.phase-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px 0 20px;
  color: var(--text-3);
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.phase-divider::before, .phase-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-1), transparent);
}

/* Phase Headers (inline in results) */
.phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-head);
  letter-spacing: 0.5px;
}
.phase-header.phase-done { background: rgba(0,232,143,0.08); border: 1px solid rgba(0,232,143,0.2); color: var(--green); }
.phase-header.phase-running { background: rgba(0,180,255,0.08); border: 1px solid rgba(0,180,255,0.2); color: var(--blue); }
.phase-header.phase-error { background: rgba(255,77,94,0.08); border: 1px solid rgba(255,77,94,0.2); color: var(--red); }
.phase-model { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

.pulse-dot-inline {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue);
  animation: pulse 1.2s infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* Dual-Phase Launcher */
.dual-phase-launcher {
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 0;
}
.dual-phase-launcher h2 {
  font-family: var(--font-head);
  font-size: 22px;
  color: var(--text-0);
  margin-bottom: 6px;
}
.dpl-sub {
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 28px;
}

/* Phase Cards */
.phase-cards {
  display: flex;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 28px;
}
.phase-arrow {
  display: flex;
  align-items: center;
  font-size: 28px;
  color: var(--text-3);
  font-family: var(--font-mono);
  padding: 0 4px;
}
.phase-card {
  flex: 1;
  display: flex;
  gap: 14px;
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  transition: border-color 0.3s;
}
.phase-card:hover { border-color: var(--border-2); }
.phase-card.disabled { opacity: 0.5; }

.pc-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--bg-0);
  flex-shrink: 0;
}

.pc-body { flex: 1; }
.pc-body h3 { font-size: 15px; margin-bottom: 8px; color: var(--text-0); }
.pc-body p { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-bottom: 10px; }

.pc-req {
  font-size: 11px;
  color: var(--text-3);
  padding: 6px 10px;
  background: var(--bg-1);
  border-radius: 6px;
  margin-bottom: 8px;
}
.pc-req strong { color: var(--amber); }

.pc-stats {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: 12px;
}

.pc-status { margin-bottom: 10px; min-height: 22px; }
.pc-running { color: var(--blue); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.pc-done { color: var(--green); font-size: 12px; }
.pc-error { color: var(--red); font-size: 12px; }

.pc-btn { width: 100%; }

/* Workflow Steps */
.dpl-workflow {
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.dpl-workflow h4 { font-size: 13px; color: var(--text-1); margin-bottom: 14px; }

.wf-steps { display: flex; flex-direction: column; gap: 10px; }
.wf-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
}
.wf-n {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-family: var(--font-head);
  color: var(--text-1);
  flex-shrink: 0;
}

.dpl-quick {
  text-align: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-0);
}
.dpl-quick p { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }

/* Swap-Model Prompt */
.swap-prompt {
  text-align: center;
  padding: 40px 32px;
  margin-top: 20px;
  background: var(--bg-1);
  border: 2px solid rgba(255,180,0,0.25);
  border-radius: var(--radius-lg);
}
.swap-icon { font-size: 48px; margin-bottom: 12px; }
.swap-prompt h3 { font-family: var(--font-head); font-size: 18px; color: var(--amber); margin-bottom: 12px; }
.swap-prompt p { color: var(--text-2); font-size: 13px; margin-bottom: 8px; line-height: 1.6; }
.swap-current { color: var(--text-0); font-family: var(--font-mono); }
.swap-text-badge {
  font-size: 9px; padding: 2px 8px; border-radius: 4px; letter-spacing: 1px;
  background: rgba(255,77,94,0.15); color: var(--red); border: 1px solid rgba(255,77,94,0.3);
  font-family: var(--font-mono); vertical-align: middle; margin-left: 6px;
}
.swap-steps {
  display: flex; flex-direction: column; gap: 10px;
  text-align: left; max-width: 400px; margin: 20px auto;
}
.swap-step {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--text-2);
}
.swap-models {
  margin: 20px 0;
  font-size: 12px; color: var(--text-3);
}
.swap-model {
  display: inline-block; margin: 4px;
  padding: 4px 12px; border-radius: 20px;
  background: rgba(0,180,255,0.1); border: 1px solid rgba(0,180,255,0.2);
  color: var(--blue); font-family: var(--font-mono); font-size: 11px;
}
.swap-prompt .btn { margin: 6px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  #sidebar { width: 60px; padding: 12px 6px; }
  .brand-text, .nav-section-label { display: none; }
  .nav-btn { justify-content: center; padding: 10px; font-size: 16px; }
  #main { margin-left: 60px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .quick-stats { grid-template-columns: repeat(3, 1fr); }
  .phase-cards { flex-direction: column; }
  .phase-arrow { transform: rotate(90deg); align-self: center; }
}
