/* Dark theme crypto dashboard */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --green: #3fb950;
    --green-bg: rgba(63, 185, 80, 0.12);
    --red: #f85149;
    --red-bg: rgba(248, 81, 73, 0.12);
    --blue: #58a6ff;
    --yellow: #d29922;
    --purple: #bc8cff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header h1 span { color: var(--blue); }

.header-logo {
    height: 28px;
    width: auto;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Settings gear button */
.settings-gear {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s;
}
.settings-gear:hover { opacity: 1; color: var(--text-primary); }

.tz-badge {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Settings modal */
.settings-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.settings-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}
.settings-panel {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 340px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.settings-header h3 {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
}
.settings-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}
.settings-close:hover { color: var(--text-primary); }
.settings-body {
    padding: 20px;
}
.settings-group {
    margin-bottom: 20px;
}
.settings-group:last-child { margin-bottom: 0; }
.settings-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.settings-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}
#tz-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}
#tz-select:focus {
    outline: none;
    border-color: var(--blue);
}
#settings-sound-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 6px 16px;
    transition: all 0.2s;
}
#settings-sound-btn.active {
    color: var(--green);
    border-color: var(--green);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}
.status-dot.live { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.stale { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* Tabs */
.tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 49px;
    z-index: 99;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--blue);
}
.tab.tab-bitcoin { color: #f0a500; }
.tab.tab-bitcoin:hover { color: #ffbf00; }
.tab.tab-bitcoin.active { color: #ffbf00; border-bottom-color: #f0a500; }

/* Stats bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-primary);
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
}

.stat-card .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-card .value {
    font-size: 22px;
    font-weight: 600;
}

.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }

.stats-bar-bottom {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.stat-card-sm {
    padding: 10px 12px;
}

.stat-card-sm .value {
    font-size: 16px;
}

/* Scan progress bar */
.scan-progress {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.scan-bar {
    display: block;  /* ← AJOUTE */
    width: 300px;
    height: 10px;
    background: var(--bg-tertiary);
    border: 1px solid grey;
    border-radius: 3px;
    overflow: hidden;
}
.scan-bar-fill {
    display: block;  /* ← AJOUTE */
    height: 100%;
    background: var(--blue);
    border-radius: 0;  /* ← CORRIGE (enlève le "3px" orphelin) */
    transition: width 0.5s ease;
}


/* Expandable chart row */
.chart-expand-row td {
    padding: 0 !important;
    border-bottom: 1px solid var(--border);
}
.chart-expand-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 10%;
    background: var(--bg-primary);
    flex-wrap: wrap;
}
.chart-expand-content img, .chart-images img {
    max-width: 64%;
    min-width: 300px;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.chart-expand-content .no-chart {
    color: var(--text-muted);
    font-size: 12px;
    padding: 20px;
}
tr.expandable { cursor: pointer; }
tr.expandable:hover { background: rgba(88, 166, 255, 0.05) !important; }

/* PNG collapsible inside expanded row */
.png-collapsible {
    width: 100%;
    margin-top: 6px;
}
.png-collapsible summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 0;
    user-select: none;
}
.png-collapsible summary:hover {
    color: var(--text-primary);
}

/* SmartPosition expand details */
.smart-expand-info {
    width: 100%;
    margin-bottom: 8px;
}
.smart-expand-header {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    padding: 4px 0;
    line-height: 1.6;
}
.smart-badge-lg {
    background: #d29922;
    color: #000;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 6px;
}
.smart-badge-lg.smart-cut {
    background: #f85149;
    color: #fff;
}
.smart-badge-lg.smart-trail {
    background: #3fb950;
    color: #fff;
}
.smart-history-table {
    width: auto;
    min-width: 500px;
    margin: 0 auto 8px auto;
    border-collapse: collapse;
    font-size: 12px;
}
.smart-history-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 5px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.smart-history-table td {
    padding: 4px 12px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    color: var(--text-primary);
}
.smart-no-ops {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    padding: 4px 0;
}
/* Strategy #12 Scanner */
.dict12-header:hover { color: var(--text-primary); }

.chart-images {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.pos-lw-chart-wrap {
    width: 100%;
    min-height: 550px;
}
.pos-chart-fs-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: rgba(33, 38, 45, 0.85);
    color: #e6edf3;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pos-chart-fs-btn:hover {
    background: var(--bg-tertiary);
}
.pos-chart-ob-label {
    font-size: 12px;
    padding: 4px 8px;
    color: var(--text-secondary);
}

/* Content area */
.content {
    padding: 16px 24px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }
#betas-section-btclsr { flex-direction: column; }

/* Auth lock overlay (protected tabs) */
.auth-lock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--text-secondary);
}
.auth-lock-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.auth-lock-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.auth-lock-sub { font-size: 14px; margin-bottom: 24px; }
.auth-lock-btn {
    display: inline-block;
    padding: 10px 28px;
    background: var(--blue);
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.auth-lock-btn:hover { opacity: 0.9; }

/* Section headers */
.section-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 20px 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.section-header:first-child { margin-top: 0; }

/* Tables */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
}

thead th[data-sort-key] {
    cursor: pointer;
    user-select: none;
}
thead th[data-sort-key]:hover {
    color: var(--text-primary);
}
thead th.sort-active {
    color: var(--accent);
}

tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-tertiary); }

