/* ============================================
    CANDLEKEEP — Consolidated Styles
    ============================================ */

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

/* --- Design Tokens --- */
:root {
    /* Backgrounds */
    --bg-body:       #0b1420;
    --bg-card:       #111c2c;
    --bg-accent:     #0f1a29;
    --bg-inset:      #0a1320;
    --bg-hover:      #16243a;
    --bg-hover-light:#1b2a42;
    --bg-active:     #102636;
    --bg-code:       #0b111a;

    /* Brand */
    --c-primary:       #4ea1ff;
    --c-primary-hover: #3b8eea;

    /* Semantic */
    --c-success:        #2ccb7f;
    --c-success-dim:    #1f9d64;
    --c-success-light:  #b7f0d1;
    --c-success-bg:     rgba(44, 203, 127, 0.12);
    --c-success-border: rgba(44, 203, 127, 0.2);
    --c-danger:         #ff5b5b;
    --c-danger-bg:      rgba(255, 91, 91, 0.1);
    --c-info:           #7bb8ff;
    --c-warning:        #f5c451;
    --c-warning-bg:     rgba(245, 196, 81, 0.13);
    --c-gray:           #6b7b8f;
    --c-yellow:         #f3d27a;

    /* Text */
    --c-text:  #e5edf7;
    --c-muted: #9fb0c3;
    --c-dim:   #7f8ea3;

    /* Border */
    --c-border: #1f2d42;

    /* Radii */
    --r-sm:   0px;
    --r-md:   0px;
    --r-lg:   0px;
    --r-pill: 0px;

    /* Fonts */
    --font-body: 'IBM Plex Sans', 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Cascadia Code', monospace;
}

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: linear-gradient(180deg, var(--bg-body) 0%, var(--bg-inset) 100%);
    color: var(--c-text);
    min-height: 100vh;
}

/* --- Navigation --- */
nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--c-border);
}

nav > .nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left { display: flex; align-items: center; }

.nav-left a {
    color: var(--c-text);
    text-decoration: none;
    margin-right: 1rem;
}

.nav-left a:hover { color: var(--c-primary); }

.nav-right-desktop {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-right-desktop a {
    color: var(--c-text);
    text-decoration: none;
    transition: color 0.15s;
}

.nav-right-desktop a:hover { color: var(--c-primary); }

.nav-right-desktop .nav-logout {
    background: none;
    border: none;
    color: var(--c-muted);
    cursor: pointer;
    font: inherit;
    padding: 0;
    transition: color 0.15s;
}

.nav-right-desktop .nav-logout:hover { color: var(--c-primary); }
.nav-right-desktop .nav-username { color: var(--c-primary); font-weight: 600; }

/* Burger menu — hidden on desktop */
.burger-menu { position: relative; display: none; }

.burger-btn {
    background: none;
    border: 1px solid var(--c-border);
    color: var(--c-text);
    cursor: pointer;
    font: inherit;
    padding: 0.4rem 0.75rem;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s, border-color 0.15s;
}

.burger-btn:hover {
    background: var(--bg-hover);
    border-color: var(--c-primary);
}

.burger-btn .burger-icon { display: flex; flex-direction: column; gap: 3px; }

.burger-btn .burger-icon span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--c-text);
    border-radius: 0;
}

.burger-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
    overflow: hidden;
}

.burger-dropdown.open { display: block; }

.burger-dropdown a,
.burger-dropdown button {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    color: var(--c-text);
    text-decoration: none;
    text-align: left;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--c-border);
}

.burger-dropdown a:last-child,
.burger-dropdown form:last-child button { border-bottom: none; }

.burger-dropdown a:hover,
.burger-dropdown button:hover {
    background: var(--bg-hover);
    color: var(--c-primary);
}

@media (max-width: 768px) {
    .nav-right-desktop { display: none; }
    .burger-menu { display: block; }
}

/* --- Layout --- */
.container { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }

/* --- Utilities --- */
.text-success { color: var(--c-success); }
.text-danger  { color: var(--c-danger); }
.text-muted   { color: var(--c-muted); }\n.text-dim     { color: var(--c-dim); }
.positive     { color: var(--c-success); }
.negative     { color: var(--c-danger); }
.neutral      { color: var(--c-text); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }


/* --- Shared Panel Base ---
   Card-like containers sharing background + border + radius. */
.card,
.chart-container,
.chart-section,
.strategy-content,
.breakdown-section,
.version-list,
.settings-section,
.instructions-container,
.login-box,
.history-item,
.data-table,
.stat-card,
.feature {
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
}

/* Standard panel padding */
.card,
.chart-container,
.chart-section,
.strategy-content,
.breakdown-section,
.version-list,
.feature {
    padding: 1rem;
}

/* Panels with bottom spacing */
.chart-container,
.chart-section,
.strategy-content,
.breakdown-section,
.version-list {
    margin-bottom: 1.25rem;
}

