/* =================================================================
 * U-TRADEX design system v1
 * Shared by the public marketing site, user dashboard, and admin.
 * Mobile-first, dark-mode default. Single source of truth.
 * ================================================================= */

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg-0:       #07090e;
  --bg-1:       #0d1118;
  --bg-2:       #131922;
  --bg-3:       #1a2230;
  --bg-elev-1:  #131922;
  --bg-elev-2:  #1a2230;

  /* Borders */
  --border:        rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* Text */
  --text-1: #f5f7fb;
  --text-2: #c8d0dc;
  --text-3: #8c98ab;
  --text-4: #5d6878;

  /* Accent — electric blue */
  --acc:        #4f8dff;
  --acc-hover:  #3b7bf2;
  --acc-press:  #2c63cc;
  --acc-soft:   rgba(79, 141, 255, 0.12);

  /* Secondary — cyan-mint for highlights */
  --acc-2:      #5dd6c0;
  --acc-2-soft: rgba(93, 214, 192, 0.12);

  /* States */
  --good:      #5dd6c0;
  --good-soft: rgba(93, 214, 192, 0.12);
  --warn:      #f6b653;
  --warn-soft: rgba(246, 182, 83, 0.12);
  --bad:       #ff6b7a;
  --bad-soft:  rgba(255, 107, 122, 0.10);

  /* Spacing scale (8-pt) */
  --s-0:  0;
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;
  --s-8:  64px;
  --s-9:  96px;
  --s-10: 128px;

  /* Radius */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --r-4: 20px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-1: 0 1px 0 rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.20);
  --shadow-2: 0 4px 12px rgba(0,0,0,0.30);
  --shadow-3: 0 10px 30px rgba(0,0,0,0.45);
  --glow-acc: 0 0 0 1px rgba(79,141,255,0.50), 0 0 24px -6px rgba(79,141,255,0.55);

  /* Typography */
  --font-display: 'Inter', -apple-system, 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono:    ui-monospace, 'JetBrains Mono', 'Cascadia Code', Menlo, monospace;

  /* Layout */
  --container:  1200px;
  --container-narrow: 840px;
  --header-h:   64px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; max-width: 100%; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-display);
  background: var(--bg-0);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  min-height: 100vh;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc-hover); }
button { font-family: inherit; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-5) 0; }

/* ── Typography ─────────────────────────────────────────────────── */
.display-1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -0.025em; font-weight: 700; }
.display-2 { font-size: clamp(2rem, 4.5vw, 2.8rem);  line-height: 1.1;  letter-spacing: -0.020em; font-weight: 700; }
.h1 { font-size: 2rem;   line-height: 1.2; letter-spacing: -0.015em; font-weight: 700; }
.h2 { font-size: 1.5rem; line-height: 1.3; letter-spacing: -0.010em; font-weight: 600; }
.h3 { font-size: 1.15rem; line-height: 1.35; font-weight: 600; }
.muted   { color: var(--text-3); }
.muted-2 { color: var(--text-4); }
.lead    { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; }
.kicker  { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem;
           font-weight: 600; color: var(--acc); }
.mono    { font-family: var(--font-mono); font-size: 0.9rem; }
code, pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Layout primitives ──────────────────────────────────────────── */
.container        { max-width: var(--container); margin: 0 auto; padding: 0 var(--s-5); }
.container-narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 var(--s-5); }
.section          { padding: var(--s-9) 0; }
.section-tight    { padding: var(--s-7) 0; }
.section-divider  { border-top: 1px solid var(--border); }

.grid { display: grid; gap: var(--s-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 880px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

.flex     { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-wrap       { flex-wrap: wrap; }

.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); }
.mb-1 { margin-bottom: var(--s-1); } .mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); }
.mb-5 { margin-bottom: var(--s-5); } .mb-6 { margin-bottom: var(--s-6); }

/* ── Header / nav ───────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 9, 14, 0.78);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.site-header .container, .site-header .container-narrow {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: var(--s-2); color: var(--text-1);
          font-weight: 700; letter-spacing: -0.01em; font-size: 1.05rem; }
.brand img { height: 38px; width: auto; }
/* Full horizontal logo (hexagon + wordmark + tagline) — wider, no text span. */
.brand-logo img { height: 44px; width: auto; max-width: 220px; object-fit: contain; }
.brand:hover { color: var(--text-1); }

