@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0a0f1d;
  --surface: #0f172a;
  --surface-muted: #1e293b;
  --surface-input: #0b1226;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  --text-faint: #64748b;
  --primary: #818cf8;
  --primary-strong: #6366f1;
  --primary-soft: rgba(99, 102, 241, 0.14);
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px -12px rgba(0, 0, 0, 0.6), 0 4px 10px -4px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  min-height: 100vh;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 28px 100px;
}

/* ── Auth Nav ─────────────────────────────────────────────────────────────── */
.auth-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.auth-btn {
  font-size: 13px;
  padding: 8px 16px;
}
.btn-signup {
  display: inline-flex; align-items: center;
  background: linear-gradient(135deg, var(--primary-strong) 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  transition: transform .1s ease, box-shadow .15s ease;
}
.btn-signup:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.55);
}

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-container { max-width: 480px; }
.login-panel { padding: 28px; }
.login-field { margin-bottom: 18px; }
.login-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 8px;
}
.login-btn { width: 100%; margin-top: 4px; }
.footer-link { color: var(--primary); text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  margin-bottom: 48px;
  position: relative;
}

/* Animated aurora blob behind hero */
.hero::before {
  content: '';
  position: absolute;
  top: -60px; left: -80px;
  width: 600px; height: 400px;
  background: radial-gradient(ellipse at 40% 40%,
    rgba(99, 102, 241, 0.12) 0%,
    rgba(139, 92, 246, 0.07) 40%,
    transparent 70%);
  pointer-events: none;
  animation: aurora 8s ease-in-out infinite alternate;
  border-radius: 50%;
}
@keyframes aurora {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.7; }
  50%  { transform: translate(30px, -20px) scale(1.08); opacity: 1; }
  100% { transform: translate(-10px, 15px) scale(0.96); opacity: 0.8; }
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(129, 140, 248, 0.3);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  text-transform: uppercase;
}
.eyebrow-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

.hero h1 {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin: 0 0 16px;
  color: var(--text);
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 45%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
  max-width: 600px;
  font-weight: 400;
}
.hero-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 24px;
}
.btn-ghost {
  display: inline-flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.hero .meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 22px;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12px;
  color: var(--text-subtle);
  backdrop-filter: blur(8px);
}
.chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.chip strong { color: var(--text); font-weight: 600; }

/* ── Stats strip ──────────────────────────────────────────────────────────── */
.stat-strip {
  display: flex; align-items: center; gap: 0;
  margin-top: 28px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 14px 20px;
  backdrop-filter: blur(8px);
  overflow: hidden;
}
.stat-item {
  flex: 1;
  text-align: center;
  padding: 0 16px;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.stat-item:last-child { border-right: none; }
.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}
.stat-label {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ── How it works ─────────────────────────────────────────────────────────── */
.how {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 36px;
}
.how-step {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  transition: border-color .2s ease;
}
.how-step:hover { border-color: rgba(129,140,248,0.3); }
.how-n {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.how-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.how-body {
  font-size: 12px;
  color: var(--text-subtle);
  line-height: 1.5;
}

/* ── Feature cards ────────────────────────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.feature-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 24px 22px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(129,140,248,0.5), transparent);
  opacity: 0;
  transition: opacity .2s ease;
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: rgba(129, 140, 248, 0.4);
  box-shadow: 0 12px 32px -8px rgba(99, 102, 241, 0.25), 0 4px 12px rgba(0,0,0,0.3);
}
.feature-card:hover::before { opacity: 1; }
.feature-icon {
  width: 40px; height: 40px;
  background: var(--primary-soft);
  border: 1px solid rgba(129,140,248,0.25);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  color: var(--primary);
}
.feature-icon svg { width: 20px; height: 20px; }
.feature-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.feature-body {
  font-size: 13px;
  color: var(--text-subtle);
  line-height: 1.55;
}

/* ── Section / Panel ──────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(129, 140, 248, 0.3);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px 28px;
  margin-bottom: 20px;
  transition: border-color .2s ease;
}
.panel:hover { border-color: rgba(129,140,248,0.25); border-left-color: rgba(129,140,248,0.5); }
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 20px;
}
.panel-head h2 {
  font-size: 16px; font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}
.panel-head .hint {
  font-size: 12px; color: var(--text-subtle);
}

/* ── Rows (data entry grid) ───────────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) minmax(100px, 0.9fr) 86px 100px 70px 40px;
  gap: 10px;
  align-items: center;
}
.row.header-row {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 0 2px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.row.header-row .col-action { visibility: hidden; }

input[type="text"], input[type="number"], select {
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input[type="text"].ticker {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}
input[type="number"] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: #0f172a;
}
input:disabled { opacity: 0.55; cursor: not-allowed; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-subtle);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px; line-height: 1;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.btn-icon:hover {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.add-row {
  margin-top: 12px;
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.1);
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.add-row:hover {
  color: var(--primary);
  border-color: rgba(129,140,248,0.4);
  background: var(--primary-soft);
}

/* Cash rows: no ticker column */
.row.cash-row {
  grid-template-columns: minmax(120px, 1fr) 86px 100px 70px 40px;
}

/* Target % input — compact */
input.target-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Ticker search ────────────────────────────────────────────────────────── */
.ticker-cell { position: relative; }

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 50;
  background: #141e35;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px -8px rgba(0,0,0,0.7), 0 4px 12px rgba(0,0,0,0.4);
  max-height: 280px;
  overflow-y: auto;
  min-width: 280px;
}
.search-dropdown[hidden] { display: none; }
.search-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
  transition: background .1s ease;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: rgba(99,102,241,0.12); }
