:root,
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-soft: #fafafa;
  --bg-faint: #f5f5f5;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #0a0a0a;
  --text-dim: #525252;
  --text-faint: #a3a3a3;
  --pill-bg: rgba(163, 163, 163, 0.55);
  --pill-text: #ffffff;
  --primary: #0a0a0a;
  --primary-text: #ffffff;
  --primary-hover: #262626;
  --accent: #14b8a6;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --lime: #65a30d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.08);
  --shimmer: rgba(0, 0, 0, 0.04);
  --modal-backdrop: rgba(0, 0, 0, 0.45);
  --radius-pill: 9999px;
  --radius-card: 16px;
  --radius-card-lg: 20px;
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-elev: #111111;
  --bg-card: #141414;
  --bg-input: #1a1a1a;
  --bg-soft: #0f0f0f;
  --bg-faint: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f5;
  --text-dim: #a3a3a3;
  --text-faint: #525252;
  --pill-bg: rgba(255, 255, 255, 0.12);
  --pill-text: #ffffff;
  --primary: #ffffff;
  --primary-text: #0a0a0a;
  --primary-hover: #e5e5e5;
  --accent: #2dd4bf;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.10);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.10);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.10);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.10);
  --lime: #a3e635;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  --shimmer: rgba(255, 255, 255, 0.06);
  --modal-backdrop: rgba(0, 0, 0, 0.7);
}

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ============ FLOATING TOPBAR ============ */
.topbar-left {
  position: fixed;
  top: 14px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 50;
}
.topbar-right {
  position: fixed;
  top: 14px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 50;
}
.brand-pill {
  height: 40px;
  border-radius: 9999px;
  background: #0a0a0a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 0 12px;
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background-color 0.15s;
}
.brand-pill:hover { background: #262626; }
.brand-bolt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #111;
  font-size: 13px;
  line-height: 1;
}
.brand-name { font-family: 'Inter', sans-serif; }
.nav-pill {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 9999px;
  background: #0a0a0a;
  padding: 4px 6px;
}
.nav-link {
  background: transparent;
  border: none;
  color: var(--pill-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.12); }
.nav-link.active { background: rgba(255, 255, 255, 0.22); }
.leadCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.25);
  color: var(--pill-text);
  font-size: 10px;
  font-weight: 700;
}
.provider-pill {
  height: 28px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  background: var(--pill-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--pill-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: var(--pill-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  color: var(--pill-text);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.15s;
}
.theme-toggle:hover { background: rgba(163, 163, 163, 0.75); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============ CONTAINER ============ */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 96px 24px 80px;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.panel { animation: fadeIn 0.25s ease; }

.page-header {
  text-align: center;
  margin-bottom: 36px;
  padding: 0 16px;
}
.page-header h2 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.page-header p {
  color: var(--text-dim);
  font-size: 15px;
  max-width: 560px;
  margin: 0 auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
}
.panel-header h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.panel-sub { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* ============ ONBOARDING CARD ============ */
.onboarding-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-lg);
  padding: 24px 28px;
  margin: 0 auto 28px;
  max-width: 900px;
  box-shadow: var(--shadow-sm);
}
.onboarding-card.hidden { display: none; }
.onboarding-dismiss {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 24px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  transition: background-color 0.15s;
}
.onboarding-dismiss:hover { background: var(--bg-faint); color: var(--text); }
.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.onboarding-step { display: flex; gap: 12px; align-items: flex-start; }
.onboarding-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.onboarding-step strong { font-size: 14px; display: block; margin-bottom: 2px; }
.onboarding-step p { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.onboarding-step em { font-style: normal; color: var(--text); font-weight: 500; }
.onboarding-tips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.onboarding-tag {
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--bg-faint);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}
.onboarding-tag.pos {
  background: var(--success-bg);
  color: var(--success);
}

.label-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text-faint);
  margin-left: 4px;
  font-size: 10px;
}

.empty-quickstart {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
}

/* ============ MODE TABS (PILLS) ============ */
.mode-tabs {
  display: inline-flex;
  background: var(--bg-faint);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 4px;
  margin: 0 auto 24px;
  display: flex;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.mode-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ============ FILTERS ============ */
.filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  margin-bottom: 32px;
}
.filter-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.filter-row-compact {
  grid-template-columns: repeat(8, 1fr);
}
.filter-grow { grid-column: span 1; }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.filter-group input,
.filter-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--bg-faint);
}
.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.result-count { color: var(--text-dim); font-size: 13px; margin-left: auto; }