/* --- Shared Panel Headings --- */
.card h2,
.chart-section h2,
.rounds-section h2,
.version-list h2,
.settings-section h2,
.breakdown-section h2,
.strategy-content h2 {
    color: var(--c-primary);
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

/* --- Shared Accent Panels ---
   Used for round-bars, round-cards, info blocks. */
.round-bar,
.round-card,
.round-header-info {
    background: var(--bg-accent);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
}


/* --- Round Bar --- */
.round-bar { padding: 0.9rem; margin-bottom: 1.25rem; }

.round-bar-link { text-decoration: none; color: inherit; display: block; }

.round-bar-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.round-bar-title { margin: 0; color: var(--c-primary); font-size: 1.1rem; }
.round-bar-user-link { color: inherit; text-decoration: none; }
.round-bar-user-link:hover { color: var(--c-primary); }

.round-bar-countdown {
    font-size: 1rem;
    font-weight: bold;
    color: var(--c-primary);
    font-variant-numeric: tabular-nums;
}

.round-bar-bottom {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.round-bar-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    flex: 1;
}

.round-bar-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.round-bar-label { color: var(--c-muted); font-size: 0.85rem; }
.round-bar-value { color: var(--c-text); font-weight: bold; }
.round-bar-value.positive { color: var(--c-success); }
.round-bar-value.negative { color: var(--c-danger); }
.round-bar-pct   { font-size: 0.85rem; opacity: 0.8; }

a.round-bar-stat-link {
    text-decoration: none;
    color: inherit;
    border-bottom: 1px dashed var(--c-muted);
    padding-bottom: 2px;
}
a.round-bar-stat-link:hover { border-bottom-color: var(--c-primary); }
a.round-bar-stat-link:hover .round-bar-label { color: var(--c-primary); }

.round-bar-details-btn {
    white-space: nowrap;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-primary);
    border: 1px solid var(--c-primary);
    border-radius: var(--r-md);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.round-bar-details-btn:hover {
    background: var(--c-primary);
    color: var(--bg-body);
}


/* --- Tables --- */
.data-table { width: 100%; border-collapse: collapse; overflow: hidden; }

.data-table th {
    background: var(--bg-inset);
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--c-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--c-border);
}

