/* =====================================================================
   SourceIQ Mini App — design system
   Inspired by @arbi_exchange_bot's bright/clean style
   Electric-blue + emerald accents · big bold typography · soft shadows
   ===================================================================== */

:root {
  /* === COLOR TOKENS === */
  --bg:           #ffffff;           /* canvas */
  --bg-soft:      #f8fafc;           /* surface 1 */
  --surface:      #ffffff;           /* cards */
  --line:         #e2e8f0;           /* borders */
  --line-2:       #f1f5f9;           /* dividers */
  --text:         #0f172a;           /* primary */
  --text-muted:   #475569;           /* secondary */
  --text-dim:     #94a3b8;           /* tertiary */
  --brand:        #2563eb;           /* electric blue */
  --brand-2:      #06b6d4;           /* cyan */
  --emerald:      #10b981;
  --emerald-dark: #059669;
  --violet:       #8b5cf6;
  --amber:        #f59e0b;
  --slate:        #64748b;
  --danger:       #dc2626;

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 1px rgba(15,23,42,0.03);
  --shadow:    0 4px 12px rgba(15,23,42,0.06), 0 1px 3px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.08), 0 4px 8px rgba(15,23,42,0.05);

  /* radii */
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
}

/* Apply Telegram theme variables when running inside Telegram */
body.tg-theme-light { --bg: var(--tg-theme-bg-color, #ffffff); }
body.tg-theme-dark  { /* honor Telegram's dark mode if user has it */ }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-soft);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* =====================================================================
   SCREENS — only one is active at a time
   ===================================================================== */
.screen {
  display: none;
  padding: 0 16px 86px 16px;
  min-height: 100vh;
}
.screen[data-active] { display: block; }

/* =====================================================================
   HERO (Search screen)
   ===================================================================== */
.hero {
  padding-top: 14px;
}
.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  color: white; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
  letter-spacing: 0.4px;
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}
.brand-name {
  font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.1;
}
.brand-tag {
  font-size: 12px; color: var(--text-dim);
  margin-top: 2px;
}
.icon-btn {
  width: 40px; height: 40px;
  background: var(--surface);
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.icon-btn:active { transform: scale(0.96); }

/* =====================================================================
   SEARCH CARD — the hero of the search screen
   ===================================================================== */
/* =====================================================================
   WIZARD SEARCH FORM
   ===================================================================== */
.wizard-progress {
  display: flex; align-items: center; justify-content: center;
  gap: 4px;
  padding: 8px 4px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.wiz-step { display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0.5; transition: opacity 0.2s; }
.wiz-step.active, .wiz-step.done { opacity: 1; }
.wiz-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e5e7eb; color: #6b7280;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  transition: all 0.2s;
}
.wiz-step.active .wiz-step-dot { background: #2563eb; color: white; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15); }
.wiz-step.done .wiz-step-dot { background: #10b981; color: white; }
.wiz-step.done .wiz-step-dot::after { content: '✓'; }
.wiz-step.done .wiz-step-dot { font-size: 0; }
.wiz-step.done .wiz-step-dot::after { font-size: 14px; }
.wiz-step-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted, #6b7280); }
.wiz-step.active .wiz-step-label { color: #2563eb; }
.wiz-line { flex: 1; max-width: 40px; height: 2px; background: #e5e7eb; margin-top: -16px; }

.wiz-panel { margin-top: 4px; }
.wiz-actions { margin-top: 18px; }
.wiz-actions.two-col {
  display: grid; grid-template-columns: 1fr 2fr; gap: 10px;
}
.cta-secondary {
  appearance: none; border: 1px solid var(--border, #e5e7eb);
  background: white; color: var(--text, #0f172a);
  padding: 14px; border-radius: 12px;
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.cta-secondary:active { background: #f8fafc; }
.form-optional { font-weight: 500; color: var(--text-muted, #9ca3af); font-size: 11px; text-transform: none; }
.form-hint { font-size: 11.5px; color: var(--text-muted, #6b7280); margin-top: 6px; }

/* Loading state — stepped progress indicator (2026-05-26) */
.loading-card {
  margin: 16px 12px;
  padding: 28px 20px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 16px;
}
.loading-header { text-align: center; margin-bottom: 22px; }
.loading-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin-bottom: 4px;
}
.loading-sub {
  font-size: 12.5px;
  color: var(--text-muted, #6b7280);
}
.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.load-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.02);
  opacity: 0.5;
  transition: opacity 0.25s, background 0.25s;
}
.load-step.is-active {
  opacity: 1;
  background: rgba(37, 99, 235, 0.06);
}
.load-step.is-done {
  opacity: 0.75;
  background: rgba(16, 185, 129, 0.06);
}
.load-step-icon { font-size: 18px; flex-shrink: 0; }
.load-step-label {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text, #0f172a);
}
.load-step-status {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.load-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--brand, #2563eb);
  border-radius: 50%;
  animation: load-spin 0.8s linear infinite;
}
.load-check { display: none; color: #059669; }
.load-step.is-active .load-spinner { display: block; }
.load-step.is-done .load-check { display: block; }
@keyframes load-spin {
  to { transform: rotate(360deg); }
}

/* Show-more button + collapsed rest of supplier list (2026-05-26) */
.show-more-wrapper {
  margin: 16px 12px 8px;
  text-align: center;
}
.show-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--brand, #2563eb);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.show-more-btn:hover, .show-more-btn:active {
  background: rgba(37, 99, 235, 0.14);
}

/* Buyer-protection + verification badges on supplier cards (2026-05-26) */
.sup-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  margin-left: 4px;
  white-space: nowrap;
}
.sup-badge.badge-emerald {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.sup-badge.badge-amber {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.sup-badge.badge-violet {
  background: rgba(139, 92, 246, 0.1);
  color: #6d28d9;
  border: 1px solid rgba(139, 92, 246, 0.25);
}
.sup-badge.badge-blue {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

/* Empty / weak-result state — friendly card with retry + suggestions */
.empty-card {
  margin: 16px 12px;
  padding: 24px 20px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 16px;
  text-align: center;
}
.empty-emoji {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 12px;
}
.empty-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin-bottom: 6px;
}
.empty-sub {
  font-size: 13.5px;
  color: var(--text-muted, #6b7280);
  line-height: 1.5;
  margin-bottom: 16px;
}
.empty-sub b { color: var(--text, #0f172a); font-weight: 600; }
.empty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}
.empty-chip {
  padding: 8px 14px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--brand, #2563eb);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.empty-chip:hover, .empty-chip:active { background: rgba(37, 99, 235, 0.16); }
.empty-retry {
  width: 100%;
  margin-bottom: 14px;
}
.empty-hint {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  background: rgba(245, 158, 11, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: left;
  line-height: 1.45;
}

/* AI preview — shows GPT-parsed fields under the product input */
.ai-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(168, 85, 247, 0.06));
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text, #111827);
  animation: aiPreviewFadeIn 0.2s ease-out;
}
.ai-preview-icon { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.ai-preview-text { flex: 1; min-width: 0; }
.ai-preview-text b { font-weight: 600; }
.ai-preview.is-loading { opacity: 0.7; }
@keyframes aiPreviewFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chip rows (material / color) */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  appearance: none; border: 1.5px solid var(--border, #e5e7eb);
  background: white; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text, #0f172a);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.12s;
  font-family: inherit;
}
.chip:hover { border-color: #93c5fd; }
.chip.selected { background: #eff6ff; border-color: #2563eb; color: #1e40af; }
.color-swatch {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
}

/* Tier picker */
.tier-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.tier-btn {
  appearance: none; border: 2px solid var(--border, #e5e7eb);
  background: white;
  padding: 12px 8px; border-radius: 12px;
  cursor: pointer; text-align: center;
  font-family: inherit;
  transition: all 0.12s;
}
.tier-btn.selected {
  border-color: #2563eb; background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.tier-name { font-size: 14px; font-weight: 700; color: var(--text, #0f172a); }
.tier-price { font-size: 11px; color: var(--text-muted, #6b7280); margin-top: 2px; }

.search-card {
  margin-top: 16px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.search-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.2px;
}
.search-input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-soft);
  resize: none;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus {
  border-color: var(--brand);
  background: var(--surface);
}
.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px 0;
}
.chip {
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  white-space: nowrap;
}
.chip:active { transform: scale(0.97); background: #eff6ff; border-color: var(--brand); color: var(--brand); }

.cta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: white;
  border-radius: var(--r);
  font-size: 16px; font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 8px 20px rgba(37,99,235,0.25);
  transition: transform 0.1s, box-shadow 0.15s;
}
.cta:active { transform: scale(0.985); box-shadow: 0 4px 12px rgba(37,99,235,0.2); }
.cta-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--brand);
  color: white;
  border-radius: var(--r);
  font-size: 14px; font-weight: 600;
  margin-top: 16px;
}

/* =====================================================================
   BLOCKS (Feature carousel + Action list)
   ===================================================================== */
.block { margin-top: 24px; }
.block-title {
  font-size: 14px; font-weight: 700;
  color: var(--text);
  margin: 0 4px 12px 4px;
  letter-spacing: 0.1px;
}

.feature-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 2px 16px;
  scroll-snap-type: x mandatory;
}
.feature-carousel::-webkit-scrollbar { display: none; }
.feature-card {
  flex: 0 0 160px;
  scroll-snap-align: start;
  padding: 14px 14px 16px 14px;
  border-radius: var(--r);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.feature-card .feature-icon { font-size: 22px; margin-bottom: 8px; }
.feature-card .feature-title { font-size: 13.5px; font-weight: 700; line-height: 1.25; }
.feature-card .feature-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.35; }
.grad-blue    { background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%); }
.grad-emerald { background: linear-gradient(135deg, #d1fae5 0%, #ccfbf1 100%); }
.grad-violet  { background: linear-gradient(135deg, #ede9fe 0%, #fae8ff 100%); }
.grad-amber   { background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%); }

.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.1s, box-shadow 0.15s;
}
.action-row:active { transform: scale(0.99); box-shadow: var(--shadow); }
.action-icon {
  flex: 0 0 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 20px;
}
.icon-blue    { background: #dbeafe; color: var(--brand); }
.icon-emerald { background: #d1fae5; color: var(--emerald-dark); }
.icon-violet  { background: #ede9fe; color: var(--violet); }
.icon-amber   { background: #fef3c7; color: var(--amber); }
.icon-slate   { background: #f1f5f9; color: var(--slate); }
.action-text { flex: 1; min-width: 0; }
.action-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.action-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.action-chevron { color: var(--text-dim); flex: 0 0 auto; }

.history-row .btn-rerun {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 600;
  color: var(--brand);
}

/* =====================================================================
   GENERIC PAGE HEADER (used on Saved / History / Account)
   ===================================================================== */
.page-header { padding: 24px 4px 18px 4px; }
.page-title { font-size: 28px; font-weight: 800; color: var(--text); margin: 0; letter-spacing: -0.5px; }
.page-sub   { font-size: 13px; color: var(--text-muted); display: block; margin-top: 4px; }

/* =====================================================================
   EMPTY STATE
   ===================================================================== */
.empty-state {
  margin-top: 60px;
  padding: 40px 24px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-size: 17px; font-weight: 700; color: var(--text); }
.empty-desc { font-size: 13.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }

/* =====================================================================
   WALLET CARD + LEDGER LIST
   ===================================================================== */
.wallet-card {
  margin-top: 14px;
  padding: 18px 18px 14px 18px;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--r-lg, 16px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.wallet-balance-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.wallet-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px;
  color: var(--text-muted, #6b7280); text-transform: uppercase;
}
.wallet-amount {
  font-size: 30px; font-weight: 800; color: var(--text, #0f172a);
  margin-top: 4px; line-height: 1.1; white-space: nowrap;
}
.wallet-sub {
  font-size: 12px; color: var(--text-muted, #6b7280); margin-top: 4px;
}
.wallet-topup-btn {
  appearance: none; border: 0;
  background: #2563eb; color: white;
  padding: 12px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.wallet-topup-btn:active { transform: scale(0.98); }
.wallet-price-hint {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--border, #e5e7eb);
  font-size: 11.5px; color: var(--text-muted, #6b7280);
}

.ledger-list { margin-top: 6px; }
.ledger-empty {
  padding: 24px 12px; text-align: center;
  font-size: 13px; color: var(--text-muted, #9ca3af);
}
.ledger-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border, #f1f5f9);
}
.ledger-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.ledger-icon.topup { background: rgba(16, 185, 129, 0.12); color: #047857; }
.ledger-icon.debit { background: rgba(239, 68, 68, 0.10); color: #b91c1c; }
.ledger-icon.bonus { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.ledger-icon.refund { background: rgba(59, 130, 246, 0.10); color: #1e40af; }
.ledger-text { flex: 1; min-width: 0; }
.ledger-kind { font-size: 13px; font-weight: 600; color: var(--text, #0f172a); }
.ledger-note { font-size: 11.5px; color: var(--text-muted, #6b7280); margin-top: 2px;
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-amt { font-size: 14px; font-weight: 700; white-space: nowrap; }
.ledger-amt.pos { color: #047857; }
.ledger-amt.neg { color: #b91c1c; }
.ledger-date { font-size: 10.5px; color: var(--text-muted, #9ca3af); margin-top: 2px; text-align: right; }

/* Top-up modal tiers */
.topup-tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px 0; }
.topup-tier {
  background: var(--surface-elevated, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
}
.topup-tier.selected { border-color: #2563eb; background: #eff6ff; }
.topup-tier-label { font-size: 18px; font-weight: 800; color: var(--text, #0f172a); }
.topup-tier-bonus { font-size: 11px; color: #047857; font-weight: 600; margin-top: 2px; }
.topup-methods-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted, #6b7280); margin: 8px 0 6px; }
.topup-method-btn {
  display: block; width: 100%;
  padding: 14px; margin: 6px 0;
  background: white;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text, #0f172a);
  text-align: left; cursor: pointer;
}
.topup-method-btn:active { background: #f9fafb; }

/* =====================================================================
   ACCOUNT CARD
   ===================================================================== */
.account-card {
  margin-top: 8px;
  padding: 24px 20px;
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  color: white;
  border-radius: var(--r-lg);
  text-align: center;
  box-shadow: 0 10px 24px rgba(37,99,235,0.22);
}
.account-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  margin: 0 auto 12px;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 800;
}
.account-name { font-size: 19px; font-weight: 700; }
.account-id { font-size: 12px; opacity: 0.85; margin-top: 4px; }
.plan-pill {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.version {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* =====================================================================
   BOTTOM TAB BAR
   ===================================================================== */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom)) 0;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(15,23,42,0.04);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  font-size: 11px; font-weight: 600;
  color: var(--text-dim);
  transition: color 0.15s;
}
.tab[aria-pressed="true"] {
  color: var(--brand);
}
.tab:active { transform: scale(0.97); }

.bottom-spacer { height: 16px; }


/* =====================================================================
   STRUCTURED SEARCH FORM (v2)
   ===================================================================== */
.form-field { position: relative; margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 10.5px; font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-soft);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.form-input:focus {
  border-color: var(--brand);
  background: var(--surface);
}
.form-input::placeholder { color: var(--text-dim); }
input[type=number].form-input { font-weight: 700; }
.form-suffix {
  position: absolute;
  right: 16px;
  bottom: 14px;
  font-size: 13px;
  color: var(--text-dim);
  pointer-events: none;
  font-weight: 500;
}
.form-select {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg-soft);
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.form-select:active { transform: scale(0.99); }
.form-select-flag { font-size: 22px; line-height: 1; }
.form-select-text { flex: 1; }
.form-select svg { color: var(--text-dim); flex-shrink: 0; }


/* =====================================================================
   MODAL (country picker / language picker) — bottom-sheet style
   ===================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.5);
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-sheet {
  position: relative;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom)) 16px;
  box-shadow: 0 -8px 32px rgba(15,23,42,0.18);
  animation: slideUp 0.24s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 8px auto 14px auto;
}
.modal-title {
  font-size: 17px; font-weight: 800;
  color: var(--text);
  margin: 0 4px 16px 4px;
  letter-spacing: -0.2px;
}

.country-list, .lang-list { display: flex; flex-direction: column; gap: 4px; }
.country-row, .lang-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.country-row:active, .lang-row:active { background: var(--bg-soft); }
.country-row.active, .lang-row.active {
  background: #eff6ff;
  border-color: var(--brand);
  color: var(--brand);
}
.country-row.disabled, .country-row[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.country-flag, .lang-flag { font-size: 24px; line-height: 1; }
.country-name, .lang-name { flex: 1; }
.country-meta { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.country-meta.soon {
  padding: 3px 8px;
  background: var(--bg-soft);
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.country-row.active .country-meta {
  color: var(--brand);
  font-weight: 700;
}


/* =====================================================================
   USER ID BLOCK (Account screen)
   ===================================================================== */
.userid-block {
  margin: 16px 0 14px 0;
  padding: 12px 14px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 14px;
  backdrop-filter: blur(4px);
}
.userid-label {
  font-size: 9.5px; font-weight: 800;
  letter-spacing: 2px;
  opacity: 0.7;
  margin-bottom: 4px;
}
.userid-copy {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: rgba(255,255,255,0.18);
  border-radius: 10px;
  font-family: "JetBrains Mono", "DejaVu Sans Mono", monospace;
  font-size: 17px; font-weight: 800;
  color: white;
  letter-spacing: 0.5px;
  border: 0;
  cursor: pointer;
}
.userid-copy:active { transform: scale(0.99); }
.userid-copy svg { opacity: 0.7; }
.userid-hint {
  font-size: 10.5px;
  opacity: 0.75;
  margin-top: 6px;
  text-align: center;
}

/* =====================================================================
   Form additions — helper chip + validation + modal search
   ===================================================================== */
.helper-chip {
  margin-top: 8px;
  padding: 8px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.helper-chip:active { transform: scale(0.97); background: #eff6ff; }

/* Disabled state for primary CTA when fields are incomplete */
.cta:disabled,
.cta.is-disabled {
  background: var(--line);
  color: var(--text-dim);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}
.cta:disabled svg,
.cta.is-disabled svg { color: var(--text-dim); }

/* Inline error state on form inputs */
.form-input.is-error,
.form-select.is-error {
  border-color: var(--danger);
  background: #fef2f2;
}
.form-input.is-error::placeholder { color: #fca5a5; }
.field-error {
  font-size: 11.5px;
  color: var(--danger);
  margin-top: 6px;
  font-weight: 500;
}

/* Modal search box */
.modal-search {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-soft);
  margin-bottom: 12px;
  outline: none;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.modal-search:focus {
  border-color: var(--brand);
  background: var(--surface);
}

/* Categories list */
.cat-list { display: flex; flex-direction: column; gap: 4px; }
.cat-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.cat-row:active { background: var(--bg-soft); }
.cat-row .cat-icon { font-size: 24px; line-height: 1; width: 28px; }
.cat-row .cat-name { flex: 1; }
.cat-row .cat-count { font-size: 11px; color: var(--text-dim); }
.cat-row .cat-chev { color: var(--text-dim); }

.cat-back { margin-bottom: 8px; }
.cat-back-btn {
  background: none;
  border: 0;
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
}

.product-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 10px;
  font-size: 14.5px;
  color: var(--text);
  text-align: left;
  margin-bottom: 4px;
  border: 1px solid var(--line-2);
  cursor: pointer;
}
.product-row:active { background: var(--bg-soft); }

/* ===== Upgrade plan modal ===== */
.upgrade-tier {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
}
.upgrade-tier.featured {
  border-color: var(--brand);
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  box-shadow: 0 8px 24px rgba(37,99,235,0.10);
}
.upgrade-tier .tier-badge {
  position: absolute; top: -8px; left: 16px;
  background: var(--brand);
  color: white;
  font-size: 9.5px; font-weight: 800;
  letter-spacing: 1.4px;
  padding: 3px 10px;
  border-radius: 999px;
}
.upgrade-tier .tier-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.upgrade-tier .tier-name {
  font-size: 15px; font-weight: 800; letter-spacing: 1.5px;
  color: var(--text-muted); text-transform: uppercase;
}
.upgrade-tier .tier-price {
  font-size: 22px; font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}
.upgrade-tier .tier-price .small { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.upgrade-tier ul {
  margin: 0 0 14px 0; padding: 0; list-style: none;
  font-size: 13px; color: var(--text);
}
.upgrade-tier ul li { padding: 4px 0; }
.upgrade-tier ul li::before { content: "✓ "; color: var(--emerald-dark); font-weight: 800; }
.upgrade-tier .pay-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.upgrade-tier .pay-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px;
  border-radius: 10px;
  font-size: 12.5px; font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.upgrade-tier .pay-btn.stars { background: linear-gradient(135deg, #fef3c7, #fde68a); border-color: #f59e0b; color: #92400e; }
.upgrade-tier .pay-btn.card  { background: linear-gradient(135deg, #2563eb, #1e40af); border-color: transparent; color: white; }
.upgrade-tier .pay-btn:active { transform: scale(0.98); }
.upgrade-foot {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 10px 0 4px;
}

/* =====================================================================
   NEWS TAB
   ===================================================================== */
.news-list { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.news-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.news-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  cursor: pointer;
}
.news-card:active { transform: scale(0.99); }
.news-card .news-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.news-card .news-emoji {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.news-card .news-trend {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #d1fae5;
  color: var(--emerald-dark);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
}
.news-card .news-trend.declining { background: #fee2e2; color: var(--danger); }
.news-card .news-trend.stable { background: var(--bg-soft); color: var(--text-muted); }
.news-card h3 {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.3;
}
.news-card .news-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.news-card .news-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
}
.news-card .news-source {
  padding: 2px 8px;
  background: var(--bg-soft);
  border-radius: 999px;
  font-weight: 600;
}
.news-card .news-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-2);
}
.news-card .news-btn {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.news-card .news-btn.primary {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: white;
  border-color: transparent;
}
.news-card .news-btn:active { transform: scale(0.97); }
.news-card .news-body {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}
.news-card.expanded .news-body { display: block; }


/* =====================================================================
   RESULTS SCREEN
   ===================================================================== */
.results-screen { padding-bottom: 100px; } /* room for sticky CTA */

.results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 12px 0;
  position: sticky; top: 0;
  background: var(--bg-soft);
  z-index: 50;
  margin: 0 -16px;
  padding-left: 16px; padding-right: 16px;
  border-bottom: 1px solid var(--line);
}
.back-btn {
  width: 40px; height: 40px;
  background: var(--surface);
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.back-btn:active { transform: scale(0.95); }
.results-title-block { flex: 1; min-width: 0; }
.results-title { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.2; }
.results-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 14px 0;
  margin: 0 -16px;
  padding-left: 16px; padding-right: 16px;
  scroll-snap-type: x mandatory;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.filter-chip[aria-pressed="true"] {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.filter-chip .filter-count {
  padding: 1px 6px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  font-size: 10.5px;
}
.filter-chip:not([aria-pressed="true"]) .filter-count {
  background: var(--line);
  color: var(--text-muted);
}
.filter-chip:active { transform: scale(0.96); }

/* =====================================================================
   SUPPLIER CARD (in results)
   ===================================================================== */
.supplier-list { display: flex; flex-direction: column; gap: 12px; }

.supplier-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.supplier-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--line);
}
.supplier-card.factory::before       { background: linear-gradient(180deg, #10b981, #059669); }
.supplier-card.trader-medium::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.supplier-card.trader-high::before   { background: linear-gradient(180deg, #ef4444, #dc2626); }
.supplier-card:active { transform: scale(0.99); box-shadow: var(--shadow); }

.sup-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.sup-rank {
  font-size: 11px; font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.sup-tier-badge {
  font-size: 10.5px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.4px;
}
.sup-tier-badge.factory       { background: #d1fae5; color: var(--emerald-dark); }
.sup-tier-badge.trader-medium { background: #fef3c7; color: #b45309; }
.sup-tier-badge.trader-high   { background: #fee2e2; color: var(--danger); }

.sup-name {
  font-size: 16px; font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  margin: 0;
}
.sup-cn {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}
.sup-meta {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Source badges + translated pill (multi-marketplace provenance) */
.sup-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.source-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.source-badge.src-alibaba {
  background: rgba(255, 102, 0, 0.10);
  color: #d35a00;
  border-color: rgba(255, 102, 0, 0.30);
}
.source-badge.src-1688 {
  background: rgba(220, 38, 38, 0.10);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.30);
}
.source-badge.src-canton {
  background: rgba(16, 185, 129, 0.10);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.30);
}
.source-badge.src-mic, .source-badge.src-other {
  background: rgba(99, 102, 241, 0.10);
  color: #4338ca;
  border-color: rgba(99, 102, 241, 0.30);
}
.translated-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.10);
  color: #1e40af;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Trust bar */
.trust-block { margin: 12px 0 12px 0; }
.trust-label {
  font-size: 10.5px; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.trust-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.trust-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--line-2);
  border-radius: 4px;
  overflow: hidden;
}
.trust-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.factory .trust-bar-fill       { background: linear-gradient(90deg, #10b981, #059669); }
.trader-medium .trust-bar-fill { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.trader-high .trust-bar-fill   { background: linear-gradient(90deg, #f87171, #dc2626); }
.trust-pct {
  font-size: 15px; font-weight: 800;
  min-width: 44px;
  text-align: right;
}
.factory .trust-pct       { color: var(--emerald-dark); }
.trader-medium .trust-pct { color: #b45309; }
.trader-high .trust-pct   { color: var(--danger); }

/* 3-stat row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
}
.stat-cell { text-align: center; }
.stat-lbl {
  font-size: 9.5px; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.stat-val {
  font-size: 14px; font-weight: 800;
  color: var(--text);
  margin-top: 2px;
  line-height: 1.1;
}
.stat-val.small { font-size: 12.5px; }

/* Total row */
.total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-2);
}
.total-lbl { font-size: 12px; color: var(--text-muted); }
.total-val {
  font-size: 20px; font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.3px;
}

/* Tap-to-drill-down hint */
.card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600;
  color: var(--brand);
}
.card-action svg { color: var(--brand); }

/* Sticky bottom CTA (Download PDF) */
.sticky-cta {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 80;
}
.sticky-cta .cta {
  box-shadow: 0 12px 28px rgba(37,99,235,0.30), 0 4px 8px rgba(15,23,42,0.10);
}

/* Hide the tab bar on the Results screen so the focus is the work */
.screen[data-active][data-screen="results"] ~ .tabbar { display: none; }
.screen[data-active][data-screen="detail"]  ~ .tabbar { display: none; }


/* =====================================================================
   SUPPLIER DETAIL SCREEN
   ===================================================================== */
.detail-screen { padding-bottom: 110px; }

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  position: sticky; top: 0;
  background: var(--bg-soft);
  z-index: 50;
  margin: 0 -16px;
  padding-left: 16px; padding-right: 16px;
  border-bottom: 1px solid var(--line);
}
.detail-title-block { flex: 1; min-width: 0; }
.detail-eyebrow {
  font-size: 9.5px; font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.detail-title {
  font-size: 14.5px; font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* HERO — gradient card with trust score centerpiece */
.detail-hero {
  margin: 14px -4px 0 -4px;
  padding: 22px 20px 24px 20px;
  border-radius: var(--r-lg);
  color: white;
  background: linear-gradient(135deg, #10b981 0%, #059669 60%, #047857 100%);
  box-shadow: 0 12px 28px rgba(16,185,129,0.25);
  position: relative;
}
.detail-hero[data-tier="trader-medium"] {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 60%, #d97706 100%);
  box-shadow: 0 12px 28px rgba(245,158,11,0.25);
}
.detail-hero[data-tier="trader-high"] {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 60%, #dc2626 100%);
  box-shadow: 0 12px 28px rgba(239,68,68,0.25);
}
.hero-tier-badge {
  display: inline-block;
  padding: 5px 12px;
  background: rgba(255,255,255,0.22);
  border-radius: 999px;
  font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.5px;
}
.hero-name {
  font-size: 22px; font-weight: 800;
  color: white;
  margin: 12px 0 0 0;
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.hero-cn {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
  font-weight: 500;
}
.hero-meta {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-top: 6px;
}

.hero-trust {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}
.hero-trust-bar {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.22);
  border-radius: 5px;
  overflow: hidden;
}
.hero-trust-fill {
  height: 100%;
  background: white;
  border-radius: 5px;
}
.hero-trust-pct {
  font-size: 32px; font-weight: 800;
  color: white;
  letter-spacing: -1px;
  line-height: 1;
}
.hero-trust-label {
  font-size: 10.5px; font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 6px;
}

/* Quick stats — 2x2 mobile, 4x1 wider */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.qs-cell {
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.qs-cell.highlight {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #93c5fd;
}
.qs-lbl {
  font-size: 9.5px; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.qs-val {
  font-size: 17px; font-weight: 800;
  color: var(--text);
  margin-top: 2px;
  line-height: 1.1;
}
.qs-cell.highlight .qs-val { color: var(--brand); }

/* Section in detail */
.detail-section { margin-top: 24px; }
.section-eyebrow {
  font-size: 11px; font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 0 0 10px 4px;
}

/* Tianyancha registry card in detail */
.registry-block-app {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.reg-cn {
  font-size: 15px; font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}
.reg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 6px;
  margin-bottom: 12px;
}
.reg-cell {
  padding: 10px 10px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
}
.reg-cell .reg-lbl {
  font-size: 9px; font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.reg-cell .reg-val {
  font-size: 16px; font-weight: 800;
  color: var(--text);
  margin-top: 2px;
  line-height: 1.1;
}
.reg-cell .reg-val.small { font-size: 12px; }
.reg-cell .reg-val.val-good { color: var(--emerald-dark); }
.reg-cell .reg-val.val-warn { color: #b45309; }
.reg-cell .reg-val.val-bad  { color: var(--danger); }
.reg-cell .reg-sub {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}
.reg-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}
.reg-foot-cell {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.reg-foot-cell .reg-foot-lbl { display: block; font-size: 10px; color: var(--text-dim); margin-bottom: 2px; }
.reg-foot-cell b { font-size: 14px; color: var(--text); }
.reg-foot-cell b.val-good { color: var(--emerald-dark); }
.reg-foot-cell b.val-bad  { color: var(--danger); }

/* Warning card */
.warning-card {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: var(--r-lg);
  padding: 16px;
}
.warning-title {
  font-size: 12.5px; font-weight: 800;
  color: #b45309;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.warning-sub {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  margin: 12px 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.warning-list {
  margin: 0; padding-left: 18px;
  font-size: 13px;
  color: var(--text);
}
.warning-list li { padding: 3px 0; }

/* Terms card */
.terms-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 4px 16px;
  box-shadow: var(--shadow-sm);
}
.terms-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.terms-row:last-child { border-bottom: 0; }
.terms-lbl { font-size: 13px; color: var(--text-muted); }
.terms-val { font-size: 13px; font-weight: 600; color: var(--text); text-align: right; }

/* Contact grid — tap-to-action */
.contact-grid { display: flex; flex-direction: column; gap: 8px; }
.contact-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  text-align: left;
  border: 0;
  width: 100%;
  font: inherit;
  cursor: pointer;
}
.contact-btn:active { transform: scale(0.99); }
.contact-btn svg {
  width: 22px; height: 22px;
  color: var(--brand);
  flex-shrink: 0;
}
.contact-lbl {
  font-size: 10px; font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.contact-val {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  margin-top: 1px;
  word-break: break-all;
}
.listing-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}
.listing-link:active { transform: scale(0.99); }

/* Sticky bottom 2-button CTA bar */
.sticky-cta-row {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
}
.sticky-cta-row .cta-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r);
  font-size: 14.5px; font-weight: 700;
  box-shadow: var(--shadow);
}
.sticky-cta-row .cta {
  padding: 16px;
  font-size: 14.5px;
}
.sticky-cta-row .primary-cta { box-shadow: 0 12px 28px rgba(37,99,235,0.30); }
