/* ===== CSS Variables & Color System ===== */
:root {
  --primary: #0066ff;
  --primary-dark: #0052cc;
  --primary-light: #3d8bff;
  --primary-50: #e6f0ff;
  --primary-100: #cce0ff;

  --secondary: #0a1628;
  --secondary-light: #1a2b45;

  --accent: #00b8d4;

  --success: #16a34a;
  --success-light: #22c55e;
  --success-50: #dcfce7;

  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --warning-50: #fef3c7;

  --error: #ff4747;
  --error-dark: #dc2626;
  --error-50: #fee2e2;

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

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-dark: #0a1628;
  --text: #1e293b;
  --text-light: #64748b;
  --text-inverse: #ffffff;
  --border: #e2e8f0;
  --border-dark: #1e293b;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --shadow-xl: 0 24px 48px rgba(0,0,0,0.16);

  --font-en: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-ar: 'Cairo', 'Inter', sans-serif;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-en);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html[lang="ar"] body { font-family: var(--font-ar); }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--neutral-200); color: var(--text); }
.btn-secondary:hover { background: var(--neutral-300); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--neutral-100); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: var(--error-dark); }
.btn-ai { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; }
.btn-ai:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,102,255,0.3); }
.btn-large { padding: 14px 32px; font-size: 1.0625rem; }
.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Header ===== */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; color: var(--primary); flex-shrink: 0; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text h1 { font-size: 1.25rem; font-weight: 800; color: var(--neutral-900); }
.brand-text p { font-size: 0.8125rem; color: var(--text-light); }

/* ===== Language Switcher ===== */
.lang-switcher { display: flex; gap: 4px; flex-wrap: wrap; }
.lang-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  transition: all var(--transition);
  opacity: 0.5;
}
.lang-btn:hover { background: var(--neutral-100); opacity: 1; }
.lang-btn.active { background: var(--primary-50); opacity: 1; }

/* ===== Hero Search ===== */
.hero-search {
  background: linear-gradient(135deg, var(--secondary) 0%, #102a4c 50%, var(--primary-dark) 100%);
  padding: 80px 24px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-search::before {
  content: '';
  position: absolute;
  top: -50%; left: -10%;
  width: 60%; height: 200%;
  background: radial-gradient(ellipse, rgba(0,102,255,0.15) 0%, transparent 60%);
  animation: float 20s ease-in-out infinite;
}
.hero-search::after {
  content: '';
  position: absolute;
  bottom: -30%; right: -10%;
  width: 50%; height: 150%;
  background: radial-gradient(ellipse, rgba(0,184,212,0.12) 0%, transparent 60%);
  animation: float 25s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}
.hero-inner { max-width: 720px; margin: 0 auto; position: relative; z-index: 1; }
.hero-title { color: white; font-size: 2.5rem; font-weight: 800; margin-bottom: 12px; }
.hero-subtitle { color: rgba(255,255,255,0.7); font-size: 1.0625rem; margin-bottom: 32px; }

.search-form {
  display: flex;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}
.search-input-wrap {
  position: relative;
  flex: 1;
}
.search-icon {
  position: absolute;
  top: 50%; left: 16px;
  transform: translateY(-50%);
  color: var(--neutral-400);
  pointer-events: none;
}
html[dir="rtl"] .search-icon { left: auto; right: 16px; }
#coinInput {
  width: 100%;
  padding: 16px 16px 16px 48px;
  font-size: 1.0625rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
}
html[dir="rtl"] #coinInput { padding: 16px 48px 16px 16px; }
#coinInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-50);
}
.popular-tags {
  margin-top: 20px;
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem;
}

/* ===== Autocomplete ===== */
.autocomplete {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 50;
}
.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--neutral-100);
}
.autocomplete-item:hover { background: var(--primary-50); }
.autocomplete-item:last-child { border-bottom: none; }

