/* ── Design principles for this platform ──────────────────────────────────
   Users are trusting us with real money. The design should feel calm,
   precise, and quietly confident — closer to a well-made instrument panel
   than a consumer app trying to hype anyone up. Never dark-pattern; every
   satisfying detail (the pulse on a live instance, the tick counter) is a
   HONEST reflection of what's really happening, not decoration standing in
   for missing information.
------------------------------------------------------------------------- */

:root {
    --bg: #0b0f14;
    --bg-elevated: #111722;
    --bg-card: #141b28;
    --border: #232c3d;
    --text: #e7ecf3;
    --text-dim: #8b97ab;
    --text-faint: #5b6579;
    --accent: #4f8cff;
    --accent-dim: #2c4670;
    --green: #34d399;
    --green-dim: #163a2d;
    --red: #f87171;
    --red-dim: #3a1c1c;
    --amber: #fbbf24;
    --amber-dim: #3a2e10;
    --radius: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    --mono: "SF Mono", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

.topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: block;
}

.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-email { color: var(--text-dim); font-size: 13px; }

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
p.subtitle { color: var(--text-dim); margin: 0 0 28px; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
}

.card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }
.btn-danger { background: var(--red-dim); color: var(--red); border-color: #5a2626; }
.btn-danger:hover { filter: brightness(1.2); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; text-align: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ── */
label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number] {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 12px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 18px;
    font-family: var(--mono);
}
input:focus { outline: none; border-color: var(--accent); }
.field-hint { font-size: 12px; color: var(--text-faint); margin: -12px 0 18px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.checkbox-row input { width: auto; margin: 4px 0 0; }
.checkbox-row label { margin: 0; font-weight: 400; color: var(--text); }

/* ── Status badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; }

.badge-live { background: var(--green-dim); color: var(--green); }
.badge-live .badge-dot { background: var(--green); animation: pulse 1.8s infinite; }

.badge-dry_run { background: var(--accent-dim); color: var(--accent); }
.badge-dry_run .badge-dot { background: var(--accent); animation: pulse 1.8s infinite; }

.badge-paused { background: var(--amber-dim); color: var(--amber); }
.badge-paused .badge-dot { background: var(--amber); }

.badge-stopped, .badge-draft, .badge-deleted { background: #1b2130; color: var(--text-faint); }
.badge-stopped .badge-dot, .badge-draft .badge-dot, .badge-deleted .badge-dot { background: var(--text-faint); }

.badge-error { background: var(--red-dim); color: var(--red); }
.badge-error .badge-dot { background: var(--red); }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ── P&L figures ── */
.pnl-positive { color: var(--green); font-weight: 700; }
.pnl-negative { color: var(--red); font-weight: 700; }
.pnl-neutral { color: var(--text-dim); font-weight: 700; }
.figure { font-family: var(--mono); }

/* ── Instance grid on dashboard ── */
.instance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.instance-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
.instance-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.instance-symbol { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.instance-meta { color: var(--text-dim); font-size: 13px; margin-top: 8px; }
.instance-pnl-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.free-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--green-dim);
    color: var(--green);
}
.instance-card-wrap { position: relative; }
.instance-card-delete { margin-top: 8px; text-align: right; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}
.empty-state .btn { margin-top: 16px; }

/* ── Flash messages ── */
.flash-stack { margin-bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 8px; font-size: 14px; }
.flash-success { background: var(--green-dim); color: var(--green); }
.flash-error { background: var(--red-dim); color: var(--red); }
.flash-info { background: var(--accent-dim); color: var(--accent); }

/* ── Wizard step indicator ── */
.steps { display: flex; gap: 8px; margin-bottom: 28px; }
.step {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
}
.step.done { background: var(--accent); }

/* ── Auth pages ── */
.auth-wrap { max-width: 380px; margin: 60px auto; }
.auth-wrap .card { padding: 32px; }

/* ── Activity feed ── */
.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-feed li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
}
.activity-feed li:last-child { border-bottom: none; }

/* ── Warning box (go-live confirmation) ── */
.warning-box {
    background: var(--amber-dim);
    border: 1px solid #5a4718;
    color: var(--amber);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
    margin-bottom: 18px;
}

hr.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Live grid visualization ── */
#viz-price-wrap { display: flex; align-items: baseline; gap: 6px; }
#viz-price { font-size: 22px; font-weight: 700; }
#viz-price-arrow { font-size: 14px; }

.viz-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 18px 0 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.viz-stats .figure { font-size: 17px; font-weight: 700; margin-top: 2px; }

.ladder {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0 4px;
    max-height: 420px;
    overflow-y: auto;
}
.ladder-empty { color: var(--text-faint); font-size: 13px; padding: 20px 0; text-align: center; }

.level {
    display: grid;
    grid-template-columns: 14px 44px 1fr 1fr 70px;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-elevated);
    border: 1px solid transparent;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.level-buy { border-left: 2px solid var(--accent-dim); }
