/* ═══════════════════════════════════════════════════════
   QUIET EDGE — premium analyst terminal
   ═══════════════════════════════════════════════════════ */

:root {
  /* Surfaces — 4 levels of depth */
  --bg:             #08080a;
  --surface-1:      #121215;
  --surface-2:      #1c1c20;
  --surface-3:      #26262c;
  --border:         rgba(255, 255, 255, 0.06);
  --border-strong:  rgba(255, 255, 255, 0.12);

  /* Text — 5 hierarchy levels */
  --text-100: #fafafa;
  --text-80:  #b8b8be;
  --text-60:  #76767e;
  --text-40:  #45454c;
  --text-20:  #2a2a2f;

  /* Accent — white-based (monochrome) */
  --accent:        #fafafa;
  --accent-hover:  #ffffff;
  --accent-bg:     rgba(255, 255, 255, 0.04);
  --accent-border: rgba(255, 255, 255, 0.14);

  /* Semantic — green/red kept for LONG/SHORT trader convention. Others demoted to gray. */
  --success:        #34d399;
  --success-bg:     rgba(52, 211, 153, 0.10);
  --success-border: rgba(52, 211, 153, 0.22);
  --danger:         #f87171;
  --danger-bg:      rgba(248, 113, 113, 0.10);
  --danger-border:  rgba(248, 113, 113, 0.22);
  --warning:        #d4d4d8;
  --warning-bg:     rgba(212, 212, 216, 0.06);
  --warning-border: rgba(212, 212, 216, 0.18);
  --info:           #b8b8be;

  /* Spacing scale — 4px base */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radii */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 999px;

  /* Easing */
  --ease-soft:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-land:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-100);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ───── Background — subtle radial vignette, NO blobs ───── */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 255, 255, 0.025) 0%, transparent 60%),
    var(--bg);
  pointer-events: none;
}
.blob { display: none; } /* legacy, hidden */

/* ───── Layout ───── */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding:
    calc(var(--space-5) + env(safe-area-inset-top))
    calc(var(--space-4) + env(safe-area-inset-right))
    calc(var(--space-8) + env(safe-area-inset-bottom))
    calc(var(--space-4) + env(safe-area-inset-left));
  min-height: 100vh;
}

/* ───── Header ───── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
  position: relative;
  overflow: hidden;
  color: var(--text-100);
}
.logo-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), transparent 70%);
}
.logo-icon svg {
  width: 100%;
  height: 100%;
  position: relative;
}

.logo-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-100);
}
.logo-sub {
  font-size: 11px;
  color: var(--text-60);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.stats-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 8px;
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-80);
  font-weight: 600;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 100ms var(--ease-soft), border-color 150ms ease;
}
.stats-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stats-icon svg { width: 100%; height: 100%; }
.stats-badge:active { transform: scale(0.96); }
.stats-badge.sub {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text-100);
}
/* Urgency states for FREE plan as quota dwindles */
.stats-badge.low {
  border-color: #d49a2a;
  color: #f0c46b;
}
.stats-badge.out {
  border-color: #d04848;
  background: rgba(208,72,72,0.12);
  color: #ff9090;
  animation: stats-pulse 1.6s ease-in-out infinite;
}
@keyframes stats-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(208,72,72,0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(208,72,72,0);   }
}

/* ───── Tabs ───── */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: var(--space-5);
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  color: var(--text-60);
  border: none;
  padding: 9px 4px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 180ms var(--ease-soft), background 180ms var(--ease-soft);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.tab.active {
  background: var(--surface-3);
  color: var(--text-100);
}
.tab-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.85;
}
.tab.active .tab-icon { opacity: 1; }

/* ───── Views ───── */
.view { animation: fade-in 240ms var(--ease-soft); }
.hidden { display: none !important; }

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

/* ───── Buttons ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 13px var(--space-5);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 80ms var(--ease-soft), background 180ms ease, border-color 180ms ease;
  width: 100%;
  letter-spacing: -0.01em;
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0d;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--surface-1);
  border-color: var(--border-strong);
  color: var(--text-80);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text-100); }
.btn-secondary:active { transform: scale(0.97); }
.btn-ghost {
  background: transparent;
  color: var(--text-60);
  padding: var(--space-3);
  font-size: 13px;
}
.btn-ghost:active { color: var(--text-100); }

/* ───── Upload card ───── */
.upload-card {
  position: relative;
  border-radius: var(--r-xl);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), transparent 50%),
    var(--surface-1);
  border: 1px solid var(--border);
  padding: var(--space-12) var(--space-5) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: border-color 240ms ease, background 240ms ease, transform 240ms ease;
  overflow: hidden;
}
.upload-card::before {
  /* Soft radial highlight behind the icon */
  content: '';
  position: absolute;
  top: -40px;
  left: 50%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 55%);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 300ms ease;
}
.upload-card:not(.has-files) { animation: breathe 5s ease-in-out infinite; }
.upload-card:hover, .upload-card.dragover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.upload-card:hover::before, .upload-card.dragover::before {
  opacity: 1;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.004); }
}

