/* ═══════════════════════════════════════════════════════════════
   MarketIQ — Dark Executive Dashboard
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #080c14;
  --bg-secondary: #0d1421;
  --bg-card: #111827;
  --bg-card-hover: #161f30;
  --bg-elevated: #1a2540;
  --border: #1e2d45;
  --border-subtle: #162035;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.15);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.15);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.12);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.12);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.12);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.12);
  --gradient-1: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-2: linear-gradient(135deg, #06b6d4, #3b82f6);
  --gradient-3: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-4: linear-gradient(135deg, #f59e0b, #ef4444);
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

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

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── LAYOUT ─────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--gradient-1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: white;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-blue-glow);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.nav-item.active .nav-icon { color: var(--accent-blue); }

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
  opacity: 0.8;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-blue);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-stats {
  display: flex;
  gap: 8px;
}

.stat-mini {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}

.stat-mini-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.stat-mini-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title .page-icon {
  width: 32px; height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

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

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

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 9px; }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s ease;
}

.card:hover {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--accent-blue);
  font-size: 12px;
}

/* ── KPI CARDS ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-1);
}

.kpi-card.purple::before { background: var(--gradient-2); }
.kpi-card.green::before { background: var(--gradient-3); }
.kpi-card.amber::before { background: var(--gradient-4); }

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border-color: rgba(59, 130, 246, 0.3);
}

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

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.kpi-icon-wrap {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

.kpi-icon-wrap.blue { background: var(--accent-blue-glow); color: var(--accent-blue); }
.kpi-icon-wrap.purple { background: var(--accent-purple-glow); color: var(--accent-purple); }
.kpi-icon-wrap.green { background: var(--accent-green-glow); color: var(--accent-green); }
.kpi-icon-wrap.amber { background: var(--accent-amber-glow); color: var(--accent-amber); }
.kpi-icon-wrap.cyan { background: var(--accent-cyan-glow); color: var(--accent-cyan); }

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 8px;
}

.kpi-trend.up { background: var(--accent-green-glow); color: var(--accent-green); }
.kpi-trend.neutral { background: var(--accent-amber-glow); color: var(--accent-amber); }

/* ── CHARTS ──────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

.chart-wrap canvas { max-height: 240px; }

/* ── PAGE CONTENT ────────────────────────────────────────────── */
.page {
  display: none;
  padding: 28px;
  min-height: calc(100vh - var(--topbar-height));
}

.page.active { display: block; animation: fadeIn 0.3s ease; }

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

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header-left { flex: 1; }

.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.8px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── FILTERS BAR ─────────────────────────────────────────────── */
.filters-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group { display: flex; align-items: center; gap: 8px; }

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.filter-select, .filter-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s;
  min-width: 130px;
}

.filter-select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select option { background: var(--bg-card); }

/* ── TABLE ───────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

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

thead tr {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
}

tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 12px 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td .product-name {
  font-weight: 600;
  color: var(--text-primary);
}

tbody td .brand-name {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-purple { background: rgba(139, 92, 246, 0.12); color: var(--accent-purple); border: 1px solid rgba(139, 92, 246, 0.2); }
.badge-green { background: rgba(16, 185, 129, 0.12); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-amber { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-red { background: rgba(239, 68, 68, 0.12); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-cyan { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.2); }
.badge-gray { background: rgba(71, 85, 105, 0.3); color: var(--text-muted); border: 1px solid var(--border); }

/* ── SCORE BAR ───────────────────────────────────────────────── */
.score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-track {
  flex: 1;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--gradient-1);
  transition: width 0.8s ease;
}

.score-fill.high { background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan)); }
.score-fill.medium { background: linear-gradient(90deg, var(--accent-amber), var(--accent-blue)); }
.score-fill.low { background: linear-gradient(90deg, var(--accent-red), var(--accent-amber)); }

.score-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 28px;
  text-align: right;
}

/* ── STAR RATING ─────────────────────────────────────────────── */
.stars {
  color: var(--accent-amber);
  font-size: 12px;
  letter-spacing: 1px;
}

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

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s;
  box-shadow: var(--shadow-lg);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px; height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  transition: all 0.2s;
}

.modal-close:hover { color: var(--text-primary); border-color: var(--text-muted); }

.modal-body { padding: 24px; }