.nav-links { display: flex; gap: var(--s-5); align-items: center; }
.nav-links a { color: var(--text-2); font-weight: 500; font-size: 0.92rem; padding: 6px 0; }
.nav-links a:hover { color: var(--text-1); }
.nav-cta { display: flex; gap: var(--s-2); align-items: center; }

@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 10px 18px;
  font-size: 0.94rem; font-weight: 600;
  border-radius: var(--r-2);
  border: 1px solid transparent;
  cursor: pointer; user-select: none;
  transition: background 0.12s ease, border 0.12s ease, color 0.12s ease, transform 0.08s ease;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--acc); color: white; border-color: var(--acc);
  box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, 0 6px 16px -8px rgba(79,141,255,0.7);
}
.btn-primary:hover  { background: var(--acc-hover); border-color: var(--acc-hover); color: white; }
.btn-primary:active { background: var(--acc-press); }
.btn-secondary {
  background: transparent; color: var(--text-1); border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--text-3); color: var(--text-1); }
.btn-ghost {
  background: transparent; color: var(--text-2); border-color: transparent;
}
.btn-ghost:hover { color: var(--text-1); background: var(--bg-2); }
.btn-danger {
  background: var(--bad); color: white; border-color: var(--bad);
}
.btn-danger:hover { background: #ed5260; border-color: #ed5260; color: white; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }

/* ── Forms ─────────────────────────────────────────────────────── */
.field        { display: block; margin-top: var(--s-4); }
.field > .label { display: block; font-size: 0.84rem; color: var(--text-2);
                  margin-bottom: var(--s-2); font-weight: 500; }
.field > .hint  { display: block; font-size: 0.78rem; color: var(--text-3);
                  margin-top: var(--s-1); }
.input, select, textarea {
  width: 100%; padding: 11px 13px;
  background: var(--bg-2); color: var(--text-1);
  border: 1px solid var(--border-strong); border-radius: var(--r-2);
  font-size: 0.94rem; font-family: inherit;
  outline: none;
  transition: border 0.12s ease, box-shadow 0.12s ease;
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(79,141,255,0.18);
}
textarea { resize: vertical; min-height: 88px; }
.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.92rem; color: var(--text-2); cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--acc);
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-5);
  box-shadow: var(--shadow-1);
}
.card-elev {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
}
.card-glow {
  border-color: rgba(79,141,255,0.30);
  box-shadow: 0 8px 24px rgba(79,141,255,0.10), 0 1px 0 rgba(79,141,255,0.05) inset;
}
.card-tight { padding: var(--s-4); }

/* ── Pills / status ────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.74rem; font-weight: 600;
  background: var(--bg-2); color: var(--text-3);
  letter-spacing: 0.02em;
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad  { background: var(--bad-soft);  color: var(--bad);  }
.pill.acc  { background: var(--acc-soft);  color: var(--acc);  }

/* ── Tables ─────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
}
.table th { color: var(--text-3); font-weight: 500;
            text-transform: uppercase; letter-spacing: 0.08em;
            font-size: 0.74rem; background: var(--bg-1); }
.table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(64px, 12vw, 144px) 0 clamp(48px, 8vw, 96px);
}
.hero::before {
  content: "";
  position: absolute; inset: -10%;
  background:
    radial-gradient(900px 500px at 80% 0%, rgba(79,141,255,0.18), transparent 60%),
    radial-gradient(700px 400px at 10% 70%, rgba(93,214,192,0.10), transparent 55%);
  pointer-events: none;
  z-index: -1;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  font-size: 0.78rem; color: var(--text-2); background: var(--bg-1);
  margin-bottom: var(--s-5);
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--good); box-shadow: 0 0 12px var(--good);
}

/* ── Stats ──────────────────────────────────────────────────────── */
.stat {
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-5);
  background: var(--bg-1);
}
.stat .num   { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-1); }
.stat .label { color: var(--text-3); font-size: 0.86rem; margin-top: 4px; }