.data-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.95rem;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table a { color: var(--c-primary); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

.data-table tr:hover { background: var(--bg-hover); }

.rank { color: var(--c-primary); font-weight: bold; width: 3rem; }

.rank-number     { font-weight: 700; color: var(--c-success); font-size: 1.1rem; }
.username        { font-weight: 600; color: var(--c-text); }
.funds           { font-weight: 600; font-size: 1.05rem; }
.funds.positive  { color: var(--c-success); }
.funds.negative  { color: var(--c-danger); }
.pnl-value       { font-weight: 600; text-align: right; }
.pnl-positive    { color: var(--c-success); }
.pnl-negative    { color: var(--c-danger); }
.open-positions  { font-size: 0.9rem; color: var(--c-muted); }


/* --- Stat Cards --- */
.stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

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

.stat-card { padding: 0.9rem; }

.stat-card--green { border-top: 2px solid var(--c-success); }
.stat-card--red   { border-top: 2px solid var(--c-danger); }
.stat-card--blue  { border-top: 2px solid var(--c-info); }

.stat-card--green .stat-label { color: var(--c-success); }
.stat-card--red   .stat-label { color: var(--c-danger); }
.stat-card--blue  .stat-label { color: var(--c-info); }

.stat-label {
    color: var(--c-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    letter-spacing: 0.5px;
}

.stat-value { font-size: 1.4rem; font-weight: bold; }


/* --- Badges --- */
.status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: var(--r-pill);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.status-active    { background: var(--c-success); color: #000; }
.status-upcoming  { background: var(--c-yellow); color: #000; }
.status-completed { background: var(--c-gray); color: #fff; }

.history-badge {
    padding: 0.25rem 0.6rem;
    border-radius: var(--r-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-open   { background: var(--c-success); color: #000; }
.badge-closed { background: var(--c-gray); color: #fff; }
.badge-green  { background: var(--c-success-dim); color: #fff; }
.badge-red    { background: var(--c-danger); color: #fff; }
.badge-blue   { background: var(--c-info); color: #0b1420; }
.badge-ai     { background: var(--c-info); color: #0b1420; }

.strategy-badge {
    display: inline-block;
    background: var(--c-warning-bg);
    color: var(--c-warning);
    padding: 0.15rem 0.5rem;
    border-radius: var(--r-sm);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.strategy-badge:hover { background: rgba(245, 196, 81, 0.25); }

.side-tag {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 600;
}

.side-long  { background: var(--c-success-bg); color: var(--c-success); }
.side-short { background: var(--c-danger-bg); color: var(--c-danger); }


/* --- Chat Messages (AI Feed) --- */
.ai-feed-scroll { max-height: 400px; overflow-y: auto; padding-right: 0.25rem; }

.chat-msg {
    position: relative;
    background: var(--bg-inset);
    border-radius: 0;
    padding: 0.85rem 1rem;
    margin-bottom: 0.6rem;
}

.chat-msg-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    line-height: 1;
}

.chat-msg-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    vertical-align: middle;
    border-radius: var(--r-sm);
}
.chat-msg-sender    { color: var(--c-info); font-weight: 700; }
.chat-msg-arrow     { color: var(--c-muted); font-size: 0.7rem; }
.chat-msg-recipient { color: var(--c-primary); font-weight: 600; text-decoration: none; }
.chat-msg-recipient:hover { text-decoration: underline; }
.chat-msg-time      { color: var(--c-muted); margin-left: auto; font-size: 0.75rem; }

.chat-msg-body {
    color: var(--c-text);
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.chat-msg-action {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--c-border);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-msg-action-detail { color: var(--c-muted); }

.chat-msg-prompt { margin-bottom: 0.5rem; color: var(--c-muted); font-size: 0.85rem; }

.chat-msg-prompt pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--r-sm);
    margin: 0.4rem 0 0 0;
    font-size: 0.8rem;
    max-height: 250px;
    overflow-y: auto;
}

.chat-msg-meta {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--c-muted);
}


/* --- Chart Container --- */
.chart-container h2,
.chart-container h3 {
    margin-top: 0;
    color: var(--c-text);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--c-border);
}

.chart-canvas-wrap { height: 300px; }


/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 1.25rem 0 0.25rem;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 0.4rem 0.8rem;
    border-radius: var(--r-md);
    background: var(--c-border);
    color: var(--c-text);
    text-decoration: none;
    font-weight: 600;
}

.page-link:hover       { background: var(--bg-hover-light); }
.page-link.active      { background: var(--c-primary); color: #fff; }
.page-link--disabled   { opacity: 0.5; pointer-events: none; }
.page-link--ellipsis   { background: none; color: var(--c-muted); }


/* --- Position History (Accordion) --- */
.history-item { margin-bottom: 0.75rem; overflow: hidden; }

.history-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    gap: 1rem;
    user-select: none;
    transition: background 0.15s;
}

.history-header:hover { background: var(--bg-hover); }

.history-summary {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.history-asset  { font-weight: 700; font-size: 1rem; min-width: 3rem; }
.history-detail { color: var(--c-muted); font-size: 0.85rem; }
.history-pnl    { font-weight: 700; font-size: 0.95rem; min-width: 6rem; text-align: right; }
.history-time   { color: var(--c-muted); font-size: 0.8rem; min-width: 7rem; text-align: right; }

.history-expand-icon {
    color: var(--c-muted);
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.history-item.expanded .history-expand-icon { transform: rotate(90deg); }

.history-body {
    display: none;
    padding: 0 0.75rem 0.75rem;
    border-top: 1px solid var(--c-border);
}

.history-item.expanded .history-body { display: block; }

.pos-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-inset);
    border-radius: var(--r-sm);
}

.pos-detail-item  { display: flex; flex-direction: column; }
.pos-detail-label { color: var(--c-muted); font-size: 0.75rem; text-transform: uppercase; }
.pos-detail-value { font-size: 0.9rem; font-weight: 600; }


/* --- Section --- */
.section { margin-bottom: 1.5rem; }

.section-title {
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--c-border);
}


/* --- Profile Header & Tabs --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--c-border);
}

.profile-header h1 { font-size: 2rem; margin: 0; }
.profile-header .username { color: var(--c-primary); }


/* --- Avatar --- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-accent);
    color: var(--c-text);
    font-weight: 600;
    line-height: 1;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-sm  { width: 26px; height: 26px; font-size: 0.75rem; }
.avatar-lg  { width: 64px; height: 64px; font-size: 1.5rem;  }

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--c-primary);
    color: #fff;
    font-weight: 700;
}

.avatar-setting {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-setting-vertical {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.avatar-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.avatar-file-input {
    display: none;
}

.avatar-upload-btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    background: var(--bg-accent);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.avatar-upload-btn:hover {
    background: var(--bg-hover);
}

.avatar-filename {
    font-size: 0.85rem;
    color: var(--c-success);
    margin-left: 0.5rem;
}

.avatar-remove {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--c-muted);
    cursor: pointer;
}

.avatar-remove input[type="checkbox"] {
    accent-color: var(--c-danger);
}

.nav-username {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.burger-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--c-border);
}

.profile-tab {
    padding: 0.55rem 1rem;
    color: var(--c-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    font-weight: 500;
}

.profile-tab:hover  { color: var(--c-text); }
.profile-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }


/* --- Forms --- */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    color: var(--c-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-accent);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    color: var(--c-text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--c-primary);
}

.form-group .help-text { color: var(--c-dim); font-size: 0.8rem; margin-top: 0.4rem; }


/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: var(--r-md);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary       { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); }

.save-btn {
    background: var(--c-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: var(--r-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s;
}

.save-btn:hover            { background: var(--c-primary-hover); }
.save-btn--green           { background: #00cc66; }
.save-btn--green:hover     { background: #00b359; }
.save-btn--green:active    { transform: scale(0.97); }
.save-btn--green:disabled  { background: #4a4a5a; cursor: not-allowed; opacity: 0.6; }

.btn-danger {
    background: var(--c-danger);
    color: #fff;
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: var(--r-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-danger:hover { background: #e03040; }

.btn-cancel {
    background: var(--bg-accent);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    padding: 0.5rem 1.1rem;
    border-radius: var(--r-md);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-cancel:hover { background: var(--bg-hover); }

.save-success {
    display: inline-block;
    color: var(--c-success);
    font-size: 0.9rem;
    margin-left: 1rem;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cta-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--c-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--r-sm);
    font-size: 1.1rem;
    margin: 0.5rem;
}

.cta-button:hover { background: var(--c-primary-hover); }


/* --- Empty State --- */
.empty-state      { text-align: center; padding: 2rem; color: var(--c-muted); }
.empty-state p    { margin-bottom: 1rem; }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state-text { font-size: 1.1rem; }

/* --- Welcome Banner --- */
.welcome-banner {
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    margin-bottom: 1.25rem;
}

.welcome-banner-inner {
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.welcome-banner-content {
    flex: 1;
    min-width: 0;
}

.welcome-banner-eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-primary);
    margin: 0 0 0.25rem;
    font-weight: 600;
}

.welcome-banner-title {
    font-size: 1.15rem;
    color: var(--c-text);
    margin: 0 0 0.4rem;
}

.welcome-banner-text {
    font-size: 0.9rem;
    color: var(--c-muted);
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

.welcome-banner-link {
    font-size: 0.85rem;
    color: var(--c-primary);
    text-decoration: none;
    font-weight: 600;
}

.welcome-banner-link:hover {
    text-decoration: underline;
}

.welcome-banner-close {
    background: none;
    border: none;
    color: var(--c-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}

.welcome-banner-close:hover {
    color: var(--c-text);
}


/* --- Links --- */
.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--c-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-link:hover { color: var(--c-primary); }

.edit-strategy-link {
    color: var(--c-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 0.75rem;
}

.edit-strategy-link:hover { color: #ff6b81; }


/* --- Price Ticker (marquee) --- */
.price-ticker-wrapper {
    overflow: hidden;
    background: var(--bg-inset);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 0.35rem 0.75rem;
    font-size: 0.92rem;
    min-height: 28px;
    display: flex;
    justify-content: center;
}

.price-ticker {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    white-space: nowrap;
    width: max-content;
}

.price-ticker.price-ticker-scroll {
    animation: marquee-scroll 18s linear infinite;
    gap: 1.5rem;
}

.price-ticker.price-ticker-scroll:hover {
    animation-play-state: paused;
}

@keyframes marquee-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.price-ticker-label  { color: var(--c-muted); white-space: nowrap; }
.price-ticker-item   { white-space: nowrap; }
.price-ticker-symbol { color: var(--c-muted); }
.price-ticker-value  { font-weight: 600; transition: color 0.5s; }
.price-ticker-dupe   { display: contents; }


/* ============================================
   PAGE: Home
   ============================================ */

.hero { text-align: center; padding: 3rem 1.5rem; }
.hero h1 { font-size: 2.2rem; margin-bottom: 0.5rem; color: var(--c-primary); }
.hero p  { font-size: 1.05rem; color: var(--c-muted); margin-bottom: 1.25rem; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-top: 2rem;
}

/* .feature bg/border/radius/padding from shared panel base */
.feature h3 { color: var(--c-primary); margin-bottom: 0.5rem; }
.feature p  { color: var(--c-muted); }


/* ============================================
   PAGE: Dashboard
   ============================================ */

/* --- Dashboard Two-Column Layout --- */
.dashboard-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "round ai"
        "prices ai"
        "chart ai";
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    align-items: stretch;
}

.dashboard-round  { grid-area: round; }
.dashboard-round .round-bar { margin-bottom: 0; }
.dashboard-prices { grid-area: prices; }

.dashboard-chart {
    grid-area: chart;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.dashboard-ai {
    grid-area: ai;
    position: relative;
    min-width: 0;
}

.dashboard-ai-card {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-ai-card .ai-feed-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

#ai-feed-loader {
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .dashboard-layout {
        display: flex;
        flex-direction: column;
    }

    .dashboard-ai-card {
        position: static;
    }

    .dashboard-ai-card .ai-feed-scroll {
        max-height: 400px;
    }

    .hide-on-mobile { display: none !important; }
}

.dashboard-header { margin-bottom: 1.25rem; }
.dashboard-header h1 { color: var(--c-primary); margin-bottom: 1rem; }


/* ============================================
   PAGE: Round Detail
   ============================================ */

/* .round-header-info bg/border/radius from shared accent panel */
.round-header-info {
    padding: 1rem;
    margin-bottom: 1.25rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.info-block { display: flex; flex-direction: column; }

.info-label {
    color: var(--c-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.info-value { color: var(--c-text); font-size: 1rem; font-weight: 500; }


/* ============================================
   PAGE: Rounds List
   ============================================ */

.rounds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

/* .round-card bg/border/radius from shared accent panel */
.round-card {
    padding: 0.9rem;
    transition: all 0.2s;
}

.round-card:hover {
    border-color: var(--c-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 161, 255, 0.12);
}

.round-card.active { border-color: var(--c-success); background: var(--bg-active); }

.round-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    min-height: 64px;
}

.round-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
    align-content: flex-start;
    min-height: 46px;
    width: 140px;
}

.round-title { font-size: 1.05rem; font-weight: 600; color: var(--c-text); margin: 0; }

.round-status-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: var(--r-pill);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-active      { background: var(--c-success); color: #000; }
.badge-participant { background: var(--c-primary); color: #fff; }
.badge-past        { background: var(--c-gray); color: #fff; }
.badge-upcoming    { background: var(--c-yellow); color: #000; }

.round-card-stats {
    display: flex;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--c-border);
    margin-top: 0.75rem;
}

.round-card-stats .stat       { flex: 1; text-align: center; }
.round-card-stats .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--c-success); }
.round-card-stats .stat-label { font-size: 0.75rem; margin-top: 0.25rem; }

.round-action {
    display: block;
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.75rem;
    background: var(--c-primary);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.round-action + .round-action,
.round-action + span.round-action,
span.round-action + .round-action { margin-top: 0.5rem; }

.round-action:hover                    { background: var(--c-primary-hover); transform: scale(1.02); }
.round-action.secondary                { background: var(--c-border); color: var(--c-text); }
.round-action.secondary:hover          { background: var(--bg-hover-light); transform: scale(1.02); }
.round-action.is-active                { background: var(--c-info); }
.round-action.is-active:hover          { background: var(--c-primary); }
.round-action.secondary.is-active      { background: var(--c-success-dim); }
.round-action.secondary.is-active:hover{ background: var(--c-success); }
.round-action.disabled                 { background: var(--c-gray); cursor: not-allowed; opacity: 0.6; }

.round-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.detail-row   { display: flex; flex-direction: column; }
.detail-label { color: var(--c-muted); font-size: 0.8rem; margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-value { color: var(--c-text); font-weight: 500; }


/* ============================================
   PAGE: Profile
   ============================================ */

/* .chart-section bg/border/radius/padding/mb/h2 all from shared rules */

.chart-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--c-border);
    font-size: 0.85rem;
    color: var(--c-muted);
}

.chart-legend-item    { display: flex; align-items: center; gap: 0.4rem; }
.chart-legend-dot     { width: 10px; height: 10px; border-radius: 0; display: inline-block; }
.chart-legend-diamond { width: 10px; height: 10px; background: var(--c-warning); transform: rotate(45deg); display: inline-block; }

.rounds-section { margin-bottom: 2rem; }
.rounds-section { margin-bottom: 1.25rem; }

/* .version-list bg/border/radius/padding/mb/h2 all from shared rules */

.version-item { padding: 0.75rem 0; border-bottom: 1px solid var(--c-border); }
.version-item:last-child { border-bottom: none; }
.version-item:hover { background: var(--bg-hover); }

.version-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
.version-date { color: var(--c-muted); font-size: 0.85rem; }

.version-preview {
    color: var(--c-dim);
    font-size: 0.8rem;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}


/* ============================================
   PAGE: Profile Settings
   ============================================ */

/* .settings-section bg/border/radius from shared panel base, h2 from shared heading */
.settings-section { padding: 2rem; max-width: 600px; }
.settings-section { padding: 1.25rem; max-width: 600px; }
.settings-section h2 { margin-bottom: 1.5rem; } /* override shared heading */


/* ============================================
   PAGE: Strategy Editor
   ============================================ */

.editor-wrapper {
    display: flex;
    gap: 16px;
    height: calc(100vh - 120px);
    min-height: 500px;
}

/* ── Sidebar ── */

.editor-sidebar {
    width: 280px;
    min-width: 220px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex-shrink: 0;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border);
}

.sidebar-section-header h3 {
    margin: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--c-muted);
    font-weight: 600;
}

.sidebar-add-btn {
    background: none;
    border: 1px solid var(--c-border);
    color: var(--c-muted);
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}
.sidebar-add-btn:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
}

/* Current strategy badge */
.current-strategy-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 8px 8px 4px;
    background: var(--bg-accent);
    border-bottom: 1px solid var(--c-border);
    font-size: 0.85rem;
    color: var(--c-muted);
}
.current-strategy-badge--active {
    color: var(--c-success);
    background: var(--c-success-bg);
    border-left: 3px solid var(--c-success);
}
.current-strategy-badge #current-strategy-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.current-strategy-icon {
    font-size: 0.65rem;
    flex-shrink: 0;
    padding: 0 4px;
}

/* Template list */
.template-list {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-top: none;
}

.template-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 8px 8px 4px;
    border-bottom: 1px solid var(--c-border);
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.85rem;
    color: var(--c-text);
    position: relative;
}
.template-item:last-child { border-bottom: none; }
.template-item:hover { background: var(--bg-hover); }
.template-item--active { background: var(--bg-active); border-left: 3px solid var(--c-primary); }
.template-item--current .template-name { color: var(--c-success); }
.template-item--ghost { opacity: 0.4; }

.template-drag-handle {
    cursor: grab;
    color: var(--c-dim);
    font-size: 14px;
    padding: 0 4px;
    user-select: none;
    flex-shrink: 0;
}
.template-drag-handle:active { cursor: grabbing; }

.template-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-name-non-authenticated {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 5px;
    margin-top: 1px;
    margin-bottom: 1px;
}

/* Validation dot */
.validation-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    display: inline-block;
}
.validation-dot--valid   { background: var(--c-success); }
.validation-dot--invalid { background: var(--c-danger); }
.validation-dot--unknown { background: var(--c-dim); }

/* Template dropdown (per-item) */
.template-dropdown-wrapper { position: relative; flex-shrink: 0; }

.template-dropdown-btn {
    background: none;
    border: none;
    color: var(--c-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 4px;
    line-height: 1;
}
.template-dropdown-btn:hover { color: var(--c-text); }

.template-dropdown {
    display: none;
    position: fixed;
    z-index: 1000;
    background: var(--bg-accent);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.template-dropdown.open { display: block; }

.template-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--c-text);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
}
.template-dropdown button:hover { background: var(--bg-hover); }
.template-dropdown-danger { color: var(--c-danger) !important; }

/* ── Editor main panel ── */

.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-accent);
    border: 1px solid var(--c-border);
    border-bottom: none;
    flex-wrap: wrap;
    gap: 8px;
}

.editor-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-toolbar-label {
    font-size: 0.8rem;
    color: var(--c-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.editor-active-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--c-text);
}

.editor-toolbar-right {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Editor buttons */
.editor-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    border: 1px solid var(--c-border);
    background: var(--bg-card);
    color: var(--c-text);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
    white-space: nowrap;
}
.editor-btn:hover:not(:disabled) { border-color: var(--c-primary); color: var(--c-primary); }
.editor-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.editor-btn--primary {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
    font-weight: 600;
}
.editor-btn--primary:hover:not(:disabled) { background: var(--c-primary-hover); border-color: var(--c-primary-hover); color: #fff; }

.editor-btn--danger {
    background: var(--c-danger);
    border-color: var(--c-danger);
    color: #fff;
    font-weight: 600;
}
.editor-btn--danger:hover:not(:disabled) { background: #e63946; border-color: #e63946; color: #fff; }

/* Validation icon in toolbar */
.validation-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    white-space: nowrap;
}
.validation-icon--valid   { color: var(--c-success); border-color: var(--c-success-border); background: var(--c-success-bg); }
.validation-icon--invalid { color: var(--c-danger); border-color: rgba(255,91,91,0.3); background: var(--c-danger-bg); }
.validation-icon--unknown { color: var(--c-dim); }

/* Editor body (wraps CM + feeds panel side by side) */
.editor-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* CodeMirror wrapper */
.editor-cm-wrapper {
    flex: 1;
    border: 1px solid var(--c-border);
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.editor-cm-wrapper .CodeMirror {
    flex: 1;
    height: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg-code);
}

.editor-cm-wrapper--readonly {
    border-color: var(--c-dim);
    opacity: 0.85;
}

.editor-cm-wrapper--readonly .CodeMirror {
    background: var(--bg-inset);
}

/* CodeMirror token overrides for candlescript mode */
.cm-s-material-darker .cm-header    { color: var(--c-primary); font-weight: 700; }
.cm-s-material-darker .cm-bracket   { color: var(--c-warning); font-weight: 700; }
.cm-s-material-darker .cm-def       { color: #82aaff; }
.cm-s-material-darker .cm-attribute { color: var(--c-info); }
.cm-s-material-darker .cm-atom      { color: var(--c-warning); font-weight: 600; }
.cm-s-material-darker .cm-keyword   { color: var(--c-success); font-weight: 600; }

/* ── Feeds Panel ── */

.feeds-panel {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    border: 1px solid var(--c-border);
    border-left: none;
    background: var(--bg-card);
    overflow: hidden;
    transition: width 0.2s ease;
}

.feeds-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    flex-shrink: 0;
    background: var(--bg-accent);
    border-right: 1px solid var(--c-border);
    cursor: pointer;
    user-select: none;
    color: var(--c-muted);
    font-size: 0.6rem;
}
.feeds-panel-toggle:hover { color: var(--c-text); background: var(--bg-hover); }

.feeds-panel-toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
}

.feeds-panel--collapsed {
    width: 20px;
}

.feeds-panel--collapsed .feeds-panel-toggle {
    border-right: none;
}

.feeds-panel--collapsed .feeds-panel-toggle-icon {
    transform: rotate(180deg);
}

.feeds-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.feeds-panel--collapsed .feeds-panel-content {
    display: none;
}

.feeds-panel-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.feeds-panel-body {
    padding: 0;
}

.feeds-section-title {
    padding: 6px 10px 3px;
    margin: 0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--c-border);
}
.feeds-section-title:not(:first-child) {
    border-top: 1px solid var(--c-border);
    margin-top: 2px;
}
.feeds-section-title--valid  { color: var(--c-success); }
.feeds-section-title--invalid { color: var(--c-danger); }

.feeds-item {
    padding: 5px 10px;
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.feeds-item:last-child { border-bottom: none; }

.feeds-item--clickable { cursor: pointer; }
.feeds-item--clickable:hover { background: var(--bg-hover); }

.feeds-item-name {
    font-weight: 600;
    color: var(--c-text);
}
.feeds-item--invalid .feeds-item-name { color: var(--c-danger); }

.feeds-item-args {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--c-dim);
}

.feeds-item-error {
    color: var(--c-danger);
    font-size: 0.72rem;
}

.feeds-item-line {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--c-info);
}

.feeds-empty {
    padding: 12px 10px;
    font-size: 0.75rem;
    color: var(--c-dim);
    text-align: center;
}

/* ── Modals ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    padding: 24px;
    min-width: 320px;
    max-width: 90vw;
}

.modal-box h3 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    color: var(--c-text);
}

.modal-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-accent);
    border: 1px solid var(--c-border);
    color: var(--c-text);
    font-size: 0.9rem;
    font-family: var(--font-body);
    margin-bottom: 16px;
    box-sizing: border-box;
}
.modal-input:focus { outline: none; border-color: var(--c-primary); }

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Toast ── */

.editor-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 10px 20px;
    background: var(--c-success-bg);
    color: var(--c-success);
    border: 1px solid var(--c-success-border);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.editor-toast--error {
    background: var(--c-danger-bg);
    color: var(--c-danger);
    border-color: rgba(255,91,91,0.3);
}
.editor-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Responsive: stack on mobile ── */

@media (max-width: 900px) {
    .editor-wrapper {
        flex-direction: column;
        height: auto;
    }

    .editor-sidebar {
        width: 100%;
        max-width: 100%;
        flex-shrink: 1;
    }

    .template-list {
        max-height: 200px;
    }

    .editor-body {
        flex-direction: column;
    }

    .feeds-panel {
        width: 100% !important;
        flex-direction: column;
        border-left: 1px solid var(--c-border);
        border-top: none;
        max-height: 180px;
    }

    .feeds-panel-toggle {
        width: 100%;
        height: 20px;
        border-right: none;
        border-bottom: 1px solid var(--c-border);
    }

    .feeds-panel--collapsed {
        width: 100% !important;
        max-height: 20px;
    }

    .feeds-panel--collapsed .feeds-panel-toggle {
        border-bottom: none;
    }

    .feeds-panel-toggle-icon {
        transform: rotate(-90deg);
    }

    .feeds-panel--collapsed .feeds-panel-toggle-icon {
        transform: rotate(90deg);
    }

    .editor-cm-wrapper {
        min-height: 350px;
    }

    .editor-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .editor-toolbar-right {
        justify-content: flex-start;
    }
}


/* ============================================
   PAGE: Strategy Version Detail
   ============================================ */

.version-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--c-border);
}

.version-header h1 { font-size: 1.8rem; margin: 0 0 0.3rem 0; }
.version-header .version-tag { color: var(--c-warning); }

.version-nav { display: flex; gap: 0.5rem; }

.version-nav a {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    color: var(--c-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.version-nav a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.version-nav .disabled { opacity: 0.3; pointer-events: none; }

/* .strategy-content bg/border/radius/padding/mb/h2 from shared rules */

.strategy-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.strategy-content-header h2 { margin-bottom: 0; }

.strategy-code {
    background: var(--bg-code);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    color: #c9d1d9;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* .breakdown-section bg/border/radius/padding/mb/h2 from shared rules */

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.asset-card {
    background: var(--bg-inset);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 1rem;
}

.asset-name { font-weight: 600; font-size: 1rem; margin-bottom: 0.4rem; }
.asset-stat { font-size: 0.85rem; color: var(--c-muted); }
.asset-pnl  { font-weight: 600; font-size: 1.1rem; margin-top: 0.3rem; }


/* ============================================
   PAGE: Strategy Builder Instructions
   ============================================ */

/* .instructions-container bg/border/radius from shared panel base */
.instructions-container { position: relative; padding: 2rem; margin-top: 1rem; }

.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-accent);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.copy-btn:hover,
.copy-btn.copied {
    background: var(--c-success);
    color: var(--bg-body);
    border-color: var(--c-success);
}

.instructions-content {
    font-family: var(--font-body);
    line-height: 1.7;
    white-space: pre-wrap;
    font-size: 14px;
}

.instructions-content h1 {
    color: var(--c-success);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--c-border);
    padding-bottom: 0.5rem;
}

.instructions-content h2 { color: var(--c-success-light); font-size: 1.2rem; margin-top: 1.5rem; margin-bottom: 0.75rem; }
.instructions-content h3 { color: var(--c-text); font-size: 1rem; margin-top: 1rem; margin-bottom: 0.5rem; }

.instructions-content code {
    background: var(--c-success-bg);
    padding: 2px 6px;
    border-radius: 0;
    font-family: monospace;
    font-size: 13px;
}

.instructions-content pre {
    background: var(--bg-accent);
    padding: 1rem;
    border-radius: var(--r-sm);
    overflow-x: auto;
    margin: 0.75rem 0;
}

.instructions-content pre code { background: none; padding: 0; }

.instructions-content ul,
.instructions-content ol { margin: 0.5rem 0 0.5rem 1.5rem; }
.instructions-content li { margin-bottom: 0.3rem; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.page-header h1 { margin: 0; font-size: 1.5rem; }
.page-description { color: var(--c-muted); margin-bottom: 1rem; }


/* ============================================
   PAGE: Login
   ============================================ */

/* .login-box bg/border/radius from shared panel base */
.login-box { max-width: 400px; margin: 32px auto; padding: 1.25rem; }
.login-box h1 { margin-bottom: 1.5rem; color: var(--c-primary); }
.login-box form p { margin-bottom: 1rem; }
.login-box label { display: block; margin-bottom: 0.5rem; }

.login-box input {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-accent);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    color: var(--c-text);
}

.login-box button {
    width: 100%;
    padding: 0.75rem;
    background: var(--c-primary);
    color: white;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    margin-top: 1rem;
    font-size: 1rem;
}

.login-box button:hover { background: var(--c-primary-hover); }

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: var(--c-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--c-border);
}

.auth-divider span { padding: 0 0.75rem; }

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: #fff;
    color: #3c4043;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.google-btn:hover {
    background: #f7f8f8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.google-btn-icon { flex-shrink: 0; }

.auth-link {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--c-muted);
    font-size: 0.9rem;
}
.auth-link a {
    color: var(--c-primary);
    text-decoration: none;
}
.auth-link a:hover {
    text-decoration: underline;
}

.errorlist {
    color: var(--c-danger);
    list-style: none;
    margin-bottom: 1rem;
    padding: 0;
}


/* ============================================
   PAGE: About
   ============================================ */

/* Hero */
.about-hero {
    text-align: center;
    padding: 3.5rem 1.5rem 2rem;
    max-width: 700px;
    margin: 0 auto;
}

.about-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-primary);
    margin-bottom: 0.75rem;
}

.about-headline {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--c-text);
    line-height: 1.15;
    margin-bottom: 1rem;
}

.about-subheadline {
    font-size: 1.1rem;
    color: var(--c-muted);
    line-height: 1.65;
    max-width: 560px;
    margin: 0 auto;
}

/* Section */
.about-section {
    max-width: 900px;
    margin: 2.5rem auto 0;
    padding: 0 1.25rem;
}

.about-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--c-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.about-section-desc {
    color: var(--c-muted);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

/* Card Grid */
.about-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.about-card {
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
}

.about-card-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.about-card-icon--danger  { background: var(--c-danger-bg); color: var(--c-danger); }
.about-card-icon--warning { background: var(--c-warning-bg); color: var(--c-warning); }
.about-card-icon--success { background: var(--c-success-bg); color: var(--c-success); }

.about-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 0.5rem;
}

.about-card p {
    font-size: 0.88rem;
    color: var(--c-muted);
    line-height: 1.55;
}

/* Steps */
.about-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.about-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 1.15rem 1.25rem;
}