/* ============ BUTTONS ============ */
.btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 9999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
  font-weight: 500;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary {
  background: var(--bg-faint);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

/* ============ RESULTS GRID ============ */
.results-wrap { position: relative; min-height: 240px; }
.empty-state {
  text-align: center;
  padding: 96px 24px;
  color: var(--text-dim);
}
.empty-icon { font-size: 40px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--text); font-size: 20px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.01em; }

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ============ PRODUCT CARD ============ */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}
.product-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.product-image-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-faint);
  overflow: hidden;
}
.product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 18px;
  transition: transform 0.4s ease;
}
.product-card:hover .product-image-wrap img { transform: scale(1.04); }

.product-verdict-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  height: 24px;
  padding: 0 10px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}
.product-verdict-badge.verdict-green { background: rgba(5, 150, 105, 0.92); }
.product-verdict-badge.verdict-lime { background: rgba(101, 163, 13, 0.92); }
.product-verdict-badge.verdict-yellow { background: rgba(217, 119, 6, 0.92); }
.product-verdict-badge.verdict-orange { background: rgba(251, 146, 60, 0.92); }
.product-verdict-badge.verdict-red { background: rgba(220, 38, 38, 0.92); }

.product-category-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 22px;
  padding: 0 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: #0a0a0a;
  font-size: 10px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
}
.product-ungated-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  height: 22px;
  padding: 0 9px;
  border-radius: 9999px;
  background: rgba(20, 184, 166, 0.92);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(8px);
}

.product-body { padding: 16px 18px 14px; }
.product-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
  letter-spacing: -0.005em;
  margin-bottom: 8px;
  min-height: 39px;
}
.product-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--text-faint);
  flex-wrap: wrap;
  min-width: 0;
}
.product-asin { font-family: ui-monospace, monospace; }
.product-meta-dot { opacity: 0.5; }

.product-headline {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px 12px;
  gap: 12px;
}
.product-headline-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
.product-headline-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.product-headline-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.product-headline-value.profit { font-size: 22px; }
.product-headline-value.pos { color: var(--success); }
.product-headline-value.neg { color: var(--danger); }
.product-headline-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.product-microstats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  padding: 12px 0;
  margin: 0 18px;
}
.microstat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0 2px;
  min-width: 0;
  overflow: hidden;
}
.microstat:not(:last-child) { border-right: 1px solid var(--border); padding-right: 8px; }
.microstat:not(:first-child) { padding-left: 8px; }
.microstat-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.microstat-value { font-size: 12px; font-weight: 600; color: var(--text); }

.product-actions {
  display: flex;
  gap: 6px;
  padding: 10px 14px 14px;
}
.product-actions .btn { flex: 1; justify-content: center; padding: 8px 12px; font-size: 12px; }

.pos { color: var(--success); }
.neg { color: var(--danger); }

/* ============ LOADING ============ */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  height: 360px;
  position: relative;
  overflow: hidden;
}
.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ============ LEADS LIST ============ */
.leads-list { display: flex; flex-direction: column; gap: 10px; }
.lead-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  display: grid;
  grid-template-columns: 64px 1fr 120px 120px 120px auto;
  gap: 16px;
  align-items: center;
}
.lead-row img { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; background: var(--bg-faint); padding: 6px; }
.lead-title { font-size: 13px; font-weight: 500; }
.lead-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.lead-stat { text-align: right; }
.lead-stat-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.lead-stat-value { font-size: 14px; font-weight: 600; }
.status-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-family: inherit;
}

/* ============ CALCULATOR ============ */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}
.calc-inputs {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.calc-inputs .filter-group:first-child,
.calc-inputs .filter-group:nth-child(4) { grid-column: span 2; }

.calc-output {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
}
.calc-verdict {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--success-bg);
  color: var(--success);
}
.calc-profit { margin: 24px 0 28px; }
.calc-profit-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.calc-profit-value { font-size: 48px; font-weight: 600; letter-spacing: -0.03em; margin-top: 6px; }
.calc-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.calc-metrics div { display: flex; flex-direction: column; gap: 4px; }
.calc-metrics span { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.calc-metrics strong { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.calc-breakdown { display: flex; flex-direction: column; gap: 8px; }
.calc-breakdown .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-dim);
}
.calc-breakdown .row-total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