/* ─── Scan-line animation (idle state only) ───
   Thin glowing line ping-pongs top↔bottom continuously to communicate
   "this is a scanner" before the user has uploaded anything.
   ease-in-out gives a natural pause at each edge — like a real flatbed.
   Pauses as soon as files are queued (.has-files) — user is in action mode. */
.upload-card:not(.has-files)::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 100%
  );
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.35),
    0 0 28px rgba(255, 255, 255, 0.18);
  animation: scan-sweep 2.8s cubic-bezier(0.4, 0, 0.6, 1) infinite alternate;
}

@keyframes scan-sweep {
  0%   { top: -2px;  }
  100% { top: calc(100% - 2px); }
}

.upload-card > * {
  position: relative;
  z-index: 1;
}

.upload-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-5);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #ffffff 0%, #d4d4d8 60%, #9b9ba1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0a0d;
  box-shadow:
    0 12px 32px rgba(255, 255, 255, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 0 0 1px rgba(255, 255, 255, 0.15);
}
.upload-icon svg {
  width: 28px;
  height: 28px;
  stroke-width: 2;
}

.upload-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-2);
  color: var(--text-100);
}
.upload-sub {
  color: var(--text-60);
  font-size: 13px;
  margin-bottom: var(--space-6);
  letter-spacing: -0.005em;
}

/* ───── Upload queue ───── */
.queue {
  position: relative;
  z-index: 1;
}
.queue-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.queue-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  animation: scale-in 240ms var(--ease-soft);
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.queue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.queue-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease;
}
.queue-remove:active { background: var(--danger); }
.queue-tf {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
}
.queue-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.queue-hint {
  margin-top: var(--space-3);
  font-size: 11px;
  color: var(--text-60);
  text-align: center;
}

/* ───── Loading ───── */
.loading-card {
  border-radius: var(--r-xl);
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: var(--space-6) var(--space-5);
  text-align: center;
}
.loading-preview {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin-bottom: var(--space-5);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.loading-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: shimmer 1.8s infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-bar {
  width: 100%;
  height: 3px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.loading-bar-inner {
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: var(--r-full);
  animation: progress 1.6s ease-in-out infinite;
}
@keyframes progress {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}

.loading-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}
.loading-sub {
  color: var(--text-60);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════
   RESULT VIEW — staggered cascade
   ═══════════════════════════════════════════════════════ */
.result-card {
  border-radius: var(--r-xl);
  background: var(--surface-1);
  border: 1px solid var(--border);
  overflow: hidden;
}

.result-preview {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5) var(--space-1);
}
.tag {
  padding: 5px var(--space-3);
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-80);
  letter-spacing: 0.01em;
}
.tag.asset {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text-100);
}
.tag.trend-up      { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.tag.trend-down    { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.tag.trend-sideways{ background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.tag.live {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text-80);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--success);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
  animation: live-pulse 1.8s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

.result-section {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}
.result-section:first-of-type { border-top: none; }
.result-section.animate-in {
  animation: section-in 380ms var(--ease-soft) backwards;
}
@keyframes section-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-60);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}

/* Thesis — hero card */
.thesis-card {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-lg);
  padding: var(--space-4) var(--space-4);
}
.thesis-text {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text-100);
  letter-spacing: -0.005em;
}

/* Context note — single line */
.context-note {
  font-size: 13px;
  color: var(--text-80);
  line-height: 1.5;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border-left: 2px solid var(--border-strong);
  border-radius: var(--r-sm);
}

/* ───── Levels (vertical stack) ───── */
.levels-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.levels-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.level-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.level-head.support    { color: var(--success); }
.level-head.resistance { color: var(--danger); }

.level-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.level-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border-left: 2px solid transparent;
}
.level-item.support    { border-left-color: var(--success); }
.level-item.resistance { border-left-color: var(--danger); }
.level-price {
  font-family: 'Geist Mono', 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-100);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.level-reason {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-60);
}