.about-step-num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(78, 161, 255, 0.12);
    color: var(--c-primary);
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: var(--r-sm);
}

.about-step-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 0.3rem;
}

.about-step-content p {
    font-size: 0.88rem;
    color: var(--c-muted);
    line-height: 1.5;
}

.about-step-content strong {
    color: var(--c-text);
}

/* Actions */
.about-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.about-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    gap: 0.5rem;
}

.about-action-label {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.about-action-desc {
    font-size: 0.82rem;
    color: var(--c-muted);
    line-height: 1.45;
}

.about-action--long  { border-top: 2px solid var(--c-success); }
.about-action--short { border-top: 2px solid var(--c-danger); }
.about-action--exit  { border-top: 2px solid var(--c-primary); }

.about-action--long  .about-action-label { color: var(--c-success); }
.about-action--short .about-action-label { color: var(--c-danger); }
.about-action--exit  .about-action-label { color: var(--c-primary); }

/* CTA */
.about-cta {
    text-align: center;
    padding: 3rem 1.5rem 4rem;
}

/* Responsive */
@media (max-width: 900px) {
    .about-hero { padding: 2.5rem 1.25rem 1.5rem; }
    .about-headline { font-size: 2rem; }

    .about-card-grid {
        grid-template-columns: 1fr;
    }

    .about-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .about-headline { font-size: 1.75rem; }
    .about-subheadline { font-size: 1rem; }
}


/* ============================================
   PAGE: Leaderboard
   ============================================ */

.leaderboard-header {
    margin-bottom: 1.5rem;
}

.leaderboard-header h1 {
    margin-bottom: 0.5rem;
}

.leaderboard-header p {
    color: var(--c-muted);
    font-size: 0.95rem;
}

.leaderboard-rank-col { width: 3.5rem; text-align: center; }
.leaderboard-pts-col  { width: 5rem; text-align: right; }

.leaderboard-rank {
    text-align: center;
    font-weight: 600;
    color: var(--c-muted);
}

.leaderboard-medal {
    font-size: 1.2rem;
    line-height: 1;
}

.leaderboard-name {
    font-weight: 500;
    color: var(--c-text);
}

.leaderboard-name a {
    color: var(--c-text);
    text-decoration: none;
}

.leaderboard-name a:hover {
    color: var(--c-primary);
}

.leaderboard-pts {
    text-align: right;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--c-primary);
}