/* ============ SOURCES PANEL ============ */
.sources-panel { display: flex; flex-direction: column; gap: 8px; }
.sources-loading, .sources-empty {
  padding: 16px 18px;
  background: var(--bg-faint);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
.source-row {
  display: grid;
  grid-template-columns: 110px 1fr 140px 140px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.source-row:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.source-retailer { font-weight: 600; font-size: 13px; }
.source-title {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.source-price { text-align: right; }
.source-price-value { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.source-spread { font-size: 11px; margin-top: 2px; }
.source-profit { text-align: right; font-size: 12px; }
.source-profit > div { line-height: 1.4; }

/* ============ MODAL CONTENT STYLES (legacy class names used inside the modal HTML) ============ */
.modal .product-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.modal .product-head img {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  background: var(--bg-faint);
  object-fit: contain;
  padding: 8px;
  flex-shrink: 0;
}
.modal .product-head h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.product-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.product-stats .stat {
  background: var(--bg-card);
  padding: 12px 14px;
  min-width: 0;
  overflow: hidden;
}
.stat-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value-lg { font-size: 20px; letter-spacing: -0.01em; }

/* Verdict pill (used inside the modal next to the title) */
.verdict {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.verdict-green { background: var(--success-bg); color: var(--success); }
.verdict-lime { background: var(--success-bg); color: var(--lime); }
.verdict-yellow { background: var(--warning-bg); color: var(--warning); }
.verdict-orange { background: var(--warning-bg); color: #f97316; }
.verdict-red { background: var(--danger-bg); color: var(--danger); }

@media (max-width: 640px) {
  .modal .product-head { gap: 12px; }
  .modal .product-head img { width: 76px; height: 76px; padding: 6px; }
  .modal .product-head h3 { font-size: 15px; }
  .product-stats { grid-template-columns: 1fr 1fr; }
  .product-stats .stat { padding: 10px 12px; }
  .stat-value { font-size: 13px; }
  .stat-value-lg { font-size: 17px; }
  .modal-body { padding: 18px; }
  .modal { padding: 12px; }
}

/* ============ MODAL ============ */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-body {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-lg);
  padding: 32px;
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 13px;
  z-index: 200;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow-lg);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .filter-row { grid-template-columns: 1fr 1fr; }
  .filter-row-compact { grid-template-columns: repeat(4, 1fr); }
  .calc-grid { grid-template-columns: 1fr; }
  .lead-row { grid-template-columns: 50px 1fr auto; }
  .lead-row .lead-stat { display: none; }
}
@media (max-width: 900px) {
  .onboarding-grid { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 640px) {
  .container { padding: 80px 14px 64px; }

  /* Topbar — collapse brand wordmark, tighten gaps */
  .topbar-left { left: 12px; gap: 6px; }
  .topbar-right { right: 12px; }
  .nav-link { padding: 6px 10px; font-size: 12px; }
  .brand-pill { padding: 0 12px; gap: 4px; }
  .brand-name { display: none; }

  .page-header h2 { font-size: 26px; }
  .page-header p { font-size: 13px; }

  .filter-row, .filter-row-compact { grid-template-columns: 1fr 1fr; }
  .mode-tabs { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mode-tabs::-webkit-scrollbar { display: none; }
  .mode-tab { white-space: nowrap; flex-shrink: 0; }

  /* Cards: full-width single column gives every value room to render */
  .results, .skeleton-grid { grid-template-columns: 1fr; gap: 14px; }
  .product-image-wrap { aspect-ratio: 16 / 9; }
  .product-image-wrap img { padding: 14px; }
  .product-body { padding: 14px 16px 10px; }
  .product-title { font-size: 14px; min-height: 0; -webkit-line-clamp: 2; }
  .product-headline { padding: 0 16px 12px; gap: 8px; }
  .product-headline-value { font-size: 22px; }
  .product-headline-value.profit { font-size: 24px; }
  .product-headline-sub { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .product-microstats { margin: 0 16px; padding: 10px 0; }
  .microstat-value {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
  }
  .product-actions { padding: 10px 12px 12px; gap: 8px; }
  /* iOS-friendly tap target ≥44px */
  .product-actions .btn { min-height: 42px; padding: 10px 12px; font-size: 13px; }

  /* Badge positioning — keep clear of each other on narrow images */
  .product-verdict-badge,
  .product-category-badge,
  .product-ungated-badge { font-size: 9px; padding: 0 7px; height: 20px; }

  /* Sources panel inside modal */
  .source-row { grid-template-columns: 80px 1fr auto; gap: 8px; padding: 12px; }
  .source-row .source-profit { display: none; }

  .modal-body { padding: 20px; border-radius: 16px; }
  .onboarding-card { padding: 18px; }
  .onboarding-tips { font-size: 11px; }
  .onboarding-tag { font-size: 10px; padding: 3px 8px; }

  /* Leads + calc layouts */
  .calc-inputs { padding: 18px; gap: 12px; }
  .calc-output { padding: 20px; }
  .calc-profit-value { font-size: 36px; }
}

/* Very small phones (iPhone SE width) — squeeze a bit more */
@media (max-width: 380px) {
  .product-headline-value { font-size: 20px; }
  .product-headline-value.profit { font-size: 22px; }
  .microstat-label { font-size: 9px; }
}