/* ── Pricing ────────────────────────────────────────────────────── */
.plan-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-6);
  transition: transform 0.18s ease, border 0.18s ease, box-shadow 0.18s ease;
}
.plan-card.popular {
  border-color: rgba(79,141,255,0.45);
  box-shadow: 0 12px 36px -12px rgba(79,141,255,0.30);
}
.plan-card .badge {
  position: absolute; top: -10px; right: 18px;
  background: var(--acc); color: white;
  font-size: 0.72rem; font-weight: 600; padding: 4px 10px;
  border-radius: var(--r-pill); letter-spacing: 0.02em;
}
.plan-card .plan-name { font-size: 0.92rem; font-weight: 600; color: var(--acc); letter-spacing: 0.06em; text-transform: uppercase; }
.plan-card .price { font-size: 2.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; margin-top: 6px; }
.plan-card .price .cycle { font-size: 0.92rem; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.plan-card .strike { color: var(--text-4); text-decoration: line-through; font-weight: 500; font-size: 1.1rem; margin-right: 8px; }
.plan-card ul { list-style: none; padding: 0; margin: var(--s-5) 0 var(--s-5); }
.plan-card li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 0.94rem; color: var(--text-2);
  padding: 6px 0;
}
.plan-card li::before {
  content: "✓"; color: var(--good);
  font-weight: 700; flex-shrink: 0;
}
/* Multi-cycle pricing toggle (monthly / quarterly / 6-month) — segmented control */
.cycle-toggle {
  display: inline-flex;
  align-self: flex-start;   /* parent .plan-card is a flex column → don't stretch full width */
  max-width: 100%;
  gap: 2px;
  padding: 3px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
}
.cycle-toggle .cyc-btn {
  appearance: none; -webkit-appearance: none;
  border: 0; background: transparent;
  color: var(--text-3);
  font: inherit; font-size: 0.82rem; font-weight: 600; line-height: 1;
  padding: 7px 13px;
  border-radius: calc(var(--r-2) - 3px);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.cycle-toggle .cyc-btn:hover { color: var(--text-1); }
.cycle-toggle .cyc-btn.active {
  background: var(--acc); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset;
}

/* ── Feature cards (homepage) ──────────────────────────────────── */
.feature {
  background: var(--bg-1); border: 1px solid var(--border);
  padding: var(--s-5); border-radius: var(--r-3);
  transition: border 0.18s ease, transform 0.18s ease;
}
.feature:hover { border-color: var(--border-strong); }
.feature h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 var(--s-2) 0; color: var(--text-1); }
.feature p  { color: var(--text-3); margin: 0; font-size: 0.94rem; }

/* ── FAQ accordion ─────────────────────────────────────────────── */
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item summary {
  list-style: none; cursor: pointer;
  padding: var(--s-5) 0;
  font-size: 1rem; font-weight: 500; color: var(--text-1);
  display: flex; align-items: center; justify-content: space-between;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  width: 26px; height: 26px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); font-weight: 400; font-size: 1.1rem;
  transition: transform 0.16s ease, color 0.16s ease;
}
.faq-item[open] summary::after { content: "\2212"; color: var(--text-1); transform: rotate(180deg); }
.faq-item p { padding: 0 0 var(--s-5) 0; color: var(--text-3); margin: 0; max-width: 720px; }

/* ── CTA strip ─────────────────────────────────────────────────── */
.cta-strip {
  border: 1px solid rgba(79,141,255,0.30);
  border-radius: var(--r-4);
  padding: var(--s-7);
  text-align: center;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(79,141,255,0.18), transparent 60%),
    var(--bg-1);
}

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--s-7) 0 var(--s-5) 0;
  color: var(--text-3); font-size: 0.86rem;
  margin-top: var(--s-9);
}
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--text-1); }
.footer-bottom {
  margin-top: var(--s-5); padding-top: var(--s-4);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap;
  font-size: 0.78rem; color: var(--text-4);
}

/* Compact footer used on logged-in / admin / auth pages.
   One-line: © year brand · Terms · Privacy · Refund policy */
.site-footer-compact {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  color: var(--text-4);
  font-size: 0.78rem;
  margin-top: var(--s-7);
  background: transparent;
}
.footer-compact-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  text-align: center;
}
.site-footer-compact a {
  color: var(--text-3);
  text-decoration: none;
}
.site-footer-compact a:hover { color: var(--text-1); text-decoration: underline; }
.footer-compact-copy {
  color: var(--text-3);
  font-weight: 500;
}
.footer-compact-sep {
  color: var(--text-5, var(--text-4));
  opacity: 0.6;
}
@media (max-width: 480px) {
  .site-footer-compact { padding: 12px 12px; font-size: 0.74rem; }
  .footer-compact-inner { gap: 4px 8px; }
}