/* Highlight current user */
.leaderboard-row--me {
    background: var(--bg-active);
}

.leaderboard-row--me .leaderboard-name {
    color: var(--c-primary);
}

/* Top-3 rank styling */
.leaderboard-row--top .leaderboard-rank {
    color: var(--c-text);
}

/* Round breakdown grid */
.leaderboard-section-title {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--c-primary);
    font-size: 1.25rem;
}

.leaderboard-rounds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.leaderboard-round-card {
    padding: 1.25rem;
}

.leaderboard-round-title {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 0.75rem;
}

.leaderboard-round-title a {
    color: var(--c-text);
    text-decoration: none;
}

.leaderboard-round-title a:hover {
    color: var(--c-primary);
}

.leaderboard-round-date {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--c-muted);
}

/* Breakdown table inside round cards */
.leaderboard-breakdown-table {
    width: 100%;
    font-size: 0.88rem;
}

.leaderboard-breakdown-table a {
    color: var(--c-text);
    text-decoration: none;
}

.leaderboard-breakdown-table a:hover {
    color: var(--c-primary);
}

.leaderboard-breakdown-table th,
.leaderboard-breakdown-table td {
    padding: 0.4rem 0.5rem;
}

.leaderboard-breakdown-table th:first-child,
.leaderboard-breakdown-table td:first-child {
    width: 2rem;
    text-align: center;
}