/* Direction badges */
.badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge.long {
    background: var(--green-bg);
    color: var(--green);
}

.badge.short {
    background: var(--red-bg);
    color: var(--red);
}

/* PnL coloring */
.pnl-positive { color: var(--green); font-weight: 600; }
.pnl-negative { color: var(--red); font-weight: 600; }

/* PnL justified layout — $ right-aligned | / centered | % left-aligned */
.pnl-justified {
    display: inline-flex;
    width: 100%;
    align-items: center;
}
.pnl-usd {
    flex: 1;
    text-align: right;
}
.pnl-sep {
    flex: 0 0 auto;
    margin: 0 5px;
    opacity: 0.5;
}
.pnl-pct {
    flex: 1;
    text-align: left;
}

/* Result badges */
.result-win {
    color: var(--green);
    font-weight: 600;
}
.result-loss {
    color: var(--red);
    font-weight: 600;
}

/* Simulated indicator */
.sim-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(188, 140, 255, 0.15);
    color: var(--purple);
    margin-left: 4px;
}

/* Closing badge — position closed on exchange, CORE hasn't caught up */
.closing-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(210, 153, 34, 0.2);
    color: var(--yellow);
    margin-left: 4px;
    animation: closingPulse 1.5s ease-in-out infinite;
}
@keyframes closingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.closing-badge.smart-cut-closing {
    background: rgba(248, 81, 73, 0.25);
    color: #f85149;
    animation: smartCutFlash 0.8s ease-in-out infinite;
}
@keyframes smartCutFlash {
    0%, 100% { opacity: 1; background: rgba(248, 81, 73, 0.3); }
    50% { opacity: 0.5; background: rgba(248, 81, 73, 0.08); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Auto-refresh indicator */
.refresh-indicator {
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px 0;
    text-align: right;
}

/* SmartPosition badge */
.smart-badge {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    background: rgba(210, 153, 34, 0.15);
    color: var(--yellow);
    margin-left: 4px;
    border: 1px solid rgba(210, 153, 34, 0.25);
    letter-spacing: 0.3px;
}
.smart-badge.smart-pending {
    background: rgba(139, 148, 158, 0.15);
    color: #8b949e;
    border-color: rgba(139, 148, 158, 0.25);
}
.smart-badge.smart-cut {
    background: rgba(248, 81, 73, 0.2);
    color: #f85149;
    border-color: rgba(248, 81, 73, 0.35);
}
.smart-badge.smart-trail {
    background: rgba(63, 185, 80, 0.2);
    color: #3fb950;
    border-color: rgba(63, 185, 80, 0.35);
}
.smart-badge .resize-count {
    font-size: 8px;
    opacity: 0.7;
    margin-left: 1px;
}

.auto-pct {
    font-size: 9px;
    opacity: 0.45;
    margin-left: 3px;
}

.smart-row { background: rgba(210, 153, 34, 0.04); }
.smart-row:hover { background: rgba(210, 153, 34, 0.08) !important; }

/* Live price dot */
.live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    margin-right: 5px;
    vertical-align: middle;
    animation: pulse 2s ease-in-out infinite;
}
.live-dot-spacer {
    display: inline-block;
    width: 6px;
    margin-right: 5px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.tab.beta-glow {
    background: linear-gradient(90deg, #8b6baf, #e0c0ff, #8b6baf);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: beta-neon 3s ease-in-out infinite, beta-shimmer 2.5s linear infinite;
}
.tab.beta-glow:hover {
    filter: drop-shadow(0 0 8px rgba(210, 168, 255, 0.7));
}
.tab.beta-glow.active {
    background: linear-gradient(90deg, #c9a0ff, #fff, #c9a0ff);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 6px rgba(210, 168, 255, 0.5));
}
@keyframes beta-neon {
    0%, 100% { filter: drop-shadow(0 0 0px transparent); }
    50% { filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.6)) drop-shadow(0 0 30px rgba(139, 92, 246, 0.3)); }
}
@keyframes beta-shimmer {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

/* Dimmed text (for Smart TP/SL) */
.dimmed {
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
}

/* Bitcoin chart containers */
.chart-section {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.chart-section-header {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

/* About page */
.about-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0;
}

.about-hero {
    text-align: center;
    margin-bottom: 32px;
}

.about-logo {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.3);
}

.about-hero h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.about-hero h2 span { color: var(--blue); }

.about-tagline {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
}

.about-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
}
.about-card-full {
    width: 100%;
}

.about-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--blue);
    margin-bottom: 10px;
}