/* ── Inline error / success blocks ────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: var(--r-2);
  border: 1px solid;
  font-size: 0.92rem;
  margin: var(--s-3) 0;
}
.alert-error  { background: var(--bad-soft);  border-color: rgba(255,107,122,0.30);  color: #ffb1b9; }
.alert-good   { background: var(--good-soft); border-color: rgba(93,214,192,0.30);   color: #a6ecdb; }
.alert-warn   { background: var(--warn-soft); border-color: rgba(246,182,83,0.30);   color: #ffd699; }

/* ── Auth-card (login / register) ──────────────────────────────── */
.auth-card {
  max-width: 460px; margin: 64px auto;
  padding: var(--s-6) var(--s-6);
}
.auth-card h1 { font-size: 1.5rem; margin: 0 0 4px 0; }
.auth-card .muted { font-size: 0.92rem; }

/* ── Sidebar (used by user dashboard + admin in Phase 7b) ─────── */
.layout-sidebar { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-1); border-right: 1px solid var(--border);
  padding: var(--s-4) var(--s-3);
}
.sidebar .nav-group { margin-top: var(--s-4); }
.sidebar .nav-group .label {
  text-transform: uppercase; letter-spacing: 0.10em;
  font-size: 0.7rem; color: var(--text-4); padding: 0 12px; margin-bottom: 6px;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--r-2);
  color: var(--text-2); font-size: 0.92rem;
  text-decoration: none;
}
.sidebar a:hover  { background: var(--bg-2); color: var(--text-1); }
.sidebar a.active { background: var(--acc-soft); color: var(--acc); }
.main-content { padding: var(--s-6) var(--s-5); }
@media (max-width: 880px) {
  .layout-sidebar { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── Utility ────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.max-readable { max-width: 720px; }
.no-wrap { white-space: nowrap; }

/* ── Phase 7c — Dashboard polish ────────────────────────────────── */

/* KPI strip — at-a-glance numbers above the fold */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
@media (max-width: 880px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.kpi {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-4) var(--s-4);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--text-3); opacity: 0.5;
}
.kpi.kpi-good::before { background: var(--good); opacity: 0.85; }
.kpi.kpi-bad::before  { background: var(--bad);  opacity: 0.85; }
.kpi.kpi-acc::before  { background: var(--acc);  opacity: 0.85; }
.kpi.kpi-warn::before { background: var(--warn); opacity: 0.85; }
.kpi .kpi-label {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); font-weight: 600;
}
.kpi .kpi-value {
  font-size: 1.6rem; font-weight: 700; color: var(--text-1);
  letter-spacing: -0.02em; margin-top: 6px; line-height: 1.1;
}
.kpi .kpi-sub {
  font-size: 0.78rem; color: var(--text-3); margin-top: 4px;
}
.kpi .kpi-value.good { color: var(--good); }
.kpi .kpi-value.bad  { color: var(--bad);  }

/* Side badges (BUY / SELL) */
.side-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-2);
  font-size: 0.74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.side-badge.buy  { background: var(--good-soft); color: var(--good); }
.side-badge.sell { background: var(--bad-soft);  color: var(--bad);  }
.side-badge::before { content: ""; width: 0; height: 0; }
.side-badge.buy::before  { border: 4px solid transparent; border-bottom-color: var(--good); margin-bottom: 2px; }
.side-badge.sell::before { border: 4px solid transparent; border-top-color:    var(--bad);  margin-top: 2px; }