/* ===== Main Content ===== */
.main-content { max-width: 1280px; margin: 0 auto; padding: 40px 24px; }
.content-layout { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
@media (max-width: 900px) { .content-layout { grid-template-columns: 1fr; } }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-head h2 { font-size: 1.5rem; font-weight: 700; color: var(--neutral-900); }
.articles-count {
  background: var(--primary-50);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
}

/* ===== Articles Grid ===== */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-100);
}
.card-link { display: block; }
.card-image {
  height: 160px;
  background: var(--neutral-100);
  overflow: hidden;
}
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-size: 2.5rem;
  font-weight: 800;
}
.card-body { padding: 16px; }
.card-body h3 { font-size: 1.125rem; font-weight: 700; color: var(--neutral-900); margin-bottom: 8px; }
.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--neutral-400);
}
.empty-state p { margin-top: 16px; font-size: 1.0625rem; }

/* ===== Sidebar ===== */
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.sidebar-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--neutral-900); }
.popular-list { list-style: none; }
.popular-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--neutral-100);
}
.popular-list li:last-child { border-bottom: none; }
.rank {
  width: 24px; height: 24px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.popular-list a { flex: 1; font-weight: 600; }
.count { font-size: 0.8125rem; color: var(--text-light); }
.sidebar-empty { color: var(--neutral-400); }

/* ===== Footer ===== */
.site-footer {
  background: var(--neutral-900);
  color: var(--neutral-400);
  padding: 32px 24px;
  text-align: center;
  margin-top: 60px;
}
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-inner a { color: var(--neutral-300); }

/* ===== Analyzing Overlay ===== */
.analyzing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.analyzing-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  text-align: center;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-xl);
}
.analyzing-spinner {
  width: 56px; height: 56px;
  border: 4px solid var(--primary-50);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.analyzing-card h3 { font-size: 1.375rem; font-weight: 700; margin-bottom: 8px; color: var(--neutral-900); }
.analyzing-card p { color: var(--text-light); margin-bottom: 24px; }
.progress-steps { text-align: start; }
.progress-steps .step {
  padding: 8px 0;
  color: var(--neutral-400);
  font-size: 0.875rem;
  transition: color var(--transition);
}
.progress-steps .step.active { color: var(--primary); font-weight: 600; }
.progress-steps .step.done { color: var(--success); }
.progress-steps .step.done::before { content: '\2713 '; }

.analyzing-page .analyzing-overlay { display: flex; position: relative; background: var(--bg); }

/* ===== Article Page ===== */
.article-header {
  background: linear-gradient(135deg, var(--secondary), var(--primary-dark));
  color: white;
  padding: 40px 24px;
}
.article-header-inner { max-width: 800px; margin: 0 auto; }
.back-home { color: rgba(255,255,255,0.8); font-size: 0.875rem; display: inline-block; margin-bottom: 16px; }
.back-home:hover { color: white; }
.article-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.article-meta { color: rgba(255,255,255,0.7); font-size: 0.875rem; }

.article-main { max-width: 800px; margin: 0 auto; padding: 40px 24px; }
.article-content { background: var(--bg-card); border-radius: var(--radius-lg); padding: 40px; box-shadow: var(--shadow); }
.article-section { margin-bottom: 40px; }
.article-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--neutral-900);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-50);
}
.article-section h3 { font-size: 1.125rem; font-weight: 600; color: var(--neutral-800); margin: 20px 0 10px; }
.article-section p { margin-bottom: 14px; color: var(--neutral-700); line-height: 1.8; }
.article-section ul, .article-section ol { margin: 12px 0 16px; padding-inline-start: 24px; }
.article-section li { margin-bottom: 6px; color: var(--neutral-700); }
.article-section table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.article-section th, .article-section td { padding: 12px 16px; text-align: start; border-bottom: 1px solid var(--border); }
.article-section th { background: var(--neutral-50); font-weight: 600; }
.article-section strong { color: var(--neutral-900); }
.article-section a { color: var(--primary); text-decoration: underline; word-break: break-word; overflow-wrap: anywhere; }
.article-section ul, .article-section ol { margin: 12px 0 16px; padding-inline-start: 24px; }
.article-section li { margin-bottom: 6px; color: var(--neutral-700); word-break: break-word; overflow-wrap: anywhere; }