/* ── FORM ────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-label .required { color: var(--accent-red); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.2s;
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: var(--bg-card);
}

.form-input::placeholder { color: var(--text-muted); }
.form-select option { background: var(--bg-card); }

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ── AI ANALYSIS ─────────────────────────────────────────────── */
.ai-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.ai-card-header {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar {
  width: 42px; height: 42px;
  background: var(--gradient-1);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.ai-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.ai-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.ai-card-body { padding: 24px; }

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.analysis-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.analysis-item-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.analysis-item-content {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.analysis-item-content strong { color: var(--text-primary); }

/* ── RANKING ─────────────────────────────────────────────────── */
.ranking-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
  cursor: pointer;
}

.ranking-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  background: var(--bg-card-hover);
  transform: translateX(2px);
}

.ranking-pos {
  font-size: 22px;
  min-width: 36px;
  text-align: center;
}

.ranking-pos-num {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-muted);
  min-width: 36px;
  text-align: center;
}

.ranking-info { flex: 1; }

.ranking-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.ranking-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ranking-score-wrap { text-align: right; min-width: 80px; }

.ranking-score-val {
  font-size: 22px;
  font-weight: 900;
  color: var(--accent-blue);
  line-height: 1;
}

.ranking-score-label { font-size: 10px; color: var(--text-muted); }

/* ── FORMAT COMPARISON ───────────────────────────────────────── */
.format-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s;
}

.format-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.format-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.format-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: capitalize;
}

.format-trend-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.trend-hot { background: rgba(239, 68, 68, 0.12); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.2); }
.trend-rising { background: rgba(16, 185, 129, 0.12); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.2); }
.trend-stable { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.2); }

.format-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.format-stat { text-align: center; }

.format-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.format-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── INSIGHTS ────────────────────────────────────────────────── */
.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.insight-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.insight-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.insight-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.insight-body { padding: 20px 24px; }

.insight-list { list-style: none; }

.insight-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.insight-list li:last-child { border-bottom: none; }

.insight-list li::before {
  content: '→';
  color: var(--accent-blue);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 13px;
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ── LOADING ─────────────────────────────────────────────────── */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 13px;
  color: var(--text-muted);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── TOAST ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 340px;
  animation: slideInRight 0.3s ease;
  border-left: 3px solid var(--accent-blue);
}

.toast.success { border-left-color: var(--accent-green); }
.toast.error { border-left-color: var(--accent-red); }
.toast.warning { border-left-color: var(--accent-amber); }

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

/* ── PRODUCT DETAIL ──────────────────────────────────────────── */
.detail-header {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.detail-icon {
  width: 64px; height: 64px;
  background: var(--gradient-1);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

.detail-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.detail-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-green);
  letter-spacing: -1px;
}

.detail-price-label { font-size: 12px; color: var(--text-muted); }

/* ── GRID UTILITIES ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── PORTFOLIO SUMMARY ───────────────────────────────────────── */
.portfolio-score {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.portfolio-score-circle {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-blue) var(--pct, 0%), var(--border) 0%);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.portfolio-score-circle::before {
  content: '';
  position: absolute;
  width: 68px; height: 68px;
  background: var(--bg-elevated);
  border-radius: 50%;
}

.portfolio-score-val {
  position: relative;
  z-index: 1;
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
}

.portfolio-score-info { flex: 1; }

.portfolio-score-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.portfolio-score-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

/* ── NOTIFICATION DOTS ───────────────────────────────────────── */
.dot-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 6px var(--accent-green); }
  50% { box-shadow: 0 0 12px var(--accent-green), 0 0 20px var(--accent-green); }
}

/* ── MOBILE ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); width: 260px; }
  .main-content { margin-left: 0; }
  .charts-grid, .charts-row, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .detail-header { flex-direction: column; }
  .analysis-grid { grid-template-columns: 1fr; }
}

/* ── SKU CARD ────────────────────────────────────────────────── */
.sku-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.2s;
}

.sku-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
}

.sku-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.sku-format { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sku-price { font-size: 18px; font-weight: 800; color: var(--accent-green); margin-top: 8px; }
.sku-justif { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; }

/* ── GRADIENT TEXT ───────────────────────────────────────────── */
.gradient-text {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-2 {
  background: var(--gradient-3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── LINK CHIP ───────────────────────────────────────────────── */
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 20px;
  font-size: 11px;
  color: var(--accent-cyan);
  text-decoration: none;
  transition: all 0.2s;
}

.link-chip:hover {
  background: rgba(6, 182, 212, 0.15);
  text-decoration: none;
}

/* ── PRICE DISPLAY ───────────────────────────────────────────── */
.price-display {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.price-currency { font-size: 12px; color: var(--text-muted); }
.price-val { font-size: 15px; font-weight: 700; color: var(--text-primary); }

/* ── AI THINKING ─────────────────────────────────────────────── */
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--accent-blue);
  margin-bottom: 16px;
}

.ai-thinking .dots {
  display: flex;
  gap: 4px;
}

.ai-thinking .dot {
  width: 6px; height: 6px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: dotBounce 1.2s infinite;
}

.ai-thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-8px); opacity: 1; }
}