/* Symbol "chip" — small letter mark next to ticker */
.sym-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600;
}
.sym-chip .sym-mark {
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  font-size: 0.66rem; font-weight: 700;
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0.02em;
}
.sym-chip .sym-mark.gold { background: rgba(246,182,83,0.18); color: #ffd699; border-color: rgba(246,182,83,0.30); }
.sym-chip .sym-mark.btc  { background: rgba(247,147,26,0.18); color: #f7931a; border-color: rgba(247,147,26,0.30); }
.sym-chip .sym-mark.eth  { background: rgba(98,126,234,0.18); color: #98a8ff; border-color: rgba(98,126,234,0.30); }
.sym-chip .sym-mark.fx   { background: rgba(79,141,255,0.16); color: var(--acc); border-color: rgba(79,141,255,0.30); }

/* Animated row for newly-arriving feed events */
@keyframes feedFadeIn {
  0%   { background: rgba(79,141,255,0.18); opacity: 0; transform: translateY(-4px); }
  60%  { opacity: 1; transform: translateY(0); }
  100% { background: transparent; }
}
.feed-row-new td { animation: feedFadeIn 1.4s ease-out; }

/* Pending-confirmation card — a stronger emphasis treatment */
.pending-card {
  border-color: rgba(246,182,83,0.45) !important;
  background: linear-gradient(180deg, rgba(246,182,83,0.06), transparent 80%);
}
.pending-card .pending-title {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--warn); font-weight: 700;
}
.pending-row {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-3) var(--s-4);
  margin-top: var(--s-3);
}
.pending-row .pending-meta { font-size: 0.86rem; color: var(--text-3); margin-top: 4px; }
/* Countdown bar — fills as time passes */
.countdown-bar {
  height: 4px; border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
  margin-top: 8px;
}
.countdown-bar .countdown-fill {
  height: 100%; background: var(--warn);
  transition: width 0.5s linear, background 0.5s linear;
}
.countdown-bar .countdown-fill.urgent { background: var(--bad); }

/* Empty-state cell — used inside tables */
.empty-cell {
  text-align: center;
  padding: var(--s-6) var(--s-4);
  color: var(--text-3);
}
.empty-cell .empty-emoji { font-size: 1.8rem; line-height: 1; margin-bottom: 8px; }
.empty-cell .empty-title { color: var(--text-2); font-weight: 600; font-size: 0.95rem; }
.empty-cell .empty-hint  { font-size: 0.86rem; margin-top: 4px; }

/* P&L cell coloring */
.pnl-pos { color: var(--good); font-weight: 600; }
.pnl-neg { color: var(--bad);  font-weight: 600; }
.pnl-zero { color: var(--text-3); }

/* Mini hero dot (sidebar version) */
.live-dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--good); display: inline-block; vertical-align: middle;
  box-shadow: 0 0 10px var(--good); margin-right: 6px;
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.45; }
}

/* ── Phase 7c — Tabs (used on Settings) ─────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
.tabs .tab {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background: transparent !important;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  padding: 12px 18px;
  margin: 0;
  font-family: inherit;
  font-size: 0.92rem; font-weight: 500;
  line-height: 1;
  cursor: pointer;
  position: relative;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tabs .tab:hover  { color: var(--text-1); }
.tabs .tab:focus-visible { color: var(--text-1); outline: 2px solid var(--acc); outline-offset: 2px; }
.tabs .tab.active {
  color: var(--text-1);
  border-bottom-color: var(--acc);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: tabFadeIn 0.18s ease-out; }
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Tag / chip picker (used for symbol whitelist) ───────────────── */
.chip-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  min-height: 44px;
  align-items: center;
}
.chip-picker .chip-input {
  flex: 1; min-width: 140px;
  background: transparent; border: 0; outline: none;
  color: var(--text-1); font-family: inherit; font-size: 0.92rem;
  padding: 4px 6px;
}
.chip-picker:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--acc-soft); color: var(--acc);
  border-radius: var(--r-2);
  font-size: 0.84rem; font-weight: 600;
  line-height: 1;
}
.chip .chip-x {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  cursor: pointer; opacity: 0.7;
  border: 0; background: transparent; color: inherit;
  padding: 0 2px; line-height: 1;
  font-size: 1rem; font-family: inherit;
  outline: none;
}
.chip .chip-x:hover { opacity: 1; }
.chip-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.chip-suggest {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  display: inline-flex; align-items: center;
  padding: 5px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--r-2);
  font-family: inherit;
  font-size: 0.82rem; line-height: 1; font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  background: transparent;
  outline: none;
  box-shadow: none;
  transition: all 0.15s;
}
.chip-suggest:hover {
  border-style: solid; border-color: var(--acc);
  color: var(--acc); background: var(--acc-soft);
}