.search-ticker {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--primary);
  font-size: 12px;
}
.search-name {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-exch {
  color: var(--text-faint);
  font-size: 10.5px;
  background: var(--surface-muted);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ── Preview strip ────────────────────────────────────────────────────────── */
.preview {
  grid-column: 1 / -1;
  margin-top: -4px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
  display: none;
}
.preview.visible { display: block; }
.preview.ok {
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: var(--text-muted);
}
.preview.ok strong { color: var(--success); }
.preview.err {
  background: rgba(248, 113, 113, 0.07);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--text-muted);
}
.preview.err strong { color: var(--danger); }
.preview.loading {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-subtle);
}
.preview .fund { font-weight: 600; color: var(--text); }
.preview .holdings {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Analyze bar ──────────────────────────────────────────────────────────── */
.analyze-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
  margin-top: 10px;
  padding: 22px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px -4px rgba(0,0,0,0.5);
  position: sticky;
  bottom: 20px;
  backdrop-filter: blur(10px);
  z-index: 10;
}
.analyze-bar .summary {
  font-size: 13px;
  color: var(--text-muted);
}
.analyze-bar .summary strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* New money field */
.new-money-wrap {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.new-money-label {
  font-size: 12px; color: var(--text-subtle); font-weight: 500;
  white-space: nowrap;
}
.new-money-prefix { font-size: 12px; color: var(--text-muted); }
.new-money-input {
  width: 90px !important;
  padding: 8px 10px !important;
  font-size: 13px !important;
  text-align: right;
}
.new-money-hint {
  font-size: 11.5px; color: var(--text-faint); white-space: nowrap;
}

/* ── Primary button with shimmer ──────────────────────────────────────────── */
.btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-strong) 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 30px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: transform .1s ease, box-shadow .15s ease, opacity .15s ease;
  box-shadow: 0 4px 16px -2px rgba(99, 102, 241, 0.5);
  white-space: nowrap;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  transition: left 0s;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -2px rgba(99, 102, 241, 0.6);
}
.btn-primary:hover::after {
  left: 150%;
  transition: left 0.5s ease;
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Loading overlay ──────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 29, 0.88);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.loading-overlay.visible { display: flex; }
.loading-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 36px 44px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 24px 60px -12px rgba(0,0,0,0.8), 0 0 0 1px rgba(129,140,248,0.1);
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--surface-muted);
  border-top-color: var(--primary);
  border-right-color: rgba(167,139,250,0.6);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card h3 {
  margin: 0 0 8px;
  font-size: 16px; font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.loading-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-subtle);
  line-height: 1.5;
}

/* ── Analyze progress bar ─────────────────────────────────────────────────── */
.progress-track {
  width: 100%; height: 8px;
  background: var(--surface-muted);
  border-radius: 999px;
  overflow: hidden;
  margin: 18px 0 10px;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  animation: progress-shimmer 1.2s linear infinite;
}
@keyframes progress-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.progress-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; font-size: 13px; color: var(--text-subtle);
  margin-bottom: 20px;
}
.progress-pct {
  font-variant-numeric: tabular-nums;
  color: var(--text); font-weight: 600;
  flex-shrink: 0;
}

