.table-responsive {
    max-height:300px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay-box {
    min-width: 180px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    padding: 14px 16px;
    color: #e2e8f0;
    text-align: center;
}

.loading-overlay-text {
    margin-top: 10px;
    font-size: 0.9rem;
}

.chart-shell {
    position: relative;
    border-radius: 12px;
    border: 1px solid #1e293b;
    background: #161a25;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
    overflow: hidden;
}

#chartbtc {
    height: 28rem;
    width: 100%;
    background: transparent;
    overflow: hidden;
}

.subcharts-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}



/* Compact OHLC legend in the top-left corner, like trading platforms */
/* Chart type switcher above the price chart */
.chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 38px;
    padding: 0 10px;
    border-bottom: 1px solid #1e293b;
    overflow-x: auto;
    scrollbar-width: none;
}

.chart-type-group {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    border-radius: 7px;
    background: #111a2e;
    flex-shrink: 0;
}

.chart-type-btn {
    border: 0;
    padding: 3px 10px;
    border-radius: 5px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.chart-type-btn:hover {
    color: #e2e8f0;
}

.chart-type-btn.is-active {
    background: #1e293b;
    color: #f8fafc;
}

.chart-zones-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #94a3b8;
    font-size: 0.76rem;
    white-space: nowrap;
    cursor: pointer;
}

.chart-legend {
    position: absolute;
    top: 46px;   /* below the chart toolbar */
    left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    max-width: calc(100% - 100px);
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(11, 18, 32, 0.6);
    color: #e2e8f0;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    z-index: 5;
}

.chart-legend-row {
    display: inline-flex;
    gap: 5px;
    line-height: 1.4;
}

.chart-legend-row span:first-child {
    color: #64748b;
}

#legend_market { font-weight: 600; color: #94a3b8; }
#legend_market[data-tone="up"] { color: #0ecb81; }
#legend_market[data-tone="down"] { color: #f6465d; }
#legend_market[data-tone="trap"] { color: #facc15; }

#legend_feed {
    color: #94a3b8;
    font-weight: 600;
}

#legend_feed.legend-feed--live {
    color: #26a69a;
}

#legend_feed.legend-feed--live::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 4px;
    border-radius: 50%;
    background: #26a69a;
    vertical-align: middle;
    animation: feed-pulse 1.6s ease-in-out infinite;
}

@keyframes feed-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.legend-signal {
    font-weight: 600;
    text-transform: uppercase;
}

.legend-signal--buy {
    color: #22c55e;
}

.legend-signal--sell {
    color: #ef4444;
}

.legend-signal--neutral {
    color: #fbbf24;
}

.condition-panel {
    background: #ffffff;
    border-color: #dbe3ef !important;
}

.condition-checklist {
    list-style: none;
    padding-left: 0;
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
}

.condition-item > div {
    flex: 1;
    min-width: 0;
}

.condition-item:last-child {
    margin-bottom: 0;
}

.condition-heading {
    margin: 10px 0 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.condition-heading:first-child {
    margin-top: 0;
}

.condition-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #475569;
}

.condition-detail {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 1px;
}

.condition-item--yes, .condition-item--done {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.35);
    color: #166534;
}

.condition-item--yes .condition-icon, .condition-item--done .condition-icon {
    background: #16a34a;
    color: #ffffff;
}

.condition-item--not_yet .condition-icon, .condition-item--waiting .condition-icon {
    background: #fef3c7;
    color: #92400e;
}

.condition-item--exit {
    background: rgba(59, 130, 246, 0.07);
    border-color: rgba(59, 130, 246, 0.3);
}

.condition-item--exit .condition-icon {
    background: #3b82f6;
    color: #ffffff;
}

.condition-item--info {
    background: transparent;
    border-style: dashed;
    color: #475569;
}

.condition-item--info .condition-icon {
    font-style: italic;
    font-family: Georgia, serif;
}

.condition-item--na {
    background: #f1f5f9;
    color: #64748b;
}

.condition-item--na .condition-icon {
    background: #cbd5e1;
    color: #475569;
}

.condition-message {
    margin: 4px 0 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    background: #eef2ff;
    color: #3730a3;
}

.condition-message--conflict {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.condition-message--buy {
    background: rgba(14, 203, 129, 0.12);
    color: #047857;
}

.condition-message--sell {
    background: rgba(246, 70, 93, 0.12);
    color: #b91c1c;
}

.condition-state {
    flex-shrink: 0;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    font-weight: 700;
    text-transform: uppercase;
}

.condition-item--not_yet .condition-state, .condition-item--waiting .condition-state {
    color: #b45309;
}

.trade-row-new-buy {
    animation: tradeRowFlashBuy 2s ease-out;
}

.trade-row-new-sell {
    animation: tradeRowFlashSell 2s ease-out;
}

@keyframes tradeRowFlashBuy {
    0% {
        background-color: rgba(34, 197, 94, 0.28);
    }
    100% {
        background-color: transparent;
    }
}

.panel-body.table-responsive table {
    min-width: 960px;
}

.trade-history-wrap {
    max-height: 420px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(2, 6, 23, 0.06);
}

.trade-history-table {
    margin-bottom: 0;
    min-width: 1250px;
    font-size: 0.92rem;
}

.trade-history-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #0f172a;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    vertical-align: middle;
}

.trade-history-table tbody tr:nth-child(odd) {
    background: #f8fafc;
}

.trade-history-table tbody td {
    vertical-align: middle;
}

.trade-side-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #f1f5f9;
    color: #334155;
}

.trade-side-badge--buy {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
    border-color: rgba(34, 197, 94, 0.35);
}

.trade-side-badge--sell {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.35);
}

