
/* --- Tokens ----------------------------------------------------- */
:root {
  /* Surfaces */
  --bg: #0a0e1a;          /* base */
  --bg-elevated: #11172a; /* card */
  --bg-input: #0d1322;    /* form fields */
  --border: #1f2942;
  --border-strong: #2a3656;

  /* Ink */
  --fg: #e8edf7;
  --fg-muted: #8b96b8;
  --fg-subtle: #5e6a8a;

  /* Brand */
  --brand: #2dd4bf;       /* mint — primary action / "earning" green */
  --brand-soft: rgba(45, 212, 191, 0.12);
  --brand-strong: #14b8a6;

  /* Status */
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #f87171;
  --info: #60a5fa;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.45);
  --shadow-glow: 0 0 0 1px rgba(45,212,191,0.3), 0 0 24px rgba(45,212,191,0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-display: "Geist", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* --- Fonts (Google) --------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&family=Noto+Sans+TC:wght@400;500;600;700&display=swap');

/* --- Reset ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-display);
  font-feature-settings: "ss01", "cv11";
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle radial accent on the body to give pages depth without a literal
   image asset. Only on dark surfaces. */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 12% -10%, rgba(45,212,191,0.08), transparent 50%),
    radial-gradient(ellipse 700px 500px at 88% 110%, rgba(96,165,250,0.06), transparent 50%);
  pointer-events: none;
  z-index: 0;
}
main, .app-shell, .marketing-shell { position: relative; z-index: 1; }

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-strong); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--brand-soft); color: var(--fg); }

/* Hide scrollbar in Webkit but keep functional scroll */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* --- Typography ------------------------------------------------- */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 16px;
  color: var(--fg);
}
h1 { font-size: clamp(32px, 4vw, 48px); letter-spacing: -0.03em; }
h2 { font-size: 22px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em;
     color: var(--fg-muted); font-weight: 500; }
p { margin: 0 0 12px; color: var(--fg-muted); }

/* Tabular numerals for any financial figure */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* --- Buttons ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  background: transparent; color: var(--fg);
  transition: all .15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--brand); color: #062420;
  border-color: var(--brand);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-strong); border-color: var(--brand-strong);
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.btn-secondary {
  background: var(--bg-elevated); border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); background: var(--bg-input); }
.btn-ghost { color: var(--fg-muted); }
.btn-ghost:hover { color: var(--fg); background: var(--bg-elevated); }
.btn-danger {
  background: rgba(248,113,113,0.1); color: var(--danger);
  border-color: rgba(248,113,113,0.3);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(248,113,113,0.18); border-color: var(--danger);
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }

/* OAuth (white background per Google brand guideline) */
.btn-oauth {
  background: #fff; color: #1f2937; border-color: #fff;
  font-weight: 500;
}
.btn-oauth:hover:not(:disabled) {
  background: #f3f4f6; border-color: #f3f4f6;
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}

/* --- Forms ------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; color: var(--fg-muted);
  margin-bottom: 6px; letter-spacing: 0.02em;
}
.input, .field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* --- Cards & Surfaces ------------------------------------------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-sm { padding: 16px; border-radius: var(--radius-md); }

.surface-glow {
  background: linear-gradient(180deg, rgba(45,212,191,0.04), transparent),
              var(--bg-elevated);
  border-color: rgba(45,212,191,0.25);
  box-shadow: var(--shadow-glow);
}

/* --- Messages / banners ---------------------------------------- */
.msg {
  padding: 10px 14px; border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid transparent;
}
.msg-ok    { background: rgba(52,211,153,0.10); color: var(--success); border-color: rgba(52,211,153,0.25); }
.msg-err   { background: rgba(248,113,113,0.10); color: var(--danger);  border-color: rgba(248,113,113,0.25); }
.msg-warn  { background: rgba(245,158,11,0.10);  color: var(--warning); border-color: rgba(245,158,11,0.25); }
.msg-info  { background: rgba(96,165,250,0.10);  color: var(--info);    border-color: rgba(96,165,250,0.25); }