.level-sell { border-left: 2px solid #4a3a1c; }

.level-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.level.resting .level-dot { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; }
.level.blocked .level-dot { background: var(--red); opacity: 0.6; }

.level-side { text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; color: var(--text-dim); }
.level-buy .level-side { color: var(--accent); }
.level-sell .level-side { color: var(--amber); }

.level-status { font-size: 11px; color: var(--text-faint); text-align: right; text-transform: capitalize; }
.level.resting .level-status { color: var(--green); }

.current-price-line {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    margin: 2px 0;
    border-top: 1px dashed var(--accent);
    border-bottom: 1px dashed var(--accent);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--accent-dim);
    border-radius: 4px;
}

/* ── Fill toasts ── */
#toast-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
}
.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    max-width: 280px;
}
.toast-in { opacity: 1; transform: translateY(0); }
.toast-buy { border-left: 3px solid var(--accent); color: var(--text); }
.toast-sell { border-left: 3px solid var(--green); color: var(--text); }

/* ── Landing page ───────────────────────────────────────────────────────
   Signature element: the live grid ladder itself as the hero visual —
   the one thing genuinely unique to this product, not a stock illustration
   or generic dashboard mockup. Display type (Space Grotesk) is used only
   for headlines; body copy and UI stay on the system font already used
   throughout the app, so the landing page reads as the front door of the
   same product, not a bolted-on marketing site. */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&display=swap');

.landing { max-width: 1080px; margin: 0 auto; }

.hero {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 56px;
    align-items: center;
    padding: 40px 0 90px;
}
.eyebrow-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.eyebrow-logo { width: 22px; height: 22px; border-radius: 6px; }
.eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0;
}
.hero-copy h1 {
    font-family: 'Space Grotesk', var(--font);
    font-size: 52px;
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 20px;
}
.hero-sub {
    color: var(--text-dim);
    font-size: 17px;
    line-height: 1.6;
    max-width: 440px;
    margin: 0 0 28px;
}
.hero-ctas { display: flex; gap: 12px; margin-bottom: 14px; }
.btn-hero { padding: 13px 26px; font-size: 15px; }
.hero-note { color: var(--text-faint); font-size: 13px; }

.hero-viz {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.hero-viz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.hero-price { font-size: 18px; font-weight: 700; }

.how { padding: 70px 0; border-top: 1px solid var(--border); }
.how-eyebrow {
    font-family: 'Space Grotesk', var(--font);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 28px;
}
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.how-step { position: relative; padding-top: 8px; }
.how-num {
    font-family: 'Space Grotesk', var(--font);
    font-size: 64px;
    line-height: 1;
    font-weight: 700;
    color: transparent;
    -webkit-text-stroke: 1.5px var(--accent);
    opacity: 0.9;
    margin-bottom: 4px;
}
.how-step h3 { font-size: 18px; margin: 4px 0 12px; }
.how-step p { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin: 0; }

.trust { padding: 70px 0; border-top: 1px solid var(--border); }
.trust-inner { max-width: 620px; }
.trust h2 {
    font-family: 'Space Grotesk', var(--font);
    font-size: 30px;
    margin: 0 0 32px;
}
.trust-points { display: flex; flex-direction: column; gap: 20px; }
.trust-point { display: flex; align-items: flex-start; gap: 14px; font-size: 15px; color: var(--text); }
.trust-mark {
    flex-shrink: 0;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    background: var(--red-dim); color: var(--red);
}
.trust-point:last-child .trust-mark { background: var(--green-dim); color: var(--green); }

.cta-final {
    text-align: center;
    padding: 80px 0 60px;
    border-top: 1px solid var(--border);
}
.cta-final h2 {
    font-family: 'Space Grotesk', var(--font);
    font-size: 32px;
    margin: 0 0 12px;
}
.cta-final p { color: var(--text-dim); margin: 0 0 28px; }

@media (max-width: 800px) {
    .hero { grid-template-columns: 1fr; }
    .hero-copy h1 { font-size: 38px; }
    .how-grid { grid-template-columns: 1fr; }
}

/* ── Onboarding step indicator ── */
.onboarding-steps {
    display: flex;
    align-items: center;
    max-width: 520px;
    margin: 0 auto 36px;
}
.ob-step { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.ob-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-faint);
}
.ob-step.done .ob-dot { background: var(--green-dim); border-color: #1c4a36; color: var(--green); }
.ob-step.active .ob-dot { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.ob-label { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.ob-step.done .ob-label, .ob-step.active .ob-label { color: var(--text-dim); }
.ob-line { flex: 1; height: 1px; background: var(--border); margin: 0 6px 20px; }
.ob-line.done { background: var(--green); opacity: 0.5; }

@media (max-width: 600px) {
    .ob-label { display: none; }
}

/* ── Admin panel ── */
.admin-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.admin-tab {
    padding: 10px 16px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}
.admin-stat-figure { font-family: var(--mono); font-size: 28px; font-weight: 700; margin: 6px 0; }

.admin-status-row { display: flex; flex-wrap: wrap; gap: 12px; }
.admin-status-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
    text-align: left;
    color: var(--text-faint);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table a { color: var(--accent); text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }

@media (max-width: 700px) {
    .admin-stat-grid { grid-template-columns: 1fr; }
}