/* ── Risk-impact preview cell ───────────────────────────────────── */
.preview {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: 10px 14px;
  font-size: 0.86rem;
  color: var(--text-2);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.preview .preview-label { color: var(--text-3); font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.06em; }
.preview .preview-value { color: var(--text-1); font-weight: 600; }

/* ── Toggle switches (cleaner than raw checkboxes for auto-exec) ── */
.switch {
  position: relative; display: inline-block;
  width: 38px; height: 22px;
}
.switch input { display: none; }
.switch .knob {
  position: absolute; inset: 0;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: 0.18s;
  cursor: pointer;
}
.switch .knob::before {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 16px; height: 16px;
  background: var(--text-3);
  border-radius: 999px;
  transition: 0.18s;
}
.switch input:checked + .knob {
  background: var(--good-soft);
  border-color: var(--good);
}
.switch input:checked + .knob::before {
  transform: translateX(16px);
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

/* ── Lifecycle status banner ────────────────────────────────────── */
.lifecycle-banner {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: var(--r-3);
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.lifecycle-banner .lc-icon {
  width: 36px; height: 36px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.lifecycle-banner.is-running { border-color: rgba(93,214,192,0.30); background: var(--good-soft); }
.lifecycle-banner.is-paused  { border-color: rgba(246,182,83,0.30); background: var(--warn-soft); }
.lifecycle-banner.is-stopped { border-color: rgba(255,107,122,0.30); background: var(--bad-soft); }
.lifecycle-banner.is-running .lc-icon { background: rgba(93,214,192,0.25);  color: var(--good); }
.lifecycle-banner.is-paused  .lc-icon { background: rgba(246,182,83,0.25);  color: var(--warn); }
.lifecycle-banner.is-stopped .lc-icon { background: rgba(255,107,122,0.25); color: var(--bad);  }

/* Step list (broker connection guide) */
.step-list { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.step-list li {
  position: relative; padding: 8px 0 8px 32px;
  color: var(--text-2); font-size: 0.92rem;
  counter-increment: step;
}
.step-list li::before {
  content: counter(step);
  position: absolute; left: 0; top: 8px;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--acc-soft); color: var(--acc);
  font-size: 0.78rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── Phase 7c — Billing hero / period progress / switch-tier ────── */
.sub-hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 80% -20%, rgba(79,141,255,0.18), transparent 55%),
    linear-gradient(180deg, var(--bg-elev-1), var(--bg-1));
  border-radius: var(--r-3);
  padding: var(--s-5) var(--s-5);
  margin-bottom: var(--s-5);
}
.sub-hero .tier-name {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--acc); font-weight: 700;
}
.sub-hero .tier-headline {
  font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700;
  letter-spacing: -0.02em; color: var(--text-1); margin-top: 6px;
}
.sub-hero .tier-amount {
  font-size: 2rem; font-weight: 700;
  color: var(--text-1); letter-spacing: -0.02em;
}
.sub-hero .tier-amount .ccy { font-size: 0.9rem; color: var(--text-3);
  font-weight: 500; margin-left: 6px; }
.sub-hero .tier-cycle { color: var(--text-3); font-size: 0.86rem; margin-top: 2px; }

.period-bar {
  height: 8px; border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden; margin-top: 6px;
}
.period-bar .period-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--acc), #6da6ff);
  transition: width 0.4s ease;
}
.period-bar.is-warn .period-fill { background: linear-gradient(90deg, var(--warn), #ffce8a); }
.period-bar.is-danger .period-fill { background: linear-gradient(90deg, var(--bad), #ff8e9b); }

/* Switch-tier card grid */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-4);
}
.tier-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--s-4);
  display: flex; flex-direction: column;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.tier-card:hover { border-color: rgba(79,141,255,0.45); transform: translateY(-2px); }
.tier-card.is-current {
  border-color: var(--acc);
  background:
    linear-gradient(180deg, rgba(79,141,255,0.05), transparent 60%),
    var(--bg-1);
}
.tier-card.is-current .tier-card-cta { display: none; }
.tier-card.is-current::after {
  content: "Your current plan";
  position: absolute; top: 12px; right: 14px;
  font-size: 0.72rem; color: var(--acc); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.tier-card { position: relative; }
.tier-card .tier-card-name {
  font-size: 1.1rem; font-weight: 700; color: var(--text-1);
}
.tier-card .tier-card-cycle { color: var(--text-3); font-size: 0.86rem; margin-top: 2px; }
.tier-card .tier-card-price {
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-1); margin-top: 12px;
}
.tier-card .tier-card-price .ccy { font-size: 0.88rem; color: var(--text-3);
  font-weight: 500; margin-left: 4px; }
.tier-card .tier-card-cycle-line { color: var(--text-3); font-size: 0.84rem; }
.tier-card .tier-card-bullets {
  list-style: none; padding: 0; margin: 14px 0 0 0;
  display: flex; flex-direction: column; gap: 6px;
}
.tier-card .tier-card-bullets li {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--text-2); font-size: 0.86rem;
}
.tier-card .tier-card-bullets li::before {
  content: "✓"; color: var(--good); font-weight: 700; margin-top: 1px;
  flex-shrink: 0;
}
.tier-card .tier-card-cta { margin-top: auto; padding-top: 14px; }
.tier-card .tier-card-trial {
  display: inline-block; margin-top: 6px;
  padding: 2px 8px; border-radius: var(--r-2);
  background: var(--acc-soft); color: var(--acc);
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em;
}