.leaderboard-breakdown-table th:last-child,
.leaderboard-breakdown-table td:last-child {
    text-align: right;
}

.leaderboard-breakdown-table th:nth-child(3),
.leaderboard-breakdown-table td:nth-child(3) {
    text-align: right;
}

/* Empty state */
.leaderboard-empty {
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 900px) {
    .leaderboard-rounds-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   PAGE: Partners
   ============================================ */

/* Hero */
.partners-hero {
    text-align: center;
    padding: 3.5rem 1.5rem 2rem;
    max-width: 700px;
    margin: 0 auto;
}

.partners-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-primary);
    margin-bottom: 0.75rem;
}

.partners-headline {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--c-text);
    line-height: 1.15;
    margin-bottom: 1rem;
}

.partners-subheadline {
    font-size: 1.05rem;
    color: var(--c-muted);
    line-height: 1.65;
    max-width: 560px;
    margin: 0 auto;
}

/* Section */
.partners-section {
    max-width: 900px;
    margin: 2.5rem auto 0;
    padding: 0 1.25rem;
}

.partners-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--c-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.partners-section-desc {
    color: var(--c-muted);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

/* Card Grid */
.partners-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.partners-card {
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
}

.partners-card-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.partners-card-icon--primary { background: rgba(78, 161, 255, 0.12); }
.partners-card-icon--info    { background: rgba(123, 184, 255, 0.12); }
.partners-card-icon--success { background: var(--c-success-bg); }
.partners-card-icon--warning { background: var(--c-warning-bg); }

.partners-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 0.5rem;
}