/* --- Pills ------------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill-trial         { background: rgba(245,158,11,0.15); color: var(--warning); }
.pill-free_referral { background: rgba(52,211,153,0.15); color: var(--success); }
.pill-pro           { background: var(--brand-soft);     color: var(--brand);   }
.pill-active    { background: rgba(52,211,153,0.15); color: var(--success); }
.pill-paused    { background: rgba(245,158,11,0.15); color: var(--warning); }
.pill-suspended { background: rgba(248,113,113,0.15); color: var(--danger);  }
.pill-admin     { background: rgba(245,158,11,0.18); color: var(--warning); }

/* --- Layout primitives ----------------------------------------- */
.shell { max-width: 1200px; margin: 0 auto; padding: 24px; }
.shell-narrow { max-width: 480px; margin: 64px auto; padding: 0 20px; }
.shell-wide   { max-width: 1400px; margin: 0 auto; padding: 24px; }

.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.gap-sm { gap: 8px; } .gap-md { gap: 16px; } .gap-lg { gap: 24px; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.right { text-align: right; }
.tight { letter-spacing: -0.01em; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* --- Top nav ---------------------------------------------------- */
.topnav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,14,26,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
}
.topnav .brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: -0.02em;
  color: var(--fg);
  font-size: 15px;
}
.topnav .brand-dot {
  /* The Yieldsforge mark — the SVG asset itself carries the navy
     background, so we don't add a glow ring. Sized for 15px text in nav. */
  width: 22px; height: 22px;
  background-image: url("/static/icon.svg");
  background-size: cover;
  background-position: center;
  border-radius: 5px;
  display: inline-block;
}
.topnav .links { display: flex; gap: 28px; align-items: center; }
.topnav .links a {
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color .15s;
}
.topnav .links a:hover, .topnav .links a.active { color: var(--fg); }
.topnav .links a.admin-link { color: var(--warning); }
.topnav .right-cluster { display: flex; gap: 12px; align-items: center; }
.topnav .user-email { color: var(--fg-subtle); font-size: 12px; }

@media (max-width: 640px) {
  .topnav { padding: 12px 16px; }
  .topnav .links { gap: 16px; }
  .topnav .links a { font-size: 12px; }
}

/* --- Tables (admin & dashboard) -------------------------------- */
.table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.table th, .table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.table th {
  color: var(--fg-subtle);
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(45,212,191,0.04); }
.table tbody tr:last-child td { border-bottom: 0; }

/* --- KV grid (Key/Value pairs in cards) ------------------------ */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  font-size: 13px;
}
.kv .k { color: var(--fg-subtle); font-size: 12px; }
.kv .v { font-variant-numeric: tabular-nums; text-align: right; }
.kv-2col { grid-template-columns: 1fr 1fr; }

/* --- Stat tile (overview cards) -------------------------------- */
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.stat .label {
  font-size: 11px; color: var(--fg-subtle);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
  margin-bottom: 6px;
}
.stat .value {
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat .sub { font-size: 11px; color: var(--fg-subtle); margin-top: 2px; }
.stat .accent { color: var(--brand); }

/* --- Allocation progress bars (4 buckets side-by-side) --------- */
.alloc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.alloc-cell {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.alloc-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; color: var(--fg-subtle); margin-bottom: 6px;
}
.alloc-head .name { color: var(--fg); font-weight: 500; }
.alloc-bar {
  position: relative; height: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 999px; overflow: hidden;
}
.alloc-bar-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--brand);
  transition: width .35s cubic-bezier(.4,0,.2,1);
  border-radius: 999px;
}
.alloc-bar-target {
  position: absolute; top: -2px; height: 12px; width: 2px;
  background: var(--warning);
  border-radius: 1px;
}
.alloc-foot {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--fg-subtle);
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.alloc-foot b { color: var(--fg); font-weight: 600; }