/* Observations */
.observations {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.observations li {
  padding-left: var(--space-4);
  position: relative;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-80);
}
.observations li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--text-60);
}

/* ───── Signal card + trade plan ───── */
.signal-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-4);
}
.signal-badge {
  display: inline-block;
  padding: 5px var(--space-3);
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 12px;
  margin-bottom: var(--space-4);
  letter-spacing: 0.02em;
}
.signal-badge.long  { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.signal-badge.short { background: var(--danger-bg);  border: 1px solid var(--danger-border);  color: var(--danger); }
.signal-badge.wait  { background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning); }

.plan-row {
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
}
.plan-row:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: var(--space-4);
}
.plan-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-60);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-1);
}
.plan-label.danger  { color: var(--danger); }
.plan-label.success { color: var(--success); }

.plan-price {
  font-family: 'Geist Mono', 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-100);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.plan-price.danger  { color: var(--danger); }
.plan-price.success { color: var(--success); }

.plan-meta {
  font-size: 12px;
  color: var(--text-60);
  margin-top: 2px;
}
.plan-meta:empty { display: none; }

.plan-reason {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--text-60);
  line-height: 1.5;
  padding-left: var(--space-3);
  border-left: 2px solid var(--border-strong);
}

.tp-item {
  padding: var(--space-2) var(--space-3);
  background: var(--success-bg);
  border-left: 2px solid var(--success);
  border-radius: var(--r-sm);
  margin-top: var(--space-2);
}
.tp-item:first-child { margin-top: var(--space-1); }
.tp-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}
.tp-price {
  font-family: 'Geist Mono', 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}
.tp-rr {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-60);
  font-family: 'Geist Mono', 'JetBrains Mono', monospace;
}
.tp-reason {
  font-size: 11px;
  color: var(--text-60);
  line-height: 1.45;
}

.plan-footer {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.plan-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.plan-stat-label {
  font-size: 10px;
  color: var(--text-60);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.plan-stat-value {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Geist Mono', 'JetBrains Mono', monospace;
  color: var(--text-100);
  font-variant-numeric: tabular-nums;
}

/* Confidence */
.conf-value {
  padding: 3px var(--space-2);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}
.conf-value.low    { background: var(--danger-bg);  color: var(--danger); }
.conf-value.medium { background: var(--warning-bg); color: var(--warning); }
.conf-value.high   { background: var(--success-bg); color: var(--success); }
.conf-reason {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--text-60);
  line-height: 1.45;
}

/* Risk / invalidation cards */
.invalidation-card {
  background: var(--danger-bg);
  border-left: 2px solid var(--danger);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-100);
}
.planb-card {
  background: var(--surface-2);
  border-left: 2px solid var(--text-60);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-80);
}
.result-actions {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}
.disclaimer {
  padding: 0 var(--space-5) var(--space-4);
  font-size: 10px;
  color: var(--text-40);
  text-align: center;
  letter-spacing: 0.02em;
}

/* ───── Error + Paywall ───── */
.error-card, .paywall-card {
  border-radius: var(--r-xl);
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: var(--space-8) var(--space-5);
  text-align: center;
}
.error-icon, .paywall-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-80);
}
.error-icon svg, .paywall-icon svg {
  width: 26px;
  height: 26px;
}
.error-title, .paywall-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
  color: var(--text-100);
}
.error-text, .paywall-text {
  color: var(--text-60);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: var(--space-5);
}

.paywall-price {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: var(--space-5);
  color: var(--text-100);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.paywall-price span {
  font-size: 16px;
  color: var(--text-60);
  font-weight: 500;
}
.paywall-card .btn { margin-bottom: var(--space-2); }

.paywall-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-60);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.paywall-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4) 0;
  text-align: left;
  width: 100%;
  max-width: 340px;
}
.paywall-perks li {
  position: relative;
  padding: var(--space-2) 0 var(--space-2) 26px;
  font-size: 13.5px;
  color: var(--text-80);
  line-height: 1.45;
  border-top: 1px solid var(--border);
}
.paywall-perks li:first-child { border-top: none; }
.paywall-perks li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 12 10 16 18 8'/></svg>");
  background-size: 11px 11px;
  background-repeat: no-repeat;
  background-position: center;
}

.paywall-hook {
  font-size: 13px;
  color: var(--text-80);
  line-height: 1.5;
  padding: var(--space-3) var(--space-3);
  margin-bottom: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  width: 100%;
  max-width: 340px;
}
.paywall-hook b { color: var(--text-100); font-weight: 700; }