.partners-card p {
    font-size: 0.88rem;
    color: var(--c-muted);
    line-height: 1.55;
}

.partners-card a {
    color: var(--c-primary);
    text-decoration: none;
}

.partners-card a:hover {
    text-decoration: underline;
}

/* Steps */
.partners-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.partners-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 1.15rem 1.25rem;
}

.partners-step-num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(78, 161, 255, 0.12);
    color: var(--c-primary);
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: var(--r-sm);
}

.partners-step-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 0.3rem;
}

.partners-step-content p {
    font-size: 0.88rem;
    color: var(--c-muted);
    line-height: 1.5;
}

/* Costs */
.partners-costs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.partners-cost-item {
    background: var(--bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
}

.partners-cost-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-muted);
    margin-bottom: 0.35rem;
}

.partners-cost-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 0.75rem;
}

.partners-cost-desc {
    font-size: 0.88rem;
    color: var(--c-muted);
    line-height: 1.55;
}

.partners-cost-desc strong {
    color: var(--c-text);
}

/* CTA */
.partners-cta {
    text-align: center;
    padding: 3rem 1.5rem 4rem;
}

.partners-cta-text {
    font-size: 1.1rem;
    color: var(--c-muted);
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
    .partners-hero { padding: 2.5rem 1.25rem 1.5rem; }
    .partners-headline { font-size: 1.9rem; }

    .partners-card-grid {
        grid-template-columns: 1fr;
    }

    .partners-costs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .partners-headline { font-size: 1.6rem; }
    .partners-subheadline { font-size: 0.95rem; }
}