@media (max-width: 768px) {
  .alloc-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Dashboard symbol panel layout ----------------------------- */
.symbol-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* --- 24h history charts (SVG line) ----------------------------- */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: 180px; display: block; }
.chart-grid line { stroke: var(--border); stroke-width: 0.5; }
.chart-axis text { fill: var(--fg-subtle); font-size: 9px; font-family: var(--font-mono); }
.chart-line { fill: none; stroke-width: 1.6; }
.chart-area { opacity: 0.10; }
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; margin-top: 8px;
  font-variant-numeric: tabular-nums; color: var(--fg-muted);
}
.chart-legend .item { display: flex; align-items: center; gap: 6px; }
.chart-legend .dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-empty { color: var(--fg-subtle); font-style: italic; padding: 24px 0; text-align: center; font-size: 12px; }

/* --- Marketing landing-specific -------------------------------- */
.hero {
  padding: 80px 0 60px;
  text-align: left;
  position: relative;
}
.hero h1 {
  font-size: clamp(40px, 6vw, 72px);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 24px;
  font-weight: 700;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--brand) 0%, #6ee7b7 60%, #5eead4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: 18px; color: var(--fg-muted); max-width: 560px;
  line-height: 1.55;
  margin-bottom: 32px;
}
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hero .live-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--fg-muted); margin-bottom: 24px;
  font-variant-numeric: tabular-nums;
}
.hero .live-badge .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 48px 0;
}
@media (max-width: 768px) {
  .feature-grid { grid-template-columns: 1fr; }
}
.feature {
  padding: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.feature .icon-box {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand);
  margin-bottom: 16px;
}
.feature h3 {
  font-size: 18px; text-transform: none; letter-spacing: -0.01em;
  color: var(--fg); font-weight: 600;
  margin-bottom: 8px;
}
.feature p { color: var(--fg-muted); font-size: 14px; margin: 0; }

/* Trust strip — small row of "no withdraw permission" / "open source" / etc. */
.trust-strip {
  display: flex; flex-wrap: wrap; gap: 24px; justify-content: center;
  padding: 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 48px 0;
}
.trust-item {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--fg-muted); font-size: 13px;
}
.trust-item svg { color: var(--brand); }

.section-title {
  text-align: center;
  margin: 64px 0 8px;
}
.section-subtitle {
  text-align: center; color: var(--fg-muted);
  margin-bottom: 32px;
}

footer.site-foot {
  border-top: 1px solid var(--border);
  margin-top: 96px;
  padding: 32px 0;
  color: var(--fg-subtle);
  font-size: 12px;
  text-align: center;
}

/* Stagger entrance animations on landing */
.fade-up { opacity: 0; transform: translateY(12px); animation: fadeUp .6s forwards; }
.fade-up-1 { animation-delay: .05s; }
.fade-up-2 { animation-delay: .15s; }
.fade-up-3 { animation-delay: .25s; }
.fade-up-4 { animation-delay: .35s; }
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Utility */
.mt-2 { margin-top: 8px; }   .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }  .mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }  .mt-12 { margin-top: 48px; }
.mb-2 { margin-bottom: 8px; }   .mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }  .mb-8 { margin-bottom: 32px; }
.text-sm { font-size: 12px; }   .text-md { font-size: 14px; }
.text-lg { font-size: 16px; }   .text-xl { font-size: 20px; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-brand   { color: var(--brand); }
.text-muted   { color: var(--fg-muted); }
.text-subtle  { color: var(--fg-subtle); }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; }
.flex-1 { flex: 1; }
.hidden { display: none; }

/* Strategy preset selector (settings page) ------------------------------- */
.preset-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.preset-btn {
  text-align: left;
  padding: 12px 14px;
  background: var(--bg-input); color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.preset-btn:hover { border-color: var(--brand); }
.preset-btn.active {
  border-color: var(--brand);
  background: rgba(45,212,191,0.08);
}
.preset-btn .preset-name {
  font-weight: 600; font-size: 14px; margin-bottom: 4px;
}
.preset-btn .preset-desc { font-size: 12px; line-height: 1.4; }
@media (max-width: 640px) {
  .preset-grid { grid-template-columns: 1fr; }
}