.hero-chart { margin-bottom: 32px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-chart img { width: 100%; }

.chart-gallery { margin: 32px 0; }
.chart-gallery h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.chart-figure { margin: 0; }
.chart-figure img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.chart-figure figcaption { text-align: center; padding: 8px; color: var(--text-light); font-size: 0.875rem; font-weight: 600; }

.sources-section { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.sources-section h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 12px; }
.sources-list { list-style: none; }
.sources-list li { padding: 6px 0; word-break: break-word; overflow-wrap: anywhere; }
.sources-list a { font-size: 0.875rem; word-break: break-all; overflow-wrap: anywhere; }

.article-footer { text-align: center; padding: 24px; color: var(--text-light); font-size: 0.8125rem; }

/* ===== Error Page ===== */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.error-container { text-align: center; }
.error-code { font-size: 6rem; font-weight: 900; color: var(--primary); }
.error-container h1 { font-size: 1.5rem; margin: 16px 0 8px; }
.error-container p { color: var(--text-light); margin-bottom: 24px; }

/* ===== Admin ===== */
.admin-login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--neutral-100);
}
.login-card {
  background: white;
  padding: 40px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
}
.login-icon { text-align: center; color: var(--primary); margin-bottom: 24px; }
.login-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 24px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.875rem; }
.login-form input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border var(--transition);
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.login-error {
  background: var(--error-50);
  color: var(--error-dark);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.admin-page { background: var(--neutral-100); min-height: 100vh; }
.admin-header {
  background: var(--neutral-900);
  color: white;
  padding: 16px 24px;
}
.admin-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-header h1 { font-size: 1.25rem; }
.admin-header a { color: rgba(255,255,255,0.8); }
.admin-header a:hover { color: white; }
.admin-body { max-width: 1200px; margin: 0 auto; padding: 24px; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 24px; flex-wrap: wrap; }
.tab {
  padding: 10px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--neutral-200);
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition);
}
.tab:hover { background: var(--neutral-300); }
.tab.active { background: var(--primary); color: white; }
.tab-content {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  min-height: 400px;
}

.admin-form { max-width: 600px; }
.admin-form .form-group { margin-bottom: 20px; }
.admin-form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.875rem; }
.admin-form input, .admin-form textarea, .admin-form select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  transition: border var(--transition);
}
.admin-form input:focus, .admin-form textarea:focus { outline: none; border-color: var(--primary); }
.admin-form textarea { font-family: monospace; resize: vertical; }
.label-hint { font-weight: 400; color: var(--text-light); font-size: 0.8125rem; }
.field-note { font-size: 0.8125rem; color: var(--text-light); margin-top: 4px; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.875rem; font-weight: 500; }
.alert-success { background: var(--success-50); color: var(--success); }
.alert-error { background: var(--error-50); color: var(--error-dark); }

/* ===== Stats ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.stat-card {
  background: var(--neutral-50);
  border-radius: var(--radius);
  padding: 24px;
}
.stat-value { font-size: 2.5rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.875rem; color: var(--text-light); margin-top: 4px; }
.stat-card h3 { font-size: 1rem; margin-bottom: 12px; }
.stat-list { list-style: none; }
.stat-list li { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.875rem; }

/* ===== Admin Articles ===== */
.admin-articles-page { background: white; padding: 24px; }
.admin-articles-header { margin-bottom: 24px; }
.admin-articles-header h2 { margin-bottom: 16px; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-input, .filter-select { padding: 8px 12px; border: 2px solid var(--border); border-radius: var(--radius-sm); }
.articles-table { width: 100%; border-collapse: collapse; }
.articles-table th, .articles-table td { padding: 12px; text-align: start; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.articles-table th { font-weight: 700; color: var(--neutral-700); background: var(--neutral-50); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero-title { font-size: 1.75rem; }
  .hero-subtitle { font-size: 0.9375rem; }
  .search-form { flex-direction: column; }
  .header-inner { flex-wrap: wrap; }
  .article-content { padding: 24px 16px; }
  .article-header h1 { font-size: 1.5rem; }
  .charts-grid { grid-template-columns: 1fr; }
  .section-picker { grid-template-columns: 1fr !important; }
  .preview-actions { flex-direction: column !important; }
}

/* ===== Generate Page (Multi-step workflow) ===== */
.generate-page { background: var(--bg); min-height: 100vh; }
.generate-main { max-width: 800px; margin: 0 auto; padding: 40px 24px; }
.gen-step { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.gen-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.step-badge {
  position: absolute;
  top: -16px;
  inset-inline-start: 32px;
  width: 40px; height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.125rem;
  box-shadow: var(--shadow);
}
.gen-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; color: var(--neutral-900); }
.step-desc { color: var(--text-light); margin-bottom: 24px; font-size: 0.9375rem; }
.gen-card .form-group { margin-bottom: 20px; }
.gen-card input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.0625rem;
  transition: border var(--transition);
}
.gen-card input[type="text"]:focus { outline: none; border-color: var(--primary); }
.select-large {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: white;
  cursor: pointer;
}
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }

/* Detected asset info */
.detected-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius);
}
.detected-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary);
  color: white;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.detected-name { font-weight: 600; color: var(--neutral-800); font-size: 0.9375rem; }

/* Chart retry box */
.chart-retry-box {
  margin-top: 20px;
  padding: 24px;
  background: var(--error-50, #fef2f2);
  border: 1px solid var(--error-200, #fecaca);
  border-radius: var(--radius);
  text-align: center;
}
.chart-retry-msg {
  color: var(--error-700, #b91c1c);
  font-weight: 600;
  margin-bottom: 16px;
}

/* Section picker */
.section-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.section-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.section-checkbox:hover { border-color: var(--primary-light); background: var(--primary-50); }
.section-checkbox input { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.section-checkbox input:checked ~ .section-label { font-weight: 600; color: var(--primary); }
.section-label { flex: 1; }
.section-picker-actions { display: flex; gap: 8px; margin-bottom: 24px; }

/* Generation progress */
.gen-progress { margin: 24px 0; }
.gen-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--neutral-50);
  transition: all var(--transition);
}
.gen-item.active { background: var(--primary-50); border: 1px solid var(--primary-100); }
.gen-item.done { background: var(--success-50); }
.gen-item.failed { background: var(--error-50); }
.gen-item-icon { font-size: 1.25rem; }
.gen-item-label { flex: 1; font-weight: 500; }
.gen-item-status { font-size: 0.8125rem; color: var(--text-light); font-weight: 600; }
.gen-lang-tag { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--neutral-100); color: var(--neutral-700); margin-inline-end: 6px; }
.gen-item.active .gen-item-status { color: var(--primary); }
.gen-item.done .gen-item-status { color: var(--success); }
.gen-item.failed .gen-item-status { color: var(--error); }

.gen-overall {
  height: 8px;
  background: var(--neutral-200);
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0 8px;
}
.gen-overall-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.5s ease;
}
.gen-status { text-align: center; color: var(--text-light); font-size: 0.875rem; }

/* Preview */
.preview-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}
.article-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-top: 24px;
  line-height: 1.8;
}
.article-preview h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 16px; }
.article-preview h2 { font-size: 1.25rem; font-weight: 700; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-50); }
.article-preview h3 { font-size: 1.0625rem; font-weight: 600; margin: 16px 0 8px; }
.article-preview p { margin-bottom: 12px; color: var(--neutral-700); }
.article-preview ul, .article-preview ol { margin: 8px 0 16px; padding-inline-start: 24px; }
.article-preview li { margin-bottom: 4px; }
.article-preview table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.article-preview th, .article-preview td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: start; }
.article-preview th { background: var(--neutral-50); font-weight: 600; }
.article-preview img { max-width: 100%; border-radius: var(--radius); }
.article-preview a { color: var(--primary); word-break: break-word; overflow-wrap: anywhere; }

.preview-lang-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.preview-lang-tab { padding: 10px 20px; border: none; background: none; cursor: pointer; font-size: 0.9375rem; font-weight: 600; color: var(--text-muted); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; border-radius: 8px 8px 0 0; }
.preview-lang-tab:hover { color: var(--primary); background: var(--neutral-50); }
.preview-lang-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--neutral-50); }