.btn-big {
  padding: 14px var(--space-4);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

/* ───── Home upsell bar ───── */
.home-upsell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 10px 12px;
  margin-bottom: var(--space-3);
  border-radius: var(--r-sm);
  background: rgba(208,72,72,0.10);
  border: 1px solid rgba(208,72,72,0.35);
  color: #ff9090;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 150ms ease;
}
.home-upsell:hover { background: rgba(208,72,72,0.16); }
.home-upsell.warn {
  background: rgba(212,154,42,0.08);
  border-color: rgba(212,154,42,0.35);
  color: #f0c46b;
}
.home-upsell-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 currentColor;
  animation: upsell-dot 1.8s ease-in-out infinite;
}
@keyframes upsell-dot {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; }
  50%      { box-shadow: 0 0 0 5px transparent; }
}
.home-upsell-text { flex: 1; }
.home-upsell-text b { font-weight: 700; color: var(--text-100); }
.home-upsell-cta {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ───── Cabinet perks (FREE plan only) ───── */
.cabinet-perks {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0 0;
}
.cabinet-perks li {
  position: relative;
  padding: 6px 0 6px 22px;
  font-size: 13px;
  color: var(--text-80);
  line-height: 1.4;
}
.cabinet-perks li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 6px;
  color: var(--text-100);
  font-weight: 700;
  font-size: 12px;
}

/* ───── Post-analysis CTA (result view, FREE plan) ───── */
.result-upsell {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background 150ms ease;
}
.result-upsell:hover { background: var(--surface-2); }
.result-upsell-body { flex: 1; }
.result-upsell-text {
  font-size: 12px;
  color: var(--text-60);
  margin-bottom: 2px;
}
.result-upsell-cta {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-100);
}
.result-upsell-arrow {
  color: var(--text-40);
  font-size: 18px;
}

/* ═══════════════════════════════════════════════════════
   HISTORY TAB
   ═══════════════════════════════════════════════════════ */
.history-header { margin-bottom: var(--space-4); }
.history-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.history-sub {
  font-size: 13px;
  color: var(--text-80);
  letter-spacing: -0.005em;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 100ms ease, background 180ms ease, border-color 180ms ease;
}
.history-item:hover { background: var(--surface-2); border-color: var(--border-strong); }
.history-item:active { transform: scale(0.99); }
.history-signal {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.history-signal svg { width: 18px; height: 18px; }
.history-signal.long  { background: var(--success-bg); color: var(--success); }
.history-signal.short { background: var(--danger-bg);  color: var(--danger); }
.history-signal.wait  { background: var(--warning-bg); color: var(--warning); }
.history-signal.err   { background: var(--surface-2);  color: var(--text-40); }
.history-meta { flex: 1; min-width: 0; }
.history-asset {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-100);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.history-detail {
  font-size: 12px;
  color: var(--text-60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-time {
  font-size: 11px;
  color: var(--text-60);
  flex-shrink: 0;
  letter-spacing: 0.01em;
}
.history-empty {
  text-align: center;
  padding: var(--space-12) var(--space-5);
  color: var(--text-60);
  font-size: 13px;
  line-height: 1.6;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: 3px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.page-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-80);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease;
}
.page-btn:active { background: var(--surface-2); }
.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.page-info {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--text-60);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════
   ALERTS TAB
   ═══════════════════════════════════════════════════════ */
.alerts-header { margin-bottom: var(--space-4); }
.alerts-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.alerts-sub {
  font-size: 13px;
  color: var(--text-80);
  letter-spacing: -0.005em;
}

.alerts-form {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.alert-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
.alert-input {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 14px var(--space-4);
  font-size: 15px;
  font-family: inherit;
  color: var(--text-100);
  width: 100%;
  outline: none;
  transition: border-color 180ms ease, background 180ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.alert-input::placeholder { color: var(--text-60); }
.alert-input:focus {
  border-color: var(--text-60);
  background: var(--bg);
}
.alert-price-input {
  font-family: 'Geist Mono', 'JetBrains Mono', monospace;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#alertSymbol { text-transform: uppercase; letter-spacing: 0.02em; }
.alert-hint {
  font-size: 11px;
  color: var(--text-60);
  text-align: center;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.alert-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--r-md);
  background: var(--surface-1);
  border: 1px solid var(--border);
  animation: scale-in 240ms var(--ease-soft);
}
.alert-arrow {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.alert-arrow svg { width: 18px; height: 18px; }
.alert-arrow.up   { background: var(--success-bg); color: var(--success); }
.alert-arrow.down { background: var(--danger-bg);  color: var(--danger); }
.alert-body { flex: 1; min-width: 0; }
.alert-symbol {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-100);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.alert-exch {
  color: var(--text-60);
  font-weight: 500;
  font-size: 12px;
}
.alert-target {
  font-family: 'Geist Mono', 'JetBrains Mono', monospace;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-100);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.alert-current {
  font-size: 12px;
  color: var(--text-60);
  margin-top: 3px;
}
.alert-current.pos { color: var(--success); }
.alert-current.neg { color: var(--danger); }
.alert-delete {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-60);
  border: none;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 150ms ease, color 150ms ease;
}
.alert-delete svg { width: 16px; height: 16px; }
.alert-delete:hover { background: var(--danger-bg); color: var(--danger); }
.alert-delete:active { background: var(--danger); color: white; }

.alerts-empty {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  color: var(--text-60);
  font-size: 13px;
  line-height: 1.6;
}

/* ───── Toast ───── */
.alert-toast {
  position: fixed;
  bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-100);
  z-index: 1000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: toast-in 220ms var(--ease-soft);
}
.alert-toast.error   { border-color: var(--danger-border);  color: var(--text-100); }
.alert-toast.success { border-color: var(--success-border); color: var(--text-100); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ═══════════════════════════════════════════════════════
   MORE TAB
   ═══════════════════════════════════════════════════════ */
.more-card {
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--space-5);
}
.more-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 150ms ease;
}
.more-row:first-child { border-top: none; }
.more-row:hover { background: var(--surface-2); }
.more-row:active { background: var(--surface-2); }
.more-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-80);
}
.more-icon svg {
  width: 18px;
  height: 18px;
}
.more-body { flex: 1; min-width: 0; }
.more-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--text-100);
}
.more-text {
  font-size: 12px;
  color: var(--text-60);
  margin-top: 2px;
}
.more-arrow {
  color: var(--text-40);
  font-size: 18px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   CABINET
   ═══════════════════════════════════════════════════════ */
.cabinet-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.cabinet-head .back-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-80);
  cursor: pointer;
  flex-shrink: 0;
}
.cabinet-head .back-btn:hover { background: var(--surface-2); color: var(--text-100); }
.cabinet-head .back-btn svg { width: 16px; height: 16px; }
.cabinet-head-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-100);
}