@media (max-width: 992px) {
    #chartbtc {
        height: 22rem;
    }



    .chart-legend {
        font-size: 0.74rem;
    }

    #btc-target .col-sm {
        margin-bottom: 12px;
    }
}

@media (max-width: 768px) {
    #chartbtc {
        height: 17rem;
    }



    .chart-legend {
        max-width: calc(100% - 90px);
        gap: 2px 10px;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .trade-history-wrap {
        max-height: 360px;
    }
}

@keyframes tradeRowFlashSell {
    0% {
        background-color: rgba(239, 68, 68, 0.28);
    }
    100% {
        background-color: transparent;
    }
}




/* ── Consultant sidebar (left): what the bot sees, decides and why ── */
.advisor {
    --advisor-bg: #ffffff;
    --advisor-text: #1f2937;
    --advisor-muted: #6b7280;
    --advisor-border: #e5e7eb;
    --advisor-soft: #f8fafc;
    --advisor-buy: #0ecb81;
    --advisor-buy-text: #047857;
    --advisor-sell: #f6465d;
    --advisor-sell-text: #b91c1c;
    --advisor-warn: #f59e0b;
    --advisor-warn-text: #b45309;
    background: var(--advisor-bg);
    color: var(--advisor-text);
    border: 1px solid var(--advisor-border);
    border-radius: 12px;
    padding: 16px;
    margin: 0 0 16px;
    font-size: 0.88rem;
    line-height: 1.45;
}
.advisor strong { font-weight: 700; color: #111827; }

@media (min-width: 1200px) {
    .advisor {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 340px;
        margin: 0;
        border-radius: 0;
        border-width: 0 1px 0 0;
        overflow-y: auto;
        z-index: 1020;
    }
    body:has(.advisor) {
        padding-left: 356px !important;
    }
}

.advisor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.advisor-avatar {
    width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
    display: grid; place-items: center;
    background: #3730a3; color: #fff; font-weight: 700; font-size: 0.85rem;
}
.advisor-name { font-weight: 700; font-size: 0.95rem; }
.advisor-live { font-size: 0.75rem; color: var(--advisor-muted); display: flex; align-items: center; gap: 6px; }
.advisor-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--advisor-buy); display: inline-block; }