/* Invoice rows — slimmer, with download icon */
.invoice-actions {
  display: inline-flex; gap: 8px; align-items: center;
}
.invoice-actions a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--r-2);
  background: var(--bg-2); color: var(--text-2);
  font-size: 0.82rem; text-decoration: none;
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.invoice-actions a:hover { color: var(--acc); border-color: var(--acc); }

/* ── Phase 7d — Mobile polish ───────────────────────────────────── */

/* Hamburger button (hidden on desktop). */
.hamburger {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  display: none;
  flex-direction: column; gap: 4px;
  width: 40px; height: 40px;
  padding: 10px 9px;
  margin-right: 6px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r-2);
  cursor: pointer;
  align-items: stretch; justify-content: center;
}
.hamburger span {
  display: block; height: 2px;
  background: var(--text-1);
  border-radius: 2px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.hamburger:hover { border-color: var(--acc); }
.hamburger:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* Mobile backdrop that dims the page behind the open drawer */
.mobile-backdrop {
  position: fixed; inset: 0; z-index: 49;
  background: rgba(7, 9, 14, 0.70);
  backdrop-filter: blur(2px);
  animation: bdFadeIn 0.18s ease-out;
}
@keyframes bdFadeIn { from { opacity: 0; } to { opacity: 1; } }
.mobile-backdrop[hidden] { display: none; }

/* ── Mobile breakpoint: < 880px ─────────────────────────────────── */
@media (max-width: 880px) {
  /* Show hamburger, slim down topbar */
  .hamburger { display: inline-flex; }
  .site-header .container {
    padding-left: var(--s-3);
    padding-right: var(--s-3);
  }
  .site-header .brand img { height: 36px; width: auto; max-width: 180px; }
  .site-header .brand .brand-text { font-size: 0.96rem; }
  .topbar-email { display: none; }   /* email is one too many on small screens */

  /* Phones: language picker shows the FLAG only (hide the name) to save header
     width, and tighten the CTA row so it fits the viewport — no horizontal scroll. */
  .lang-cur { display: none; }
  .lang-btn { padding: 5px 7px; }
  .site-header .nav-cta { gap: 6px; flex-wrap: nowrap; min-width: 0; }
  .site-header .nav-cta .btn-sm { padding: 6px 10px; font-size: 0.78rem; white-space: nowrap; }

  /* Sidebar becomes a slide-in drawer; show only when toggled */
  .layout-sidebar { grid-template-columns: 1fr; position: relative; }
  .layout-sidebar .sidebar {
    display: block;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 260px; max-width: 84vw;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    padding-top: 70px;   /* clear header height */
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    box-shadow: 0 8px 40px rgba(0,0,0,0.40);
  }
  .layout-sidebar.is-mobile-open .sidebar { transform: translateX(0); }
  .main-content {
    padding: var(--s-5) var(--s-4);
  }

  /* Tables: scroll horizontally instead of overflowing the page */
  .table {
    display: block;
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    font-size: 0.86rem;
  }
  .table thead, .table tbody, .table tr { white-space: nowrap; }
  .table th, .table td { padding: 10px 10px; }

  /* Stack-style tables: convert each row into a card with the header
     rendered as an inline label inside every cell. Used on the dashboard
     signal feed and trades list — short, frequently-read rows that
     don't deserve a horizontal scroll on phones. Add `data-label="..."`
     to every <td> and `class="table-stack"` on the <table>. */
  .table.table-stack { display: block; white-space: normal; overflow: visible; }
  .table.table-stack thead { display: none; }
  .table.table-stack tbody { display: block; }
  .table.table-stack tr {
    display: block;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    padding: 12px 14px;
    margin-bottom: 10px;
    white-space: normal;
  }
  .table.table-stack tr:hover td { background: transparent; }
  .table.table-stack td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    border: 0;
    white-space: normal;
    word-break: break-word;
  }
  .table.table-stack td:first-child { padding-top: 0; }
  .table.table-stack td:last-child  { padding-bottom: 0; }
  .table.table-stack td::before {
    content: attr(data-label);
    flex: 0 0 96px;
    color: var(--text-3);
    font-size: 0.74rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    padding-top: 2px;
  }
  /* Empty-state cell still spans the whole stacked card cleanly */
  .table.table-stack td.empty-cell {
    display: block;
    text-align: center;
  }
  .table.table-stack td.empty-cell::before { content: none; }
  /* When a td contains a flex container of buttons, let it grow and
     wrap on its own — prevents buttons getting cramped or stacking. */
  .table.table-stack td > .flex {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  /* Tab strip: become horizontally scrollable */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: calc(-1 * var(--s-4));
    margin-right: calc(-1 * var(--s-4));
    padding-left: var(--s-4);
    padding-right: var(--s-4);
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab {
    flex: 0 0 auto;
    padding: 12px 14px;
    font-size: 0.88rem;
  }

  /* KPI grid: 2 cols (already set), tighten typography */
  .kpi-grid { gap: var(--s-3); }
  .kpi { padding: var(--s-3) var(--s-3); }
  .kpi .kpi-value { font-size: 1.3rem; }

  /* Hero / sub-hero — stack and tighten */
  .sub-hero { padding: var(--s-4); }
  .sub-hero .grid-2 { grid-template-columns: 1fr !important; gap: var(--s-3) !important; }
  .sub-hero .tier-amount { font-size: 1.6rem; }

  /* Tier-card grid: comfortable single column on phones */
  .tier-grid { grid-template-columns: 1fr; gap: var(--s-3); }

  /* Pending / countdown rows: stack the action buttons under the meta */
  .pending-row .flex { flex-direction: column; align-items: stretch !important; }
  .pending-row .flex .flex { flex-direction: row; align-items: center !important; }

  /* Login / register cards: shrink margin so they fit on small screens */
  .auth-card { margin: 24px auto; padding: var(--s-5) var(--s-4); }

  /* Containers waste less padding on phones */
  .container { padding: 0 var(--s-4); }

  /* Card padding tightens slightly */
  .card { padding: var(--s-4); }
}

/* ── Tighter still: < 480px (small phones) ──────────────────────── */
@media (max-width: 480px) {
  .h1, .display-2 { font-size: 1.6rem; }
  .h2 { font-size: 1.15rem; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi .kpi-value { font-size: 1.5rem; }
  .lifecycle-banner { gap: 10px; padding: 12px; }
  .lifecycle-banner .lc-icon { width: 32px; height: 32px; }
  .preview { gap: 8px; }
  .preview .preview-label { flex-basis: 100%; margin-bottom: -4px; }
  /* Drop pills inside the activity status column */
  .pill { padding: 3px 8px; font-size: 0.74rem; }
}

/* Desktop hides the backdrop; failsafe in case JS leaves it on */
@media (min-width: 881px) {
  .mobile-backdrop { display: none !important; }
}


/* ── Phase 7d.1 — App-mode topbar alignment ─────────────────────── */
/* The user app + admin both wrap content in .layout-sidebar (sidebar
   pinned to viewport-left at 240px). The topbar sits ABOVE that
   layout, but its .container is centered with max-width 1200px — so
   on wide screens the logo floats away from the sidebar's left edge
   and the sign-out button floats away from the right edge.
   Fix: when the topbar is in "app mode", swap its container layout
   for a full-width row with edge padding that matches the sidebar
   width on the left and a comfortable gutter on the right. */
.site-header.is-app .container {
  max-width: none;
  padding-left: var(--s-5);
  padding-right: var(--s-5);
}
@media (max-width: 880px) {
  /* On phones the sidebar is a slide-in drawer, not a fixed column,
     so the topbar should hug the viewport edges (handled by the
     existing mobile rule that tightens .site-header .container). */
  .site-header.is-app .container {
    padding-left: var(--s-3);
    padding-right: var(--s-3);
  }
}


/* ── Plan-card feature ✓/✗ matrix (admin-editable rows) ─────────────────────── */
.plan-card ul.feature-matrix{margin:var(--s-5,16px) 0 var(--s-4,10px);padding:0;list-style:none}
.plan-card ul.feature-matrix li{display:flex;align-items:center;gap:10px;padding:6px 0;font-size:0.94rem}
.plan-card ul.feature-matrix li::before{content:none !important;display:none !important}  /* kill the global green tick */
.feature-matrix .feat-mark{flex:0 0 20px;width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;font-size:12px;font-weight:700;line-height:1}
.feature-matrix li.feat-yes .feat-mark{background:rgba(34,197,94,.16);color:#22c55e}
.feature-matrix li.feat-no  .feat-mark{background:rgba(239,68,68,.16);color:#ef4444}
.feature-matrix li.feat-yes .feat-label{color:var(--text-1,#e7ecf3)}
.feature-matrix li.feat-no  .feat-label{color:var(--text-4,#6b7280);text-decoration:line-through;opacity:.75}
/* extra perks share the matrix style; subtle divider above the first one */
.feature-matrix li.feat-extra.feat-divider{margin-top:10px;padding-top:14px;border-top:1px solid var(--border)}