.load-steps {
  list-style: none; margin: 0; padding: 0;
  display: flex; justify-content: space-between; gap: 6px;
}
.load-steps li {
  flex: 1; text-align: center;
  font-size: 10.5px; line-height: 1.3;
  color: var(--text-faint, #64748b);
  position: relative; padding-top: 16px;
  transition: color 0.3s ease;
}
.load-steps li::before {
  content: ""; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface-muted);
  border: 2px solid var(--border-strong);
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.load-steps li.done { color: var(--text-subtle); }
.load-steps li.done::before { background: var(--primary); border-color: var(--primary); }
.load-steps li.active { color: var(--text); }
.load-steps li.active::before {
  background: var(--primary); border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(129,140,248,0.18);
}

/* ── Error banner ─────────────────────────────────────────────────────────── */
.banner {
  display: none;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
}
.banner.visible { display: block; }
.banner.error {
  background: rgba(248, 113, 113, 0.07);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-left: 3px solid var(--danger);
  color: var(--text-muted);
}
.banner.error strong { color: var(--danger); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.8;
}
footer a { color: var(--text-subtle); text-decoration: none; }
footer a:hover { color: var(--primary); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .how { grid-template-columns: repeat(2, 1fr); }
  .features { grid-template-columns: 1fr; }
  .stat-strip { flex-wrap: wrap; }
  .stat-item { flex: 0 0 50%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.07); padding: 10px 0; }
  .stat-item:nth-last-child(-n+2) { border-bottom: none; }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 36px; }
  .hero .subtitle { font-size: 15px; }
  .container { padding: 24px 18px 80px; }
  .analyze-bar { flex-direction: column; align-items: stretch; gap: 14px; bottom: 12px; }
  .btn-primary { width: 100%; text-align: center; padding: 14px; }
  .how { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr 1fr 90px 40px; }
  .new-money-wrap { justify-content: space-between; }
  .new-money-hint { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 20px 14px 72px; }
  .panel { padding: 18px 16px; }
  .hero h1 { font-size: 30px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn-ghost { justify-content: center; }
  .stat-strip { padding: 12px 14px; }
  .stat-value { font-size: 16px; }
  .row {
    grid-template-columns: 1fr 90px 36px;
    grid-template-areas:
      "ticker ticker ticker"
      "amount currency action";
    row-gap: 8px;
    padding: 10px;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
  }
  .row > .ticker-cell { grid-area: ticker; }
  .row > div:not(.ticker-cell):nth-child(2) { grid-area: amount; }
  .row > div:not(.ticker-cell):nth-child(3) { grid-area: currency; }
  .row > div:not(.ticker-cell):nth-child(4) { grid-area: action; justify-self: end; }
  .row .preview { grid-column: 1 / -1; margin-top: 4px; }
  .row.header-row { display: none; }
  .btn-icon { width: 32px; height: 32px; }
  .row.cash-row {
    grid-template-columns: 1fr 90px 36px;
    grid-template-areas: "amount currency action";
  }
  .row.cash-row > div:nth-child(1) { grid-area: amount; }
  .row.cash-row > div:nth-child(2) { grid-area: currency; }
  .row.cash-row > div:nth-child(3) { grid-area: action; justify-self: end; }
  .search-dropdown { min-width: 0; }
}

/* ── Auth Modal ───────────────────────────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-overlay[hidden] { display: none; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  padding: 36px 40px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
}

.auth-close {
  position: absolute; top: 16px; right: 18px;
  background: none; border: none;
  color: var(--text-faint); font-size: 22px; line-height: 1;
  cursor: pointer; padding: 4px;
  transition: color .15s;
}
.auth-close:hover { color: var(--text); }

.auth-tabs {
  display: flex; gap: 4px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1; background: none; border: none;
  color: var(--text-subtle); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 6px;
  cursor: pointer; transition: all .15s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-desc {
  color: var(--text-subtle); font-size: 14px;
  margin: 0 0 20px; line-height: 1.5;
}

.auth-input {
  display: block; width: 100%;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px;
  padding: 11px 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color .15s;
}
.auth-input:focus { border-color: var(--primary); }

.auth-submit {
  width: 100%; margin-top: 6px;
  padding: 13px 0; font-size: 15px;
}

.auth-error {
  color: var(--danger); font-size: 13px;
  margin-bottom: 10px; min-height: 18px;
}

.auth-success {
  color: var(--success); font-size: 13px;
  margin-top: 14px; text-align: center;
  padding: 12px; background: rgba(52,211,153,0.08);
  border-radius: var(--radius-sm);
}
.auth-success[hidden] { display: none; }

.auth-pane[hidden] { display: none; }

/* --- OAuth (Google) button --- */
.btn-oauth {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  background: #ffffff;
  color: #1f2328;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  padding: 11px 14px;
  cursor: pointer;
  transition: filter .15s, box-shadow .15s;
}
.btn-oauth:hover { filter: brightness(0.97); box-shadow: var(--shadow-sm); }
.btn-oauth:active { filter: brightness(0.94); }
.btn-oauth:disabled { opacity: .6; cursor: default; }
.btn-oauth .g-icon { flex-shrink: 0; }

/* --- In-app browser warning --- */
.auth-webview-note {
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.30);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #fcd34d;
}
.auth-webview-note strong { color: #fde68a; }
.auth-webview-note .wv-dots {
  font-weight: 700; color: #fde68a;
  padding: 0 4px;
}
.auth-webview-note[hidden] { display: none; }
/* Google button can't work in an in-app browser — visually de-emphasize it. */
.btn-oauth.oauth-blocked { opacity: 0.45; }

/* --- "or" divider --- */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0;
  color: var(--text-subtle); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* --- Resend confirmation --- */
.auth-success-email { font-weight: 600; word-break: break-all; }
.auth-resend {
  margin-top: 10px; font-size: 12.5px; color: var(--text-subtle);
}
.auth-resend-btn {
  background: none; border: none; padding: 0;
  color: var(--primary); font-size: 12.5px; font-weight: 600;
  cursor: pointer; text-decoration: underline;
}
.auth-resend-btn:disabled { opacity: .6; cursor: default; }
.auth-resend-status { margin-left: 6px; }