.cabinet-card {
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.cabinet-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-40);
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.cabinet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.cabinet-row:first-of-type { border-top: none; padding-top: 0; }
.cabinet-row[hidden] { display: none; }
.cabinet-row-label {
  font-size: 13px;
  color: var(--text-60);
}
.cabinet-row-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-100);
  font-variant-numeric: tabular-nums;
  font-family: 'Geist Mono', monospace;
}

.cabinet-plan {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.cabinet-plan-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-100);
}
.cabinet-plan-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-100);
}
.plan-vip .cabinet-plan-badge {
  border-color: var(--text-100);
  background: var(--text-100);
  color: var(--bg-base);
}
.plan-pro .cabinet-plan-badge {
  border-color: var(--text-80);
  color: var(--text-100);
}
.plan-free .cabinet-plan-badge {
  color: var(--text-60);
}

.cabinet-cta {
  width: 100%;
  margin-top: var(--space-3);
}

/* ═══════════════════════════════════════════════════════
   REFERRAL VIEW
   ═══════════════════════════════════════════════════════ */
.ref-hero {
  text-align: center;
  padding: var(--space-5) var(--space-4);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  margin-bottom: var(--space-3);
}
.ref-hero-amount {
  font-family: 'Geist Mono', monospace;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-100);
  line-height: 1;
  margin-bottom: var(--space-2);
}
.ref-hero-text {
  font-size: 13px;
  color: var(--text-60);
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}

.ref-link {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  overflow: hidden;
}
.ref-link-text {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--text-80);
  word-break: break-all;
  line-height: 1.4;
}

.ref-actions {
  display: flex;
  gap: var(--space-2);
}
.ref-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.ref-action svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ref-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.ref-step:first-of-type {
  border-top: none;
  padding-top: 0;
}
.ref-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-100);
  flex-shrink: 0;
}
.ref-step-text {
  font-size: 13px;
  color: var(--text-80);
  line-height: 1.5;
  padding-top: 3px;
}
.ref-step-text b {
  color: var(--text-100);
  font-weight: 600;
  font-family: 'Geist Mono', monospace;
}

/* ───── Reduced motion ───── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
