:root {
    --bg: #0b101b;
    --surface: #121a2b;
    --surface-2: #192338;
    --border: #25334d;
    --text: #e6edf7;
    --muted: #93a4bf;
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.16);
    --green: #10b981;
    --green-soft: rgba(16, 185, 129, 0.16);
    --yellow: #f59e0b;
    --yellow-soft: rgba(245, 158, 11, 0.16);
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, 0.16);
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    padding-bottom: 76px;
}

a { color: #60a5fa; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(11, 16, 27, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}
.brand:hover { text-decoration: none; }

.brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #10b981);
    color: #fff;
    font-weight: 800;
}

.brand-pill, .progress-pill {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.35);
    font-weight: 600;
}

.nav-links { display: flex; gap: 8px; align-items: center; }

.nav-btn {
    padding: 8px 13px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav-btn:hover { text-decoration: none; color: var(--text); border-color: #3b4f75; }
.nav-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.mini-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 999px;
    padding: 1px 6px;
    font-size: 0.72rem;
}

.container { max-width: 1120px; margin: 0 auto; padding: 18px 16px 32px; }

.hero-card {
    background: linear-gradient(145deg, #13213b 0%, #0f1728 100%);
    border: 1px solid #2b3f63;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
}

.hero-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.hero-eyebrow { font-size: 0.86rem; color: var(--muted); font-weight: 600; }
.hero-amount { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0; }
.hero-diff { font-size: 0.95rem; font-weight: 600; }

.hero-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--green-soft);
    color: #34d399;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.dot-live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}
.muted-small { font-size: 0.8rem; color: var(--muted); }

.hero-ai-strip {
    margin-top: 16px;
    padding: 11px 14px;
    border-radius: 12px;
    background: rgba(11, 16, 27, 0.55);
    border: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.hero-ai-strip:hover { text-decoration: none; border-color: var(--accent); }
.hero-ai-text { flex: 1; font-size: 0.88rem; color: #cbd5e1; min-width: 200px; }
.hero-ai-arrow { font-size: 0.84rem; font-weight: 600; color: #60a5fa; }

.two-col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.wallet-card, .panel, .banner, .kpi-card, .asset-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.wallet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.wallet-title { font-weight: 700; font-size: 0.96rem; }
.wallet-value { font-size: 1.55rem; font-weight: 800; }
.wallet-sub { font-size: 0.84rem; margin-top: 4px; }

.compare-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.compare-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.86rem;
    color: var(--muted);
}

.banner {
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.banner h1 { margin: 0 0 4px; font-size: 1.25rem; }
.banner p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.panel { margin-bottom: 18px; }
.panel-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.panel-sub { font-size: 0.84rem; color: var(--muted); }

.reassure-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}
.reassure-box p { margin: 6px 0 0; color: var(--muted); font-size: 0.88rem; }

.trades-cards, .ai-cards, .alert-list { display: flex; flex-direction: column; gap: 12px; }

.open-trade-card, .ai-card, .alert-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}
.open-trade-head, .ai-card-head, .alert-item-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.open-trade-pnl { font-weight: 800; font-size: 1rem; }
.open-trade-prices {
    display: flex;
    gap: 18px;
    font-size: 0.86rem;
    color: var(--muted);
    margin: 8px 0;
}
.range-bar-wrap { margin-top: 8px; }
.range-labels { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 4px; }
.range-track, .conf-track {
    height: 8px;
    border-radius: 999px;
    background: #0b101b;
    overflow: hidden;
    border: 1px solid var(--border);
}
.range-fill { height: 100%; background: linear-gradient(90deg, #ef4444, #3b82f6, #10b981); }
.open-trade-reason { margin-top: 10px; font-size: 0.84rem; color: #cbd5e1; }

.market-list { display: flex; flex-direction: column; gap: 10px; }
.market-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.market-name-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.market-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.market-right { text-align: right; }
.market-price { font-weight: 700; font-size: 1.02rem; }
.market-chg { font-size: 0.83rem; font-weight: 600; }

.market-pill {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}
.pill-open { background: var(--accent-soft); color: #93c5fd; }
.pill-closed { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

.badge {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    display: inline-block;
}
.badge-green { background: var(--green-soft); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-yellow { background: var(--yellow-soft); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-red { background: var(--red-soft); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.35); }
.badge-neutral { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.25); }

.pos { color: #34d399 !important; }
.neg { color: #f87171 !important; }

.conf-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.conf-track { flex: 1; max-width: 220px; }
.big-track { max-width: 100%; height: 12px; margin-top: 8px; }
.conf-fill { height: 100%; border-radius: 999px; }
.conf-high { background: #10b981; }
.conf-mid { background: #f59e0b; }
.conf-low { background: #64748b; }
.ai-reason { margin: 8px 0 6px; font-size: 0.94rem; }
.ai-risk { font-size: 0.82rem; color: #fbbf24; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
.btn-primary, .btn-secondary {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

.push-feedback { font-size: 0.86rem; min-height: 20px; margin-bottom: 10px; }
.push-feedback.ok { color: #34d399; }
.push-feedback.err { color: #fbbf24; }
.install-steps h3 { font-size: 0.94rem; margin: 12px 0 6px; }
.install-steps ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.86rem; }

.alert-item p { margin: 6px 0 0; font-size: 0.88rem; color: #cbd5e1; }

.guide-intro { margin-bottom: 16px; color: #cbd5e1; }
.guide-intro blockquote {
    margin: 10px 0;
    padding: 12px 16px;
    background: var(--accent-soft);
    border-left: 4px solid var(--accent);
    border-radius: 0 10px 10px 0;
}
.toc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.search-input {
    width: 100%;
    max-width: 340px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0b101b;
    color: var(--text);
    font-size: 0.86rem;
}
.lessons-stack { display: flex; flex-direction: column; gap: 12px; }
.lesson-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.lesson-summary {
    padding: 14px 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    list-style: none;
}
.lesson-check-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
}
.lesson-body {
    padding: 4px 18px 18px;
    border-top: 1px solid var(--border);
    color: #dbe4f3;
}
.lesson-body code {
    background: #080c15;
    padding: 2px 6px;
    border-radius: 6px;
    color: #93c5fd;
    font-size: 0.88em;
}

.controls-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; justify-content: space-between; }
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-link {
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}
.pill-link.active { background: var(--accent-soft); color: #93c5fd; border-color: var(--accent); }

.summary-grid, .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.asset-card { color: var(--text); display: block; }
.asset-card.selected { border-color: var(--accent); }
.asset-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.asset-title { font-weight: 700; }
.mini-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-size: 0.84rem; color: var(--muted); }
.mini-metrics strong { display: block; color: var(--text); }
.kpi-label { font-size: 0.82rem; color: var(--muted); }
.kpi-value { font-size: 1.35rem; font-weight: 700; margin: 5px 0 2px; }
.kpi-sub { font-size: 0.78rem; color: var(--muted); }

.chart-wrap { position: relative; height: 270px; width: 100%; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; }

.empty-box {
    background: var(--surface);
    border: 1px dashed #3b4f75;
    border-radius: var(--radius);
    padding: 22px;
    text-align: center;
}
.empty-box code { background: #080c15; padding: 4px 8px; border-radius: 6px; color: #93c5fd; }

.footer-lab-link { text-align: center; margin-top: 8px; font-size: 0.86rem; }

.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: rgba(11, 16, 27, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    position: relative;
    padding: 4px 0;
}
.bottom-nav-item.active { color: #60a5fa; }
.bottom-nav-icon { font-size: 1.1rem; }
.bottom-badge {
    position: absolute;
    top: 0;
    right: 22%;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 999px;
}

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 18px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.login-card input { width: 100%; padding: 10px 12px; margin: 8px 0 14px; border-radius: 10px; border: 1px solid var(--border); background: #0b101b; color: var(--text); }
.alert-err { background: var(--red-soft); color: #f87171; padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; font-size: 0.86rem; }

@media (max-width: 720px) {
    .desktop-only { display: none; }
    .bottom-nav { display: flex; }
    .hero-amount { font-size: 1.85rem; }
    .hero-status { align-items: flex-start; }
}