.about-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.6;
}

.about-card ul {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.about-card ul li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0 4px 16px;
    position: relative;
    line-height: 1.5;
}

.about-card ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--blue);
}

.about-card strong {
    color: var(--text-primary);
}

.highlight-card {
    border-color: rgba(88, 166, 255, 0.3);
    background: rgba(88, 166, 255, 0.05);
}

.about-subtle {
    font-size: 12px !important;
    color: var(--text-muted) !important;
    font-style: italic;
}

.about-cta {
    color: var(--yellow) !important;
    font-weight: 500;
}

.about-footer {
    text-align: center;
    margin-top: 32px;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* Strategy sub-tabs */
.strategy-sub-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    width: fit-content;
}

.strategy-tab {
    padding: 10px 24px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    border-right: 1px solid var(--border);
}

.strategy-tab:last-child { border-right: none; }
.strategy-tab:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.strategy-tab.active {
    color: var(--text-primary);
    background: var(--blue);
    color: #fff;
}
.strategy-tab.live { border-bottom: 2px solid #3fb950; color: #3fb950; }
.strategy-tab.live:hover { background: rgba(63, 185, 80, 0.1); }
.strategy-tab.live.active { background: #238636; color: #fff; border-bottom: none; }

.strategy-tab.core-view { background: rgba(88, 56, 163, 0.15); color: #8b7ec8; border-bottom: 2px solid #6e57a8; }
.strategy-tab.core-view:hover { background: rgba(88, 56, 163, 0.25); color: #a78bfa; }
.strategy-tab.core-view.active { background: #5b3e9e; color: #fff; border-bottom: none; }

.strategy-tab.dev { background: rgba(200, 50, 50, 0.12); color: #8b6565; border-bottom: 2px solid #6e3a3a; }
.strategy-tab.dev:hover { background: rgba(200, 50, 50, 0.22); color: #d48080; }
.strategy-tab.dev.active { background: #7a2e2e; color: #fff; border-bottom: none; }

.strategy-tab.maestro {
    color: #f0e130;
    font-size: 15px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 2px solid #f0e130;
    background: linear-gradient(180deg, rgba(240, 225, 48, 0.08) 0%, transparent 100%);
    text-shadow: 0 0 8px rgba(240, 225, 48, 0.3);
}
.strategy-tab.maestro:hover {
    background: linear-gradient(180deg, rgba(240, 225, 48, 0.18) 0%, rgba(240, 225, 48, 0.05) 100%);
    text-shadow: 0 0 12px rgba(240, 225, 48, 0.5);
    color: #fff;
}
.strategy-tab.maestro.active {
    background: linear-gradient(135deg, #f0e130 0%, #d4a017 100%);
    color: #000;
    font-weight: 800;
    text-shadow: none;
    border-bottom: none;
    box-shadow: 0 0 16px rgba(240, 225, 48, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.strategy-stats-bar {
    display: grid;
}

/* Strategy Overview badges */
.strat-badge { display:inline-block; padding:2px 8px; border-radius:4px; font-size:11px; font-weight:700; letter-spacing:0.3px; }
.strat-live { background:rgba(63,185,80,0.15); color:#3fb950; border:1px solid rgba(63,185,80,0.3); }
.strat-sim { background:rgba(240,225,48,0.12); color:#f0e130; border:1px solid rgba(240,225,48,0.25); }
.strat-disabled { background:rgba(248,81,73,0.12); color:#f85149; border:1px solid rgba(248,81,73,0.25); }
.strat-dead { background:rgba(110,118,129,0.12); color:#6e7681; border:1px solid rgba(110,118,129,0.25); }
.strat-bench { background:rgba(88,166,255,0.12); color:#58a6ff; border:1px solid rgba(88,166,255,0.25); }
tr.strat-row-dead td { opacity:0.45; }
tr.strat-row-disabled td { opacity:0.6; }
tr.strat-row-live td:first-child { border-left:3px solid #3fb950; }

/* Benchmarking */
.bench-select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
}

#bench-chart-wrap.bench-fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: var(--bg-primary);
    margin: 0 !important;
    padding: 0;
}
#bench-chart-wrap.bench-fullscreen #bench-chart {
    height: 100vh !important;
    border: none;
    border-radius: 0;
}
#bench-chart-wrap.bench-fullscreen #bench-fullscreen-btn {
    top: 12px; right: 16px;
    font-size: 18px;
    padding: 6px 10px;
}

/* Debug Beta fullscreen */
#betas-section-btclsr:fullscreen { background: #000; overflow-y: auto; }
#betas-section-btclsr:fullscreen #debug-beta-chart { min-height: 0; height: calc(50vh - 30px) !important; }
#betas-section-btclsr:fullscreen #debug-beta-chart-5m { min-height: 0; height: calc(50vh - 30px) !important; }
#betas-section-btclsr:fullscreen .btc-indicators { padding: 4px 12px; }
#dbg-section-1h:fullscreen, #dbg-section-5m:fullscreen { background: #000; }
#dbg-section-1h:fullscreen #debug-beta-chart,
#dbg-section-5m:fullscreen #debug-beta-chart-5m { min-height: 0; height: calc(100vh - 40px) !important; }
#dbg-section-1h:fullscreen .btc-indicators,
#dbg-section-5m:fullscreen .btc-indicators { padding: 4px 12px; }

/* Bitcoin info box */
.btc-info-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.btc-info-box strong {
    color: #f0e130;
}

/* Site footer / disclaimer */
.site-footer {
    padding: 4px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
    position: sticky;
    bottom: 0;
    z-index: 100;
    text-align: center;
}

.footer-disclaimer {
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1.3;
}

.footer-disclaimer strong {
    color: var(--text-secondary);
}

/* Bitcoin indicators bar */
.btc-indicators {
    display: flex;
    gap: 12px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.btc-ind {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.btc-ind-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.btc-ind-dot.on { background: var(--green); box-shadow: 0 0 4px var(--green); }
.btc-ind-dot.off { background: var(--red); box-shadow: 0 0 4px var(--red); }
.btc-ind-dot.warn { background: var(--yellow); box-shadow: 0 0 4px var(--yellow); }
.btc-ind-dot.sleep { background: var(--blue); box-shadow: 0 0 4px var(--blue); }

/* OHLC label above toolbar */
.btc-ohlc-label {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 13px;
    font-family: monospace;
    color: #c9d1d9;
    line-height: 1.2;
    white-space: nowrap;
}
.btc-ohlc-label .ohlc-row b {
    color: #8b949e;
    margin-right: 1px;
}

/* Bitcoin timeframe selector */
.btc-tf-selector {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2px;
}

.btc-tf-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: rgba(22, 27, 34, 0.85);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btc-tf-btn:last-child { border-bottom: none; }
.btc-tf-fs { font-size: 13px; padding: 3px 6px; border-left: 1px solid var(--border); }
.btc-tf-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.btc-tf-btn.active { background: var(--blue); color: #fff; }

/* Bitcoin chart toolbar — overlay on chart */
.btc-toolbar {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btc-tool-toggle {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(22, 27, 34, 0.85);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.btc-tool-toggle:hover {
    background: var(--border);
    color: var(--text-primary);
}

.btc-tool-dropdown {
    display: none;
    flex-direction: column;
    gap: 3px;
}
.btc-tool-dropdown.open {
    display: flex;
}

.btc-tool-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(22, 27, 34, 0.85);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btc-tool-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.btc-tool-btn.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.btc-tool-hint {
    position: absolute;
    left: 36px;
    top: 0;
    font-size: 11px;
    color: var(--yellow);
    font-style: italic;
    white-space: nowrap;
    line-height: 28px;
}

/* Measure overlay */
#btc-chart-container {
    position: relative;
}

.measure-overlay {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10;
    text-align: center;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.measure-positive {
    background: rgba(63, 185, 80, 0.2);
    border: 1px solid var(--green);
    color: var(--green);
}

.measure-negative {
    background: rgba(248, 81, 73, 0.2);
    border: 1px solid var(--red);
    color: var(--red);
}

.measure-pct {
    font-size: 16px;
    font-weight: 700;
}

.measure-dollar {
    font-size: 11px;
    opacity: 0.85;
}

.measure-prices {
    font-size: 10px;
    opacity: 0.7;
    font-weight: 400;
}

.measure-line {
    position: absolute;
    height: 2px;
    transform-origin: 0 50%;
    pointer-events: none;
    z-index: 9;
    background: repeating-linear-gradient(
        90deg,
        var(--text-secondary) 0px,
        var(--text-secondary) 6px,
        transparent 6px,
        transparent 10px
    );
}

/* Mobile/PC toggle helpers */
.show-mobile { display: none; }

/* Responsive — mobile */
@media (max-width: 768px) {
    .show-mobile { display: inline; }
    .hide-mobile { display: none; }
    /* Header compact */
    .header {
        padding: 4px 8px;
    }
    .header h1 {
        font-size: 14px;
        white-space: nowrap;
    }
    .header-logo {
        height: 18px;
        margin-right: 3px;
    }
    .header-right {
        font-size: 10px;
        gap: 3px;
        text-align: right;
    }
    .settings-gear {
        font-size: 14px;
        padding: 1px 4px;
    }
    .tz-badge { font-size: 9px; }
    .settings-panel { width: 90vw; }
    .status-dot {
        width: 7px;
        height: 7px;
        margin-right: 1px;
    }
    .scan-progress {
        font-size: 10px;
        margin-right: 1px;
    }
    .scan-bar {
        width: 50px;
        height: 4px;
    }

    /* Tabs compact */
    .tabs {
        padding: 0 6px;
        top: 35px;
    }
    .tab {
        padding: 7px 8px;
        font-size: 11px;
    }

    /* Content */
    .content {
        padding: 6px 8px;
        overflow-x: hidden;
    }

    /* Stats bar — single row strip on mobile */
    .stats-bar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0;
        padding: 0;
        border-bottom: 1px solid var(--border);
    }
    .stats-bar[style*="display: none"] {
        display: none !important;
    }
    .stat-card {
        padding: 6px 10px;
        border: none;
        border-radius: 0;
        border-right: 1px solid var(--border);
        flex-shrink: 0;
        text-align: center;
        background: var(--bg-secondary);
    }
    .stat-card:last-child { border-right: none; }
    .stat-card .label {
        font-size: 8px;
        margin-bottom: 1px;
    }
    .stat-card .value {
        font-size: 13px;
    }

    /* Section headers */
    .section-header {
        font-size: 10px;
        margin: 8px 0 4px;
        padding-bottom: 4px;
    }

    /* Tables — smaller text + hide non-essential columns */
    table { font-size: 11px; }
    thead th {
        padding: 5px 6px;
        font-size: 9px;
    }
    tbody td {
        padding: 5px 6px;
    }

    /* Open Positions: 1=EntryTime 2=Strategy 3=Symbol 4=Size 5=Entry 6=Current 7=PnL 8=TP/SL 9=Duration 10=Updated */
    /* Mobile show: Strategy(2), Symbol(3), Size(4), PnL(7), Duration(9) — hide rest */
    /* IMPORTANT: use "> table >" to avoid hiding LightweightCharts internal <td> elements */
    #open-positions > table > thead > tr > th:nth-child(1),
    #open-positions > table > tbody > tr:not(.chart-expand-row) > td:nth-child(1),
    #open-positions > table > thead > tr > th:nth-child(5),
    #open-positions > table > tbody > tr:not(.chart-expand-row) > td:nth-child(5),
    #open-positions > table > thead > tr > th:nth-child(6),
    #open-positions > table > tbody > tr:not(.chart-expand-row) > td:nth-child(6),
    #open-positions > table > thead > tr > th:nth-child(8),
    #open-positions > table > tbody > tr:not(.chart-expand-row) > td:nth-child(8),
    #open-positions > table > thead > tr > th:nth-child(10),
    #open-positions > table > tbody > tr:not(.chart-expand-row) > td:nth-child(10) {
        display: none;
    }

    /* Results Trades: show Symbol(4), PnL(7), Result(8), Strategy(9) — hide rest */
    /* IMPORTANT: use "> table >" to avoid hiding LightweightCharts internal <td> elements */
    #results-trades > table > thead > tr > th:nth-child(1),
    #results-trades > table > tbody > tr:not(.chart-expand-row) > td:nth-child(1),
    #results-trades > table > thead > tr > th:nth-child(2),
    #results-trades > table > tbody > tr:not(.chart-expand-row) > td:nth-child(2),
    #results-trades > table > thead > tr > th:nth-child(3),
    #results-trades > table > tbody > tr:not(.chart-expand-row) > td:nth-child(3),
    #results-trades > table > thead > tr > th:nth-child(5),
    #results-trades > table > tbody > tr:not(.chart-expand-row) > td:nth-child(5),
    #results-trades > table > thead > tr > th:nth-child(6),
    #results-trades > table > tbody > tr:not(.chart-expand-row) > td:nth-child(6) {
        display: none;
    }

    /* Badges on second line under symbol name on mobile */
    .badges-wrap { display: block; margin-top: 2px; }

    /* PnL stacked: $ on top, % below, hide separator */
    .pnl-justified { flex-direction: column; align-items: center; }
    .pnl-sep { display: none; }
    .pnl-usd, .pnl-pct { text-align: center; flex: none; }

    /* Tags — 25% smaller on mobile */
    .badge, .sim-badge, .smart-badge, .closing-badge {
        font-size: 7px;
        padding: 1px 4px;
        letter-spacing: 0.2px;
    }
    .smart-badge .resize-count {
        font-size: 6px;
    }
    .auto-pct {
        font-size: 7px;
    }

    /* SmartPosition expand — compact on mobile */
    .smart-expand-header {
        font-size: 9px;
        line-height: 1.4;
        margin-bottom: 4px;
        padding: 2px 0;
    }
    .smart-badge-lg {
        font-size: 8px;
        padding: 1px 4px;
        margin-right: 3px;
    }
    .smart-history-table {
        font-size: 9px;
    }

    /* Position Lightweight Chart — fit table width on mobile */
    .chart-expand-content {
        padding: 2px 0 0 0;
        gap: 2px;
        max-width: 100vw;
        overflow: hidden;
    }
    .chart-expand-content .smart-expand-info {
        margin-bottom: 0;
    }
    .pos-lw-chart-wrap {
        min-height: 160px;
        max-width: 100vw;
        overflow: hidden;
    }
    .pos-lw-chart-wrap .btc-tf-selector {
        top: 0px !important;
        left: 0px !important;
    }

    /* BTC toolbar — vertical on mobile too */
    .btc-toolbar {
        top: 4px;
        left: 4px;
        gap: 3px;
    }
    .btc-ohlc-label {
        font-size: 8px;
        gap: 4px;
    }
    .btc-toolbar .btc-tool-toggle,
    .btc-toolbar .btc-tool-dropdown,
    .btc-toolbar .btc-tool-hint {
        display: none;
    }
    .btc-toolbar .btc-fullscreen-btn {
        display: flex;
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    .btc-tf-btn {
        width: 24px;
        height: 24px;
        padding: 0;
        font-size: 9px;
        border-bottom: 1px solid var(--border);
        border-right: none;
    }
    .btc-tf-btn:last-child { border-bottom: none; }

    /* BTC indicators — compact on mobile, hide PC-only */
    .btc-ind-pc-only {
        display: none;
    }
    .btc-indicators {
        gap: 4px;
        padding: 2px 4px;
    }
    .btc-ind {
        font-size: 8px;
        padding: 1px 4px;
        gap: 3px;
    }
    .btc-ind-dot {
        width: 5px;
        height: 5px;
    }

    /* BTC info box */
    .btc-info-box {
        padding: 8px 10px;
        font-size: 10px;
        margin-top: 8px;
    }

    /* Strategy sub-tabs */
    .strategy-sub-tabs {
        margin-bottom: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        width: auto;
        border-radius: 6px;
    }
    .strategy-tab {
        padding: 5px 8px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* About page — single column on mobile */
    .about-page {
        padding: 10px 0;
    }
    .about-hero {
        margin-bottom: 16px;
    }
    .about-logo {
        width: 50px;
        height: 50px;
    }
    .about-hero h2 {
        font-size: 20px;
    }
    .about-tagline {
        font-size: 11px;
    }
    .about-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .about-card {
        padding: 12px 14px;
    }
    .about-card h3 {
        font-size: 13px;
        margin-bottom: 6px;
    }
    .about-card p,
    .about-card ul li {
        font-size: 11px;
        line-height: 1.5;
    }
    .about-footer {
        margin-top: 16px;
        font-size: 10px;
    }

    /* Disclaimer — sticky on mobile too */
    .site-footer {
        padding: 3px 10px;
    }
    .footer-disclaimer {
        font-size: 7px;
        line-height: 1.2;
    }
}