/* Status: badge + progress, then the headline */
.advisor-status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.advisor-badge {
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; padding: 4px 10px; border-radius: 999px;
    background: #e5e7eb; color: #374151;
}
.advisor-badge--buy { background: rgba(14, 203, 129, 0.15); color: var(--advisor-buy-text); }
.advisor-badge--sell { background: rgba(246, 70, 93, 0.15); color: var(--advisor-sell-text); }
.advisor-badge--conflict { background: rgba(245, 158, 11, 0.16); color: var(--advisor-warn-text); }
.advisor-progress { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--advisor-muted); }
.advisor-bars { display: inline-flex; gap: 3px; }
.advisor-bar { width: 14px; height: 6px; border-radius: 3px; background: #e5e7eb; display: inline-block; }
.advisor-bar--yes { background: var(--advisor-buy); }
.advisor-bar--trap { background: var(--advisor-warn); }

.advisor-headline {
    font-size: 0.88rem; font-weight: 600; margin: 0 0 10px; overflow-wrap: anywhere;
    padding: 10px 12px; border-radius: 10px; background: #eef2ff; color: #3730a3;
}
.advisor-headline strong { color: #312e81; }
.advisor-alert {
    font-size: 0.8rem; padding: 6px 10px; border-radius: 8px; margin-bottom: 8px;
    background: rgba(245, 158, 11, 0.12); color: var(--advisor-warn-text);
}

.advisor-section-title {
    margin: 14px 0 6px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--advisor-muted);
}

/* The rules: one compact row per condition */
.advisor-checks { display: flex; flex-direction: column; gap: 4px; }
.advisor-check {
    display: flex; gap: 8px; align-items: flex-start;
    padding: 6px 8px; border-radius: 8px; border: 1px solid var(--advisor-border); background: var(--advisor-soft);
}
.advisor-check-icon {
    width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
    font-size: 0.72rem; font-weight: 700; background: #fee2e2; color: var(--advisor-sell-text); margin-top: 1px;
}
.advisor-check-body { min-width: 0; flex: 1; }
.advisor-check-name { font-weight: 700; font-size: 0.82rem; line-height: 1.3; }
.advisor-check-rule { font-size: 0.7rem; color: var(--advisor-muted); line-height: 1.3; }
.advisor-check-value { font-size: 0.78rem; font-variant-numeric: tabular-nums; line-height: 1.35; margin-top: 2px; overflow-wrap: anywhere; }
.advisor-check--yes { border-color: rgba(14, 203, 129, 0.4); background: rgba(14, 203, 129, 0.06); }
.advisor-check--yes .advisor-check-icon { background: rgba(14, 203, 129, 0.2); color: var(--advisor-buy-text); }
.advisor-check--trap .advisor-check-icon { background: rgba(245, 158, 11, 0.2); color: var(--advisor-warn-text); }

/* Position / next move */
.advisor-card { margin-top: 10px; border-radius: 10px; padding: 2px 12px 10px; background: var(--advisor-soft); border-left: 3px solid #cbd5e1; }
.advisor-card p { margin: 6px 0 0; font-size: 0.76rem; color: var(--advisor-muted); }
.advisor-card--buy { border-left-color: var(--advisor-buy); }
.advisor-card--sell { border-left-color: var(--advisor-sell); }
.advisor-rows { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 0.85rem; }
.advisor-rows dt { font-weight: 400; color: var(--advisor-muted); }
.advisor-rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* Journal */
.advisor-journal { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.advisor-line { font-size: 0.8rem; padding-left: 8px; border-left: 2px solid #cbd5e1; }
.advisor-line span { display: block; font-size: 0.7rem; color: var(--advisor-muted); font-variant-numeric: tabular-nums; }
.advisor-line--buy { border-left-color: var(--advisor-buy); }
.advisor-line--sell { border-left-color: var(--advisor-sell); }
.advisor-line--conflict { border-left-color: var(--advisor-warn); }
.advisor-empty { font-size: 0.8rem; color: var(--advisor-muted); }


/* ── Dashboard (main column) ── */
body:has(.dash) { background: #f1f5f9; }
.dash { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; color: #0f172a; }
.dash-alert { margin: 0; }
.dash-card {
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); min-width: 0;
}
.dash-label { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #64748b; }
.dash-sub { font-size: 0.8rem; color: #64748b; }
.dash-h2 { font-size: 0.95rem; font-weight: 700; margin: 0 0 10px; }

/* Header: title | status | actions */
.dash-head { display: flex; align-items: center; gap: 16px 28px; flex-wrap: wrap; }
.dash-title h1 { font-size: 1.35rem; font-weight: 800; margin: 0; line-height: 1.1; }
.dash-status { display: flex; gap: 12px 28px; flex-wrap: wrap; flex: 1; }
.dash-status-item { display: flex; flex-direction: column; gap: 2px; }
.dash-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-signal { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.02em; padding: 1px 10px; border-radius: 6px; width: fit-content; }
.dash-signal--buy { background: rgba(14, 203, 129, 0.14); color: #047857; }
.dash-signal--sell { background: rgba(246, 70, 93, 0.12); color: #b91c1c; }
.dash-signal--neutral { background: #f1f5f9; color: #475569; }
.dash-pill { font-weight: 700; width: fit-content; }
.dash-pill[data-state="on"] { color: #047857; }
.dash-pill[data-state="on"]::before { content: '● '; }
.dash-pill[data-state="off"] { color: #64748b; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-actions form { margin: 0; }
.dash-actions .btn { min-width: 92px; font-weight: 600; }

/* Money */
.dash-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.dash-kpi { padding: 10px 14px; }
.dash-kpi > div { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }
.dash-kpi small { font-size: 0.72rem; font-weight: 600; color: #94a3b8; }
.dash-pnl[data-tone="up"] { color: #047857; }
.dash-pnl[data-tone="down"] { color: #b91c1c; }

/* Settings, position, balances */
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dash-form-actions .btn { min-width: 110px; }
.dash-rows { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 0.86rem; }
.dash-rows dt { font-weight: 400; color: #64748b; }
.dash-rows dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dash-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.8rem; }
.dash-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* Bot details (collapsed) */
.dash-details { padding: 0; }
.dash-details > summary {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none;
}
.dash-details > summary::-webkit-details-marker { display: none; }
.dash-details > summary::before { content: '▸'; color: #64748b; transition: transform 0.15s; }
.dash-details[open] > summary::before { transform: rotate(90deg); }
.dash-details > summary .dash-h2 { margin: 0; }
.dash-details > :not(summary) { margin-left: 16px; margin-right: 16px; }
.dash-details[open] { padding-bottom: 14px; }
.dash-phase { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-strategy { font-size: 0.8rem; color: #047857; margin: 0 0 6px; }

/* Trade history */
.dash-history { padding: 0; overflow: hidden; }
.dash-history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 16px 8px; }
.dash-history-head .dash-h2 { margin: 0; }
.dash-history .trade-history-wrap { border: 0; border-radius: 0; box-shadow: none; }

.chart-shell { margin: 0; }

@media (max-width: 1100px) {
    .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .dash-kpi > div { font-size: 1.05rem; }
    .dash-grid { grid-template-columns: 1fr; }
    .dash-head { gap: 12px; }
    .dash-actions { width: 100%; }
    .dash-actions form { flex: 1; }
    .dash-actions .btn { width: 100%; min-width: 0; }
    .dash-card { padding: 12px; }
}

/* Phones and tablets: the signal, actions, money and chart first, then the rules, then the rest */
@media (max-width: 1199.98px) {
    .dash-layout { display: flex; flex-direction: column; gap: 12px; }
    .dash-layout > .dash { display: contents; }
    .dash-layout > .dash > * { order: 3; }
    .dash-layout > .dash > .dash-alert, .dash-layout > .dash > .dash-head,
    .dash-layout > .dash > .dash-kpis, .dash-layout > .dash > .chart-shell { order: 1; }
    .dash-layout > .advisor { order: 2; margin: 0; }
}
@media (max-width: 640px) {
    .dash-title { width: 100%; }
    .dash-status { gap: 10px 22px; }
    .dash-kpi:last-child { grid-column: span 2; }
    #chartbtc { height: 26rem; }
    /* legend: only close, signal, countdown and feed on a phone */
    .legend-ohlc:not(:first-child) { display: none; }
    .chart-legend { font-size: 0.72rem; padding: 2px 6px; }
}
.trade-history-table { min-width: 1050px; }
.trade-history-table thead th { white-space: nowrap; }


/* ════════════════════════════════════════════════════════════════════
   Professional dark theme (trading terminal), matches the chart colors
   ════════════════════════════════════════════════════════════════════ */
:root {
    --t-bg: #0e1118;
    --t-panel: #161a25;
    --t-panel-2: #1c2130;
    --t-border: #262c3b;
    --t-border-soft: #1f2433;
    --t-text: #e6e9ef;
    --t-muted: #8a93a6;
    --t-faint: #5c6578;
    --t-up: #22ab94;
    --t-down: #f23645;
    --t-warn: #f0b90b;
    --t-accent: #3b82f6;
    --t-font: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Top bar (all pages) */
.app-nav { background: #0b0e14 !important; border-bottom: 1px solid #1f2433; min-height: 52px; }
.app-nav .navbar-brand { color: #e6e9ef; font-family: var(--t-font); font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 9px; letter-spacing: 0.01em; }
.app-nav .navbar-brand:hover { color: #fff; }
.app-logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #22ab94, #3b82f6); display: inline-block; }
.app-nav .navbar-toggler { border-color: #262c3b; }
.app-nav .navbar-toggler-icon { filter: invert(1) brightness(0.85); }

/* Page */
body:has(.dash) { background: var(--t-bg) !important; color: var(--t-text); font-family: var(--t-font); }
body:has(.dash) .container { max-width: 1480px; }
.dash { color: var(--t-text); gap: 12px; padding-top: 14px; }
.dash-card { background: var(--t-panel); border: 1px solid var(--t-border-soft); border-radius: 10px; box-shadow: none; }
.dash-label { color: var(--t-faint); font-size: 0.66rem; letter-spacing: 0.08em; font-weight: 600; }
.dash-sub { color: var(--t-muted); font-size: 0.76rem; }
.dash-h2 { color: var(--t-text); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 12px; }
.dash-value { color: var(--t-text); }

/* Alerts */
.dash-alert { border-radius: 10px; font-size: 0.86rem; padding: 10px 14px; border: 1px solid; }
.dash-alert.alert-warning { background: rgba(240, 185, 11, 0.08); border-color: rgba(240, 185, 11, 0.3); color: #f3d36b; }
.dash-alert.alert-warning .alert-link { color: #f0b90b; }
.dash-alert.alert-danger { background: rgba(242, 54, 69, 0.08); border-color: rgba(242, 54, 69, 0.3); color: #ff8a94; }
.dash-alert.alert-info { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.3); color: #93c5fd; }

/* Header */
.dash-head { padding: 14px 18px; gap: 14px 32px; }
.dash-title h1 { font-size: 1.3rem; font-weight: 700; color: var(--t-text); letter-spacing: -0.01em; }
.dash-title h1 span { color: var(--t-muted); font-weight: 500; }
.dash-price { display: flex; flex-direction: column; gap: 1px; padding-left: 28px; border-left: 1px solid var(--t-border); }
.dash-price-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--t-text); line-height: 1.15; transition: color 0.25s; }
.dash-price-value[data-tone="up"] { color: var(--t-up); }
.dash-price-value[data-tone="down"] { color: var(--t-down); }
.dash-status { gap: 10px 30px; padding-left: 28px; border-left: 1px solid var(--t-border); }
.dash-signal { font-size: 0.9rem; font-weight: 700; padding: 2px 10px; border-radius: 4px; letter-spacing: 0.04em; }
.dash-signal--buy { background: rgba(34, 171, 148, 0.15); color: var(--t-up); }
.dash-signal--sell { background: rgba(242, 54, 69, 0.15); color: var(--t-down); }
.dash-signal--neutral { background: var(--t-panel-2); color: var(--t-muted); }
.dash-pill, .dash-value { font-size: 0.92rem; font-weight: 600; }
.dash-pill[data-state="on"] { color: var(--t-up); }
.dash-pill[data-state="off"] { color: var(--t-muted); }

/* Buttons */
.dash .btn { font-weight: 600; font-size: 0.85rem; border-radius: 6px; padding: 7px 16px; }
.dash .btn-success { background: var(--t-up); border-color: var(--t-up); color: #fff; }
.dash .btn-success:hover { background: #1d9681; border-color: #1d9681; }
.dash .btn-outline-danger { color: var(--t-down); border-color: rgba(242, 54, 69, 0.55); background: transparent; }
.dash .btn-outline-danger:hover { background: rgba(242, 54, 69, 0.12); color: #ff6b77; }
.dash .btn-warning { background: transparent; color: var(--t-warn); border: 1px solid rgba(240, 185, 11, 0.55); }
.dash .btn-warning:hover { background: rgba(240, 185, 11, 0.12); }
.dash .btn-primary { background: var(--t-accent); border-color: var(--t-accent); }
.dash .btn:disabled { opacity: 0.4; }
.dash .btn-link { color: var(--t-muted); text-decoration: none; font-size: 0.78rem; }
.dash .btn-link:hover { color: var(--t-text); }

/* Money tiles */
.dash-kpi { padding: 12px 16px; }
.dash-kpi > div { font-size: 1.25rem; font-weight: 600; color: var(--t-text); margin-top: 4px; }
.dash-kpi small { color: var(--t-faint); font-weight: 500; }
.dash-pnl[data-tone="up"] { color: var(--t-up); }
.dash-pnl[data-tone="down"] { color: var(--t-down); }

/* Chart frame */
.chart-shell { border: 1px solid var(--t-border-soft); border-radius: 10px; box-shadow: none; }
.chart-toolbar { border-bottom-color: var(--t-border-soft); }
.chart-type-group { background: #10141d; }
.chart-type-btn.is-active { background: var(--t-panel-2); }

/* Forms */
.dash .form-control, .dash .input-group-text {
    background: #10141d; border-color: var(--t-border); color: var(--t-text); font-size: 0.88rem;
}
.dash .form-control:focus { border-color: var(--t-accent); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.dash .form-control::placeholder { color: var(--t-faint); }
.dash .input-group-text { color: var(--t-muted); }
.dash .form-check-input { background-color: #10141d; border-color: var(--t-border); }
.dash .form-check-input:checked { background-color: var(--t-accent); border-color: var(--t-accent); }
.dash .form-check-label { color: var(--t-text); font-size: 0.86rem; }

/* Key / value rows */
.dash-rows { font-size: 0.84rem; gap: 8px 14px; }
.dash-rows dt { color: var(--t-muted); }
.dash-rows dd { color: var(--t-text); font-weight: 500; }
.dash-rows dt, .dash-rows dd { padding-bottom: 8px; border-bottom: 1px solid var(--t-border-soft); }
.dash-rows dt:last-of-type, .dash-rows dd:last-of-type { border-bottom: 0; padding-bottom: 0; }
.dash-rows .text-muted { color: var(--t-faint) !important; }

/* Bot details */
.dash-details > summary::before { color: var(--t-faint); }
.dash-details > summary:hover .dash-h2 { color: #fff; }
.dash-details .text-muted { color: var(--t-muted) !important; }
.dash-phase.badge { background: var(--t-panel-2) !important; color: var(--t-muted); font-weight: 600; }
.dash-strategy { color: var(--t-muted); }
.condition-panel { background: var(--t-panel); border-color: var(--t-border-soft) !important; }
.condition-heading { color: var(--t-faint); }
.condition-item { background: var(--t-panel-2); border-color: var(--t-border-soft); color: var(--t-text); }
.condition-item--info { background: transparent; color: var(--t-muted); }
.condition-detail { color: var(--t-muted); }
.condition-icon { background: var(--t-border); color: var(--t-muted); }
.condition-item--yes, .condition-item--done { background: rgba(34, 171, 148, 0.08); border-color: rgba(34, 171, 148, 0.3); color: var(--t-text); }
.condition-item--yes .condition-icon, .condition-item--done .condition-icon { background: var(--t-up); color: #fff; }
.condition-item--not_yet .condition-icon, .condition-item--waiting .condition-icon { background: rgba(240, 185, 11, 0.15); color: var(--t-warn); }
.condition-item--not_yet .condition-state, .condition-item--waiting .condition-state { color: var(--t-warn); }
.condition-message { background: rgba(59, 130, 246, 0.1); color: #93c5fd; }
.condition-message--conflict { background: rgba(240, 185, 11, 0.1); color: #f3d36b; }
.condition-message--buy { background: rgba(34, 171, 148, 0.1); color: var(--t-up); }
.condition-message--sell { background: rgba(242, 54, 69, 0.1); color: #ff8a94; }

/* Trade history */
.trade-history-wrap { background: var(--t-panel); }
.trade-history-table { --bs-table-bg: transparent; --bs-table-color: var(--t-text); --bs-table-hover-bg: var(--t-panel-2);
    --bs-table-hover-color: var(--t-text); --bs-table-border-color: var(--t-border-soft); color: var(--t-text); font-size: 0.84rem; }
.trade-history-table.table-bordered > :not(caption) > * > * { border-width: 0 0 1px 0; }
.trade-history-table thead th { background: #10141d; color: var(--t-faint); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; border-bottom: 1px solid var(--t-border); }
.trade-history-table tbody tr:nth-child(odd) { background: transparent; }
.trade-history-table .text-muted { color: var(--t-muted) !important; }
.trade-history-table .text-success { color: var(--t-up) !important; }
.trade-history-table .text-danger { color: var(--t-down) !important; }
.trade-side-badge { background: var(--t-panel-2); border-color: var(--t-border); color: var(--t-muted); font-size: 0.7rem; }
.trade-side-badge--buy { background: rgba(34, 171, 148, 0.12); border-color: rgba(34, 171, 148, 0.35); color: var(--t-up); }
.trade-side-badge--sell { background: rgba(242, 54, 69, 0.12); border-color: rgba(242, 54, 69, 0.35); color: var(--t-down); }

/* Sidebar: strategy monitor */
.advisor {
    --advisor-bg: #12161f; --advisor-text: var(--t-text); --advisor-muted: var(--t-muted); --advisor-border: var(--t-border-soft);
    --advisor-soft: var(--t-panel); --advisor-buy: var(--t-up); --advisor-buy-text: var(--t-up); --advisor-sell: var(--t-down);
    --advisor-sell-text: #ff6b77; --advisor-warn: var(--t-warn); --advisor-warn-text: #f3d36b;
    font-family: var(--t-font); font-size: 0.84rem;
}
.advisor strong { color: #fff; font-weight: 600; }
@media (min-width: 1200px) {
    .advisor { top: 52px; padding: 16px 16px 24px; border-right-color: var(--t-border-soft); }
}
.advisor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--t-border-soft); }
.advisor-name { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t-text); }
.advisor-live { font-size: 0.72rem; color: var(--t-muted); }
.advisor-dot { animation: feed-pulse 1.6s ease-in-out infinite; }
.advisor-badge { background: var(--t-panel-2); color: var(--t-muted); border-radius: 4px; font-size: 0.72rem; }
.advisor-badge--buy { background: rgba(34, 171, 148, 0.15); color: var(--t-up); }
.advisor-badge--sell { background: rgba(242, 54, 69, 0.15); color: var(--t-down); }
.advisor-bar { background: var(--t-border); }
.advisor-headline { background: var(--t-panel); color: var(--t-text); border: 1px solid var(--t-border-soft); border-left: 3px solid var(--t-accent); border-radius: 6px; font-weight: 500; font-size: 0.84rem; }
.advisor-headline strong { color: #fff; }
.advisor-alert { background: rgba(240, 185, 11, 0.08); color: #f3d36b; border: 1px solid rgba(240, 185, 11, 0.2); }
.advisor-section-title { color: var(--t-faint); font-size: 0.66rem; letter-spacing: 0.08em; margin-top: 18px; }
.advisor-check { background: var(--t-panel); border-color: var(--t-border-soft); }
.advisor-check-icon { background: rgba(242, 54, 69, 0.14); color: #ff6b77; }
.advisor-check--yes { background: rgba(34, 171, 148, 0.07); border-color: rgba(34, 171, 148, 0.3); }
.advisor-check--yes .advisor-check-icon { background: rgba(34, 171, 148, 0.2); color: var(--t-up); }
.advisor-check-name { font-weight: 600; color: var(--t-text); }
.advisor-check-rule { color: var(--t-faint); }
.advisor-check-value { color: #c3c9d5; }
.advisor-card { background: var(--t-panel); border-left-color: var(--t-border); }
.advisor-card .advisor-section-title { margin-top: 10px; }
.advisor-rows dt { color: var(--t-muted); }
.advisor-rows dd { color: var(--t-text); }
.advisor-line { border-left-color: var(--t-border); color: #c3c9d5; }
.advisor-empty { color: var(--t-faint); }

@media (max-width: 1199.98px) {
    .advisor { background: #12161f; border-color: var(--t-border-soft); border-radius: 10px; }
}
@media (max-width: 900px) {
    .dash-price, .dash-status { padding-left: 0; border-left: 0; }
}


/* Trade history: compact numbers, stacked values, bullet-point causes */
.trade-history-wrap { max-height: 560px; }
.trade-history-table { min-width: 980px; font-size: 0.84rem; }
.trade-history-table thead th { padding: 10px 12px; white-space: nowrap; }
.trade-history-table thead th small { font-size: 0.6rem; color: var(--t-faint); font-weight: 500; letter-spacing: 0.04em; }
.trade-history-table tbody td { padding: 10px 12px; vertical-align: top; border-color: var(--t-border-soft); }
.trade-history-table tbody tr:hover > td { background: var(--t-panel-2); }
.th-main { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.th-sub { font-size: 0.74rem; color: var(--t-muted); font-variant-numeric: tabular-nums; white-space: nowrap; margin-top: 1px; }
.text-success .th-sub, .text-danger .th-sub { color: inherit; opacity: 0.8; }
.th-empty { color: var(--t-faint) !important; }
.th-cause { min-width: 280px; max-width: 420px; white-space: normal; }
.cause-list { margin: 0; padding-left: 14px; color: #c3c9d5; font-size: 0.78rem; line-height: 1.45; }
.cause-list li::marker { color: var(--t-faint); }
.cause-list li:first-child { color: var(--t-text); font-weight: 500; }
.trade-side-badge { min-width: 44px; justify-content: center; }

/* READY BUY / READY SELL: amber, between the two positions */
.dash-signal--ready { background: rgba(240, 185, 11, 0.14); color: #f0b90b; }
.legend-signal--ready { color: #f0b90b; }


/* ════════════════════════════════════════════════════════════════════
   Contrast pass: every text color >= 4.5:1 on its background (WCAG AA),
   clearer card separation, stronger states. Overrides the theme above.
   ════════════════════════════════════════════════════════════════════ */
:root {
    --t-bg: #0a0d13;
    --t-panel: #141924;
    --t-panel-2: #1b2130;
    --t-border: #2c3446;
    --t-border-soft: #232a39;
    --t-text: #eef1f6;
    --t-muted: #a7b0c0;       /* 8:1  on panels */
    --t-faint: #8792a6;       /* 5.5:1 on panels (was 3:1) */
    --t-up-text: #34c7aa;     /* text green (candles keep #22ab94) */
    --t-down-text: #ff6b78;   /* text red   (candles keep #f23645) */
    --t-accent: #5b9bff;
    --t-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 6px 18px rgba(0, 0, 0, 0.28);
}

/* Cards stand out from the page */
.dash-card, .chart-shell { background: var(--t-panel); border: 1px solid var(--t-border-soft); box-shadow: var(--t-shadow); }
.dash-card:hover { border-color: var(--t-border); }
.dash-label { color: var(--t-faint); font-size: 0.68rem; letter-spacing: 0.07em; }
.dash-sub { color: var(--t-muted); }
.dash-h2 { color: var(--t-text); font-size: 0.78rem; letter-spacing: 0.08em; padding-bottom: 10px; border-bottom: 1px solid var(--t-border-soft); }
.dash-details > summary .dash-h2, .dash-history-head .dash-h2 { border-bottom: 0; padding-bottom: 0; }

/* Header */
.dash-head { background: linear-gradient(180deg, #171d2a 0%, var(--t-panel) 100%); }
.dash-title h1 span { color: var(--t-muted); }
.dash-price-value[data-tone="up"] { color: var(--t-up-text); }
.dash-price-value[data-tone="down"] { color: var(--t-down-text); }
.dash-price, .dash-status { border-left-color: var(--t-border); }
.dash-signal { font-size: 0.85rem; padding: 3px 12px; border: 1px solid transparent; }
.dash-signal--buy { background: rgba(52, 199, 170, 0.14); color: var(--t-up-text); border-color: rgba(52, 199, 170, 0.35); }
.dash-signal--sell { background: rgba(255, 107, 120, 0.13); color: var(--t-down-text); border-color: rgba(255, 107, 120, 0.35); }
.dash-signal--ready { background: rgba(240, 185, 11, 0.13); color: #f5c842; border-color: rgba(240, 185, 11, 0.4); }
.dash-signal--neutral { background: var(--t-panel-2); color: var(--t-muted); border-color: var(--t-border); }
.dash-pill[data-state="on"] { color: var(--t-up-text); }
.dash-pill[data-state="off"] { color: var(--t-muted); }

/* Buttons: readable even when disabled */
.dash .btn-success { background: #22ab94; border-color: #22ab94; color: #04110e; }
.dash .btn-success:hover { background: #2bc4a9; border-color: #2bc4a9; color: #04110e; }
.dash .btn-outline-danger { color: var(--t-down-text); border-color: rgba(255, 107, 120, 0.6); }
.dash .btn-warning { color: #f5c842; border-color: rgba(240, 185, 11, 0.6); }
.dash .btn-primary { background: #2f6fe0; border-color: #2f6fe0; color: #fff; }
.dash .btn-primary:hover { background: #3b7cf0; border-color: #3b7cf0; }
.dash .btn:disabled { opacity: 0.55; filter: saturate(0.6); cursor: not-allowed; }
.dash .btn-link { color: var(--t-accent); }
.dash .btn-link:hover { color: #8bb8ff; }

/* Money tiles: colored left edge for profit / loss */
.dash-kpi { position: relative; overflow: hidden; }
.dash-kpi:has(.dash-pnl[data-tone="up"]) { box-shadow: inset 3px 0 0 var(--t-up-text), var(--t-shadow); }
.dash-kpi:has(.dash-pnl[data-tone="down"]) { box-shadow: inset 3px 0 0 var(--t-down-text), var(--t-shadow); }
.dash-kpi small { color: var(--t-faint); }
.dash-pnl[data-tone="up"] { color: var(--t-up-text); }
.dash-pnl[data-tone="down"] { color: var(--t-down-text); }

/* Chart frame and legend */
.chart-toolbar { background: #121722; }
.chart-type-btn { color: var(--t-muted); }
.chart-type-btn.is-active { background: #2a3245; color: #fff; }
.chart-zones-toggle { color: var(--t-muted); }
.chart-legend { background: rgba(10, 13, 19, 0.82); border: 1px solid var(--t-border-soft); }
.chart-legend-row span:first-child { color: #8b95a8; }
.legend-signal--sell { color: var(--t-down-text); }
.legend-signal--buy { color: var(--t-up-text); }

/* Forms */
.dash .form-control, .dash .input-group-text { background: #0f131c; border-color: var(--t-border); }
.dash .form-control::placeholder { color: var(--t-faint); }
.dash .form-check-input { border-color: #3a4357; }

/* Key / value rows */
.dash-rows dt { color: var(--t-muted); }
.dash-rows dd { color: var(--t-text); }
.dash-rows .text-muted { color: var(--t-faint) !important; }

/* Bot details */
.dash-phase.badge { background: var(--t-panel-2) !important; color: var(--t-muted); border: 1px solid var(--t-border); }
.condition-heading { color: var(--t-faint); }
.condition-detail { color: var(--t-muted); }
.condition-item--info { color: var(--t-muted); }

/* Trade history */
.trade-history-table thead th { background: #10141d; color: var(--t-muted); border-bottom-color: var(--t-border); }
.trade-history-table thead th small { color: var(--t-faint); }
.trade-history-table .text-success { color: var(--t-up-text) !important; }
.trade-history-table .text-danger { color: var(--t-down-text) !important; }
.th-sub { color: var(--t-muted); }
.th-empty { color: var(--t-faint) !important; }
.cause-list { color: #c9cfdb; }
.cause-list li::marker { color: var(--t-faint); }
.trade-side-badge--buy { color: var(--t-up-text); border-color: rgba(52, 199, 170, 0.4); background: rgba(52, 199, 170, 0.12); }
.trade-side-badge--sell { color: var(--t-down-text); border-color: rgba(255, 107, 120, 0.4); background: rgba(255, 107, 120, 0.12); }

/* Sidebar: strategy monitor */
.advisor { --advisor-bg: #10141c; --advisor-muted: var(--t-muted); --advisor-border: var(--t-border-soft);
           --advisor-buy-text: var(--t-up-text); --advisor-sell-text: var(--t-down-text); }
@media (min-width: 1200px) { .advisor { border-right: 1px solid var(--t-border); } }
.advisor-head { border-bottom-color: var(--t-border); }
.advisor-live { color: var(--t-muted); }
.advisor-section-title { color: var(--t-faint); font-size: 0.68rem; }
.advisor-badge { border: 1px solid var(--t-border); color: var(--t-muted); }
.advisor-badge--buy { color: var(--t-up-text); border-color: rgba(52, 199, 170, 0.35); }
.advisor-badge--sell { color: var(--t-down-text); border-color: rgba(255, 107, 120, 0.35); }
.advisor-bar { background: #2c3446; }
.advisor-bar--yes { background: var(--t-up-text); }
.advisor-progress { color: var(--t-muted); }
.advisor-headline { background: var(--t-panel); border-color: var(--t-border-soft); border-left-color: var(--t-accent); color: var(--t-text); }
.advisor-check { background: var(--t-panel); border-color: var(--t-border-soft); }
.advisor-check-icon { background: rgba(255, 107, 120, 0.16); color: var(--t-down-text); }
.advisor-check--yes { background: rgba(52, 199, 170, 0.08); border-color: rgba(52, 199, 170, 0.38); }
.advisor-check--yes .advisor-check-icon { background: rgba(52, 199, 170, 0.22); color: var(--t-up-text); }
.advisor-check-rule { color: var(--t-faint); }
.advisor-check-value { color: #d3d8e2; }
.advisor-card { background: var(--t-panel); border: 1px solid var(--t-border-soft); border-left: 3px solid var(--t-border); }
.advisor-card p { color: var(--t-muted); }
.advisor-rows dt { color: var(--t-muted); }
.advisor-line { color: #d3d8e2; border-left-color: var(--t-border); }
.advisor-line span { color: var(--t-faint); }
.advisor-line--buy { border-left-color: var(--t-up-text); }
.advisor-line--sell { border-left-color: var(--t-down-text); }
.advisor-empty { color: var(--t-faint); }

/* Top bar */
.app-nav { background: #080b10 !important; border-bottom-color: var(--t-border-soft); }
.dash-grid { grid-template-columns: 1.25fr 1.1fr 0.8fr; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dash-grid { grid-template-columns: 1fr; } }


/* ── Right sidebar: our position and the activity journal ── */
.dash-right { display: flex; flex-direction: column; gap: 12px; font-family: var(--t-font); color: var(--t-text);
    --advisor-muted: var(--t-muted); --advisor-soft: var(--t-panel); --advisor-buy: var(--t-up-text); --advisor-sell: var(--t-down-text); }
.dash-right .dash-card { padding: 14px; }
.dash-right .dash-rows { font-size: 0.82rem; }
#advisor-position:empty { display: none; }
#advisor-position .advisor-card { margin: 0; padding: 4px 14px 12px; border-radius: 10px; background: var(--t-panel);
    border: 1px solid var(--t-border-soft); border-left: 3px solid var(--t-border); box-shadow: var(--t-shadow); }
#advisor-position .advisor-card--buy { border-left-color: var(--t-up-text); }
#advisor-position .advisor-card--sell { border-left-color: var(--t-down-text); }
#advisor-position .advisor-section-title { color: var(--t-faint); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; margin: 10px 0 6px; }
#advisor-position .advisor-rows { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 0.84rem; }
#advisor-position .advisor-rows dt { color: var(--t-muted); font-weight: 400; }
#advisor-position .advisor-rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
#advisor-position .advisor-rows strong { color: #fff; font-weight: 600; }
#advisor-position p { margin: 8px 0 0; font-size: 0.76rem; color: var(--t-muted); }

.dash-activity { display: flex; flex-direction: column; min-height: 0; }
.dash-activity .advisor-journal { list-style: none; margin: 0; padding: 0 4px 0 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.dash-activity .advisor-line { font-size: 0.8rem; line-height: 1.4; padding: 2px 0 2px 10px; border-left: 2px solid var(--t-border); color: #d3d8e2; }
.dash-activity .advisor-line strong { color: #fff; font-weight: 600; }
.dash-activity .advisor-line span { display: block; font-size: 0.7rem; color: var(--t-faint); font-variant-numeric: tabular-nums; }
.dash-activity .advisor-line--buy { border-left-color: var(--t-up-text); }
.dash-activity .advisor-line--sell { border-left-color: var(--t-down-text); }
.dash-activity .advisor-line--conflict { border-left-color: #f0b90b; }
.dash-activity .advisor-empty { font-size: 0.8rem; color: var(--t-faint); }
.dash-activity .advisor-journal::-webkit-scrollbar { width: 6px; }
.dash-activity .advisor-journal::-webkit-scrollbar-thumb { background: var(--t-border); border-radius: 3px; }

/* Wide screens: fixed on the right, like the strategy monitor on the left; the activity fills the rest of the height */
@media (min-width: 1200px) {
    .dash-right {
        position: fixed; top: 52px; right: 0; bottom: 0; width: 320px; padding: 16px 14px 16px;
        background: #10141c; border-left: 1px solid var(--t-border); overflow-y: auto; z-index: 1020;
    }
    body:has(.dash-right) { padding-right: 336px !important; }
    .dash-right .dash-activity { flex: 1 1 auto; min-height: 220px; }
    .dash-right .dash-activity .advisor-journal { flex: 1 1 0; min-height: 0; }
}
/* Narrow screens: right after the chart, before the strategy monitor */
@media (max-width: 1199.98px) {
    .dash-layout > .dash-right { order: 2; }
    .dash-layout > .advisor { order: 3; }
    .dash-layout > .dash > * { order: 4; }
    .dash-layout > .dash > .dash-alert, .dash-layout > .dash > .dash-head,
    .dash-layout > .dash > .dash-kpis, .dash-layout > .dash > .chart-shell { order: 1; }
    .dash-right .dash-activity .advisor-journal { max-height: 320px; }
}
/* Order size and balances: two cards now */
.dash-grid { grid-template-columns: 1.2fr 0.8fr; }
@media (max-width: 640px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-link { color: var(--t-accent); text-decoration: none; }
.dash-link:hover { color: #8bb8ff; text-decoration: underline; }

/* Why the balances are missing (no keys / refused by the exchange); hidden when empty */
.dash-balance-error:empty { display: none; }
.dash-balance-error { margin-top: -4px; padding: 8px 12px; border-radius: 8px; font-size: 0.82rem;
    background: rgba(240, 185, 11, 0.08); border: 1px solid rgba(240, 185, 11, 0.3); color: #f3d36b; }

/* "Current value · bid 64,262.6": the live price the value is computed with */
.dash-live { font-size: 0.66rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: #22ab94; margin-left: 4px; }

/* Chart legend: compact, O H L C colored by the candle, the right side stays free for the line tags */
.chart-legend { gap: 1px 10px; padding: 4px 9px; font-size: 0.72rem; max-width: min(560px, calc(100% - 150px));
    background: rgba(10, 13, 19, 0.72); backdrop-filter: blur(4px); }
.legend-break { flex-basis: 100%; height: 0; }
.legend-ohlc:first-child span:first-child { color: #f1f5f9; font-weight: 700; }
.legend-ohlc span:first-child { color: #7f8aa0; }
.chart-legend[data-tone="up"] .legend-ohlc:not(:first-child) span:last-child,
.chart-legend[data-tone="up"] .legend-change { color: #22ab94; }
.chart-legend[data-tone="down"] .legend-ohlc:not(:first-child) span:last-child,
.chart-legend[data-tone="down"] .legend-change { color: #f23645; }
.legend-change { font-weight: 600; }
.legend-sub { font-size: 0.68rem; }

/* BTC | ETH switch next to the market name */
.market-switch { display: inline-flex; gap: 2px; margin-left: 12px; padding: 2px; border-radius: 7px; background: #0b1018;
    vertical-align: middle; font-size: 0.78rem; }
.market-switch-btn { padding: 2px 10px; border-radius: 5px; color: #94a3b8; font-weight: 700; text-decoration: none; letter-spacing: 0.02em; }
.market-switch-btn:hover { color: #e2e8f0; }
.market-switch-btn.is-active { background: #263046; color: #fff; }
