/* Market Geometry Trading Bot — Dashboard */

:root {
    --bg: #141428;
    --panel: #16162a;
    --border: #2a2a42;
    --text: #e8e8ee;
    --text-dim: #9b9bb8;
    --accent-bull: #26a69a;
    --accent-bear: #ef5350;
    --accent-blue: #64b5f6;
    --accent-orange: #ff7043;
    --accent-amber: #ffb74d;
    --accent-purple: #ab47bc;
    --focus-ring: rgba(100, 181, 246, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 14px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 0.8125rem;
    line-height: 1.45;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 8px 16px;
    background: var(--accent-blue);
    color: #fff;
    font-weight: 600;
}
.skip-link:focus {
    left: 8px;
    top: 8px;
}

.tabular {
    font-variant-numeric: tabular-nums lining-nums;
}

/* ── Toolbar ─────────────────────────────────────────────── */

#toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#toolbar .pair-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

#toolbar .pair-tab, #toolbar .tf-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
}

#toolbar .pair-tab:focus-visible,
#toolbar .tf-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

#toolbar .pair-tab.state-trade {
    background: #2e7d32;
    color: #fff;
    border-color: #43a047;
}
#toolbar .pair-tab.state-setup:not(.state-trade) {
    background: #f9a825;
    color: #1a1a1a;
    border-color: #ffca28;
}
#toolbar .pair-tab.active:not(.state-trade):not(.state-setup) {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}
#toolbar .pair-tab.active {
    box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.35);
    position: relative;
    z-index: 1;
}
#toolbar .tf-btn.active {
    background: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}
#toolbar .pair-tab:hover, #toolbar .tf-btn:hover {
    filter: brightness(1.1);
    border-color: var(--text-dim);
}

#toolbar .sep {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 4px;
}

.chart-context {
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.bot-state-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.bot-state-pill {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(38, 166, 154, 0.12);
    color: var(--accent-bull);
    border: 1px solid rgba(38, 166, 154, 0.35);
}
.bot-state-pill.state-warn {
    background: rgba(255, 183, 77, 0.12);
    color: var(--accent-amber);
    border-color: rgba(255, 183, 77, 0.4);
}
.bot-state-pill.state-halt {
    background: rgba(239, 83, 80, 0.15);
    color: var(--accent-bear);
    border-color: rgba(239, 83, 80, 0.45);
}

.acct-rest-age {
    font-size: 0.625rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.acct-rest-age--stale {
    color: var(--accent-amber);
}

.strategy-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(100, 181, 246, 0.12);
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
    flex-shrink: 0;
}
.strategy-info-btn:hover {
    background: rgba(100, 181, 246, 0.22);
    border-color: var(--accent-blue);
}
.strategy-info-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.strategy-info-btn__glyph {
    transform: translateY(-0.5px);
}

/* Strategy info modal (<dialog>) */
.strategy-modal {
    margin: auto;
    padding: 0;
    max-width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.strategy-modal::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

/* Trade detail modal */
.trade-detail-modal {
    margin: auto;
    padding: 0;
    max-width: min(480px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.trade-detail-modal::backdrop {
    background: rgba(0, 0, 0, 0.55);
}
.trade-detail-modal__panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
}
.trade-detail-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.trade-detail-modal__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: var(--text);
}
.trade-detail-modal__close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.trade-detail-modal__close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}
.trade-detail-modal__body {
    padding: 14px 18px 18px;
    overflow-y: auto;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--text);
}
.trade-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
}
.trade-detail-grid .td-cell {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
}
.trade-detail-grid .td-cell:nth-child(odd) {
    background: rgba(255, 255, 255, 0.04);
}
.td-label {
    display: block;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    margin-bottom: 2px;
}
.td-value {
    font-size: 0.875rem;
    font-weight: 600;
    word-break: break-word;
}
.td-value--green { color: #4caf50; }
.td-value--red { color: #f44336; }
.td-value--blue { color: #2196f3; }
.td-notes {
    grid-column: 1 / -1;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border);
}
.td-notes .td-value {
    font-weight: 400;
    font-size: 0.8rem;
    white-space: pre-wrap;
}
.td-outcome-banner {
    grid-column: 1 / -1;
    padding: 10px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 6px;
    margin: 6px 10px 4px;
}
.td-outcome-banner--win { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.td-outcome-banner--loss { background: rgba(244, 67, 54, 0.15); color: #f44336; }
.td-outcome-banner--open { background: rgba(33, 150, 243, 0.15); color: #2196f3; }
.history-table tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}
.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* API key gate (shown when WEB_API_TOKEN is set and browser has no key) */
.auth-gate-modal {
    margin: auto;
    padding: 0;
    max-width: min(420px, calc(100vw - 24px));
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.auth-gate-modal::backdrop {
    background: rgba(0, 0, 0, 0.65);
}
.auth-gate-modal__panel {
    padding: 20px 22px 22px;
}
.auth-gate-modal__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 10px;
}
.auth-gate-modal__hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0 0 14px;
}
.auth-gate-modal__hint code {
    font-size: 0.72rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 1px 5px;
    border-radius: 4px;
}
.auth-gate-modal__label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.auth-gate-modal__input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    margin-bottom: 10px;
}
.auth-gate-modal__input:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}
.auth-gate-modal__error {
    font-size: 0.75rem;
    color: var(--accent-bear);
    margin: 0 0 10px;
}
.auth-gate-modal__error[hidden] {
    display: none !important;
}
.auth-gate-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 6px;
}
.auth-gate-modal__btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
}
.auth-gate-modal__btn--secondary {
    background: transparent;
    color: var(--text-dim);
}
.auth-gate-modal__btn--primary {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}
.auth-gate-modal__btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.strategy-modal__panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
}
.strategy-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.strategy-modal__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: var(--text);
}
.strategy-modal__close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.strategy-modal__close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}
.strategy-modal__close:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.strategy-modal__body {
    padding: 14px 18px 18px;
    overflow-y: auto;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--text);
}
.strategy-modal__body .strategy-section {
    margin-bottom: 1.15rem;
}
.strategy-modal__body .strategy-section:last-child {
    margin-bottom: 0;
}
.strategy-modal__body h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    margin: 0 0 0.45rem;
}
.strategy-modal__body p {
    margin: 0 0 0.5rem;
    color: var(--text);
}
.strategy-modal__body p:last-child {
    margin-bottom: 0;
}
.strategy-modal__body ul {
    margin: 0.35rem 0 0.5rem 1.1rem;
    padding: 0;
}
.strategy-modal__body li {
    margin-bottom: 0.35rem;
}
.strategy-modal__loading {
    color: var(--text-dim);
    margin: 0;
}

/* Chart overlay settings modal */
.overlay-settings-modal {
    margin: auto;
    padding: 0;
    max-width: min(640px, calc(100vw - 24px));
    max-height: calc(100vh - 32px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.overlay-settings-modal::backdrop {
    background: rgba(0, 0, 0, 0.55);
}
.overlay-settings-modal__panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
}
.overlay-settings-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.overlay-settings-modal__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: var(--text);
}
.overlay-settings-modal__close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.overlay-settings-modal__close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}
.overlay-settings-modal__close:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.overlay-settings-modal__body {
    padding: 0 10px 14px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.overlay-settings-modal__body #overlays-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 20px;
    align-items: start;
    padding: 10px 8px 4px;
}
@media (max-width: 560px) {
    .overlay-settings-modal__body #overlays-panel {
        grid-template-columns: 1fr;
    }
}
.panel-body--overlays-teaser {
    padding: 10px 12px 12px;
}
.overlays-teaser-hint {
    margin: 0 0 10px;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-dim);
}
.overlay-settings-open-btn {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}
.overlay-settings-open-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.overlay-settings-open-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Scanner profiles modal */
.scanner-profiles-pill {
    margin-left: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    border: 1px solid var(--border);
    background: rgba(156, 39, 176, 0.12);
    color: #ce93d8;
}
.scanner-profiles-pill:hover {
    background: rgba(156, 39, 176, 0.2);
    color: #e1bee7;
}
.scanner-profiles-pill:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.scanner-profiles-modal {
    margin: auto;
    padding: 0;
    max-width: min(720px, calc(100vw - 24px));
    max-height: calc(100vh - 32px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.scanner-profiles-modal::backdrop {
    background: rgba(0, 0, 0, 0.55);
}
.scanner-profiles-modal__panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
}
.scanner-profiles-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.scanner-profiles-modal__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}
.scanner-profiles-modal__close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.scanner-profiles-modal__close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}
.scanner-profiles-modal__close:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.scanner-profiles-modal__intro {
    padding: 10px 18px 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text-dim);
}
.scanner-profiles-modal__intro p {
    margin: 0 0 10px;
}
.scanner-profiles-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
}
.scanner-profiles-btn {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}
.scanner-profiles-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.scanner-profiles-btn--primary {
    border-color: rgba(156, 39, 176, 0.45);
    background: rgba(156, 39, 176, 0.15);
    color: #e1bee7;
}
.scanner-profiles-btn--primary:hover {
    background: rgba(156, 39, 176, 0.25);
}
.scanner-profiles-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.scanner-profiles-status {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-dim);
    max-width: 220px;
    text-align: right;
}
.scanner-profiles-status--err {
    color: #ef9a9a;
}
.scanner-profiles-modal__body {
    padding: 12px 14px 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.scanner-profiles-empty {
    margin: 12px 4px;
    color: var(--text-dim);
    font-size: 0.875rem;
}
.scanner-profile-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.15);
}
.scanner-profile-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.scanner-profile-card__title {
    font-weight: 700;
    font-size: 0.9375rem;
    flex: 1;
    min-width: 120px;
}
.scanner-profile-card__delete {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(239, 83, 80, 0.45);
    background: rgba(239, 83, 80, 0.12);
    color: #ef9a9a;
}
.scanner-profile-card__delete:hover {
    background: rgba(239, 83, 80, 0.22);
}
.scanner-profile-card__delete:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.scanner-profile-card__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px 14px;
    align-items: start;
}
.scanner-profile-card label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.scanner-profile-card input[type="text"],
.scanner-profile-card input[type="number"],
.scanner-profile-card select {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    font-size: 0.8125rem;
}
.scanner-profile-card fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px 10px;
    margin: 0;
}
.scanner-profile-card fieldset legend {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0 6px;
    color: var(--text-dim);
}
.scanner-profile-card .setup-type-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 6px;
}
.scanner-profile-card .setup-type-checks label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    cursor: pointer;
}

/* Scanner profile form (class names from app.js ``renderScannerProfileCard``) */
.scanner-profile-card .spf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px 14px;
    align-items: start;
    margin-bottom: 12px;
}
.scanner-profile-card label.spf-field-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-dim);
}
.scanner-profile-card .spf-label-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.scanner-profile-card .spf-info-btn {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(100, 181, 246, 0.45);
    background: rgba(100, 181, 246, 0.12);
    color: var(--accent-blue);
    font-size: 0.625rem;
    font-weight: 800;
    font-style: italic;
    cursor: help;
    line-height: 1;
    vertical-align: middle;
}
.scanner-profile-card .spf-info-btn:hover {
    background: rgba(100, 181, 246, 0.22);
    color: var(--text);
}
.scanner-profile-card .spf-info-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.scanner-profile-card .spf-help-popover {
    max-width: min(400px, 94vw);
    margin: auto;
    padding: 14px 16px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.scanner-profile-card .spf-help-popover::backdrop {
    background: rgba(0, 0, 0, 0.25);
}
.scanner-profile-card .spf-help-popover__title {
    margin: 0 0 8px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.scanner-profile-card .spf-help-popover__p {
    margin: 0 0 10px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-dim);
    font-weight: 400;
}
.scanner-profile-card .spf-help-popover__p:last-child {
    margin-bottom: 0;
}
.scanner-profile-card .spf-help-dl {
    margin: 0 0 10px;
    font-size: 0.8125rem;
    line-height: 1.45;
}
.scanner-profile-card .spf-help-dl dt {
    font-weight: 700;
    color: var(--text);
    margin-top: 8px;
}
.scanner-profile-card .spf-help-dl dt:first-child {
    margin-top: 0;
}
.scanner-profile-card .spf-help-dl dd {
    margin: 4px 0 0 0;
    padding-left: 0;
    color: var(--text-dim);
}
.scanner-profile-card .spf-help-ol {
    margin: 0 0 10px;
    padding-left: 1.25rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-dim);
}
.scanner-profile-card .spf-help-ol li {
    margin-bottom: 6px;
}
.scanner-profile-card .spf-legend-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.scanner-profile-card .spf-st-emlab__row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.scanner-profile-card .spf-confirms label.spf-confirm-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
}
.scanner-profile-card .spf-confirms label.spf-confirm-row input {
    margin-top: 3px;
    flex-shrink: 0;
}
.scanner-profile-card .spf-grid--auto-entry label {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.6875rem;
}
.scanner-profile-card .spf-enable-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 120px;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
}
.scanner-profile-card .spf-enable-wrap input {
    cursor: pointer;
}
.scanner-profile-card .spf-delete {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(239, 83, 80, 0.45);
    background: rgba(239, 83, 80, 0.12);
    color: #ef9a9a;
}
.scanner-profile-card .spf-delete:hover {
    background: rgba(239, 83, 80, 0.22);
}
.scanner-profile-card .spf-delete:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.scanner-profile-card fieldset.spf-auto-entry {
    margin: 0 0 12px;
    padding: 10px 12px 12px;
    border: 1px solid rgba(156, 39, 176, 0.35);
    border-radius: 8px;
}
.scanner-profile-card fieldset.spf-auto-entry > .spf-auto-entry__legend {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ce93d8;
    text-transform: none;
    letter-spacing: 0.02em;
    padding: 0 6px;
}
.scanner-profile-card .spf-auto-entry__hint {
    margin: 0 0 10px;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-dim);
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}
.scanner-profile-card .spf-grid--auto-entry {
    margin-bottom: 0;
}
.scanner-profile-card label.spf-st-emlab {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-dim);
    min-width: 120px;
}
.scanner-profile-card .spf-st-emlab select {
    padding: 5px 6px;
    font-size: 0.8125rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
}
.scanner-profile-card fieldset.spf-setup-types {
    margin: 0 0 12px;
    padding: 10px 12px 12px;
}
.scanner-profile-card fieldset.spf-setup-types > legend.spf-setup-types__legend {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0.02em;
    padding: 0 6px;
}
.scanner-profile-card .spf-setup-types__hint {
    margin: 0 0 10px;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-dim);
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}
.scanner-profile-card .spf-setup-types__blocks {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.scanner-profile-card .spf-st-block {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.12);
}
.scanner-profile-card .spf-st-block__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 8px;
}
.scanner-profile-card label.spf-st-cben {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}
.scanner-profile-card label.spf-st-minlab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0 auto;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
}
.scanner-profile-card .spf-st-minlab input {
    width: 5rem;
    padding: 4px 6px;
    font-size: 0.75rem;
}
.scanner-profile-card .spf-st-params {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 12px;
}
.scanner-profile-card label.spf-st-pl {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-dim);
}
.scanner-profile-card .spf-st-pl input {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 7px;
    font-size: 0.8125rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
}
.scanner-profile-card .spf-setup-types__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: flex-start;
}
.scanner-profile-card label.spf-cb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    cursor: pointer;
}
.scanner-profile-card label.spf-cb input {
    cursor: pointer;
    flex-shrink: 0;
}
.scanner-profile-card .spf-confirms {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 2px;
}
.scanner-profile-card .spf-confirms label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    cursor: pointer;
}
.scanner-profile-card .spf-confirms label.spf-field-label--inline {
    flex-wrap: wrap;
    margin-top: 6px;
    cursor: default;
}
.scanner-profile-card .spf-confirms .spf-ict-sweep {
    max-width: 5.5rem;
    margin-left: auto;
}
.scanner-profile-card fieldset.spf-pairs-sched {
    margin: 0.75rem 0 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
}

.scanner-profile-card fieldset.spf-pairs-sched > .spf-pairs-sched__legend {
    padding: 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.scanner-profile-card .spf-pairs-sched__hint {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    opacity: 0.88;
    line-height: 1.35;
}

.scanner-profile-card label.spf-field-label--block {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.scanner-profile-card textarea.spf-pairs {
    width: 100%;
    min-height: 2.5rem;
    resize: vertical;
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
    padding: 0.35rem 0.45rem;
    border-radius: 4px;
    box-sizing: border-box;
}

.scanner-profile-card .spf-pairs-hint {
    margin: -0.25rem 0 0.5rem;
    font-size: 0.72rem;
    opacity: 0.75;
    line-height: 1.3;
    word-break: break-word;
}

.scanner-profile-card .spf-sched-rows {
    margin: 0.4rem 0 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.scanner-profile-card .spf-sched-empty {
    margin: 0;
    font-size: 0.78rem;
    opacity: 0.85;
    line-height: 1.35;
}

.scanner-profile-card .spf-sched-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
}

.scanner-profile-card .spf-sched-row .spf-sched-wd {
    min-width: 4.5rem;
}

.scanner-profile-card .spf-sched-tlab {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.scanner-profile-card .spf-sched-tlab input[type="time"] {
    width: auto;
}

.scanner-profile-card button.spf-sched-add {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    padding: 0.25rem 0.55rem;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
}

.scanner-profile-card button.spf-sched-add:hover {
    background: rgba(255, 255, 255, 0.1);
}

.scanner-profile-card button.spf-sched-del {
    font-size: 0.75rem;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid rgba(255, 100, 100, 0.35);
    background: transparent;
    color: inherit;
    opacity: 0.9;
}

.scanner-profile-card button.spf-sched-del:hover {
    opacity: 1;
}

.scanner-profile-card .spf-confirms input {
    cursor: pointer;
    flex-shrink: 0;
}

.toolbar-legend {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.625rem;
    color: var(--text-dim);
    margin-left: 6px;
    user-select: none;
}
.toolbar-legend .lg-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-left: 6px;
    vertical-align: middle;
}
.toolbar-legend .lg-swatch:first-of-type { margin-left: 0; }
.toolbar-legend .lg-swatch--pos {
    background: #2e7d32;
    border: 1px solid #43a047;
}
.toolbar-legend .lg-swatch--setup {
    background: #f9a825;
    border: 1px solid #ffca28;
}
.toolbar-legend .lg-txt { margin-right: 2px; }

.ws-status {
    margin-left: 8px;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.ws-status--online {
    color: var(--accent-bull);
    border-color: rgba(38, 166, 154, 0.45);
    background: rgba(38, 166, 154, 0.08);
}
.ws-status--offline {
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.2);
}
.ws-status--auth {
    cursor: pointer;
    color: #ffb74d;
    border-color: rgba(255, 183, 77, 0.5);
    background: rgba(255, 183, 77, 0.1);
}

/* ── Main layout ─────────────────────────────────────────── */

#main {
    display: flex;
    flex: 1;
    min-height: 0;
}

#chart-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}

#chart-container {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* FX session shading (UTC) — sits above canvas so semi-transparent bands tint the chart */
.chart-session-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.chart-session-band {
    position: absolute;
    top: 0;
    bottom: 0;
    min-width: 1px;
}

/* ICT / SMC overlays — FVG boxes, order blocks, liquidity sweep markers */
.chart-ict-layer {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

.chart-ict-fvg {
    position: absolute;
    border-radius: 2px;
    box-sizing: border-box;
    min-height: 2px;
    min-width: 2px;
}

.chart-ict-fvg--bullish {
    background: rgba(38, 166, 154, 0.14);
    border: 1px solid rgba(38, 166, 154, 0.4);
}

.chart-ict-fvg--bearish {
    background: rgba(239, 83, 80, 0.14);
    border: 1px solid rgba(239, 83, 80, 0.38);
}

.chart-ict-fvg--mitigated {
    opacity: 0.42;
    border-style: dashed;
}

.chart-ict-fvg-ce {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.chart-ict-ob {
    position: absolute;
    border-radius: 2px;
    box-sizing: border-box;
    min-height: 3px;
    min-width: 2px;
}

.chart-ict-ob--bullish {
    background: rgba(129, 199, 132, 0.16);
    border: 1px solid rgba(129, 199, 132, 0.45);
}

.chart-ict-ob--bearish {
    background: rgba(229, 115, 115, 0.16);
    border: 1px solid rgba(229, 115, 115, 0.42);
}

.chart-ict-ob--mitigated {
    opacity: 0.4;
    border-style: dashed;
}

.chart-ict-sweep {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    transform: translateZ(0);
}

.chart-ict-sweep--buyside {
    background: linear-gradient(
        180deg,
        rgba(255, 183, 77, 0.05) 0%,
        rgba(255, 183, 77, 0.55) 45%,
        rgba(255, 183, 77, 0.55) 55%,
        rgba(255, 183, 77, 0.05) 100%
    );
}

.chart-ict-sweep--sellside {
    background: linear-gradient(
        180deg,
        rgba(100, 181, 246, 0.05) 0%,
        rgba(100, 181, 246, 0.55) 45%,
        rgba(100, 181, 246, 0.55) 55%,
        rgba(100, 181, 246, 0.05) 100%
    );
}

.overlay-group .ict-overlay-label {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* Crosshair OHLC / spread HUD */
.chart-crosshair-hud {
    position: absolute;
    z-index: 4;
    pointer-events: none;
    min-width: 140px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(22, 22, 42, 0.92);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums lining-nums;
    line-height: 1.45;
    color: var(--text);
}

.chart-crosshair-hud__time {
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 0.65rem;
}

.chart-crosshair-hud__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
}
.chart-crosshair-hud__row:last-child {
    margin-bottom: 0;
}
.chart-crosshair-hud__row span:first-child {
    color: var(--text-dim);
    font-weight: 600;
    width: 1.25rem;
    flex-shrink: 0;
}
.chart-crosshair-hud__row b {
    font-weight: 700;
    text-align: right;
}
.chart-crosshair-hud__row--muted {
    font-size: 0.625rem;
    color: var(--text-dim);
    margin-top: 4px;
    justify-content: flex-start;
    flex-wrap: wrap;
}
.chart-crosshair-hud__bull {
    color: var(--accent-bull);
}
.chart-crosshair-hud__bear {
    color: var(--accent-bear);
}
.chart-crosshair-hud__chg {
    font-weight: 600;
    color: var(--text-dim);
    margin-left: 4px;
}

#sidebar {
    width: min(340px, 38vw);
    min-width: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    border-left: 1px solid var(--border);
    background: var(--panel);
    padding: 10px;
    flex-shrink: 0;
}

/* ── Sidebar panels ──────────────────────────────────────── */

.panel {
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.panel-header {
    padding: 7px 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
}

.panel-body {
    padding: 10px 12px;
    font-size: 0.8125rem;
    line-height: 1.55;
}

.panel-body--scroll {
    max-height: 180px;
    overflow-y: auto;
}

.panel-body .row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}
.panel-body .row:last-child { margin-bottom: 0; }

.panel-body .label {
    color: var(--text-dim);
    flex-shrink: 0;
}
.panel-body .value {
    font-weight: 600;
    text-align: right;
}

.glance-equity {
    margin: -4px 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.glance-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    margin-bottom: 2px;
}
.glance-value {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.glance-sub {
    margin-top: 4px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.daily-meter-wrap {
    margin-bottom: 12px;
}
.daily-meter-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--text-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.daily-meter {
    position: relative;
    height: 10px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    overflow: hidden;
}
.daily-meter-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.35s ease, background 0.25s ease;
}
.daily-meter-fill.meter-mild { background: linear-gradient(90deg, #558b2f, var(--accent-amber)); }
.daily-meter-fill.meter-warn { background: linear-gradient(90deg, var(--accent-amber), #f57c00); }
.daily-meter-fill.meter-critical { background: linear-gradient(90deg, #f57c00, var(--accent-bear)); }
.daily-meter-fill.meter-profit { background: linear-gradient(90deg, #1b5e20, var(--accent-bull)); }

.green { color: var(--accent-bull); }
.red   { color: var(--accent-bear); }
.amber { color: var(--accent-amber); }

/* ── Trade detail ────────────────────────────────────────── */

.trade-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.trade-badge.long  { background: rgba(38, 166, 154, 0.22); color: var(--accent-bull); }
.trade-badge.short { background: rgba(239, 83, 80, 0.22);  color: var(--accent-bear); }

.state-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(100, 181, 246, 0.18);
    color: var(--accent-blue);
}

.trade-meta-row {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ── Setup cards ─────────────────────────────────────────── */

.setup-card {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.setup-card:last-child { border-bottom: none; }
.setup-card .setup-header { font-weight: 700; font-size: 0.8125rem; }
.setup-card .conf-bar {
    height: 5px;
    border-radius: 3px;
    background: var(--border);
    margin-top: 6px;
}
.setup-card .conf-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
}

.setup-card .setup-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}
.setup-card .setup-tf {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(100, 181, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(100, 181, 246, 0.35);
}
.setup-card .setup-scanner {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.02em;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(156, 39, 176, 0.15);
    color: #ce93d8;
    border: 1px solid rgba(156, 39, 176, 0.35);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trade-pip-row {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
    line-height: 1.4;
}
.trade-pip-row strong {
    color: var(--text);
    font-weight: 600;
}

.wave-panel-tf-current {
    font-weight: 700;
    color: var(--accent-blue);
}

/* ── Decision log footer ─────────────────────────────────── */

.log-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--panel);
    display: flex;
    flex-direction: column;
    max-height: min(220px, 28vh);
}

.log-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.log-toolbar-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    flex-shrink: 0;
}

.log-filter {
    flex: 1;
    min-width: 0;
    max-width: 280px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.75rem;
}
.log-filter:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.2);
}

.log-clear-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}
.log-clear-btn:hover { color: var(--text); border-color: var(--text-dim); }

.kbd-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    cursor: help;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px dashed var(--border);
    flex-shrink: 0;
}

.log-container-inner {
    overflow-y: auto;
    padding: 6px 14px 10px;
    font-family: 'SF Mono', ui-monospace, 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.6875rem;
    line-height: 1.55;
    flex: 1;
    min-height: 80px;
}

.log-entry {
    padding: 3px 6px;
    margin: 0 -6px;
    border-radius: 4px;
}
.log-entry:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.log-entry.filtered-out { display: none; }

.log-time  { color: var(--text-dim); margin-right: 8px; }
.log-pair  { color: var(--accent-blue); margin-right: 6px; font-weight: 600; }
.log-event { color: var(--accent-amber); margin-right: 6px; font-weight: 600; }

.log-entry.log-highlight-entry .log-event { color: var(--accent-bull); }
.log-entry.log-highlight-risk .log-event { color: var(--accent-bear); }

/* ── Overlay toggles ─────────────────────────────────────── */

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}
.toggle-row input[type="checkbox"] {
    accent-color: var(--accent-blue);
    width: 15px;
    height: 15px;
}
.toggle-row label {
    font-size: 0.75rem;
    color: var(--text-dim);
    cursor: pointer;
}

.overlay-group {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.overlay-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.overlay-group__label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.overlay-config {
    margin: -2px 0 8px 10px;
    padding-left: 10px;
    border-left: 2px solid rgba(100, 181, 246, 0.35);
}
.overlay-group .toggle-row + .overlay-config {
    margin-top: 2px;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.config-row:last-child {
    margin-bottom: 0;
}
.config-row--sessions {
    gap: 6px 10px;
}
.config-row--session-line {
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.config-chip--grow {
    flex: 1;
    min-width: 0;
}
.session-color-input {
    width: 32px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}
.session-color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}
.session-color-input::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}
.session-color-input::-moz-color-swatch {
    border-radius: 4px;
    border: none;
}
.config-row--select {
    justify-content: space-between;
    gap: 10px;
}

.config-label {
    font-size: 0.6875rem;
    color: var(--text-dim);
    flex-shrink: 0;
}

.config-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.6875rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.config-chip input {
    accent-color: var(--accent-blue);
    width: 13px;
    height: 13px;
}

.overlay-config input[type="range"] {
    flex: 1;
    min-width: 72px;
    height: 4px;
    accent-color: var(--accent-purple);
    border-radius: 2px;
}

.overlay-select {
    font-size: 0.6875rem;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    cursor: pointer;
    max-width: 140px;
}
.overlay-select:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* ── History table ───────────────────────────────────────── */

.history-table {
    width: 100%;
    font-size: 0.6875rem;
    border-collapse: collapse;
}
.history-table th {
    text-align: left;
    color: var(--text-dim);
    font-weight: 600;
    padding: 4px 4px 6px 0;
    border-bottom: 1px solid var(--border);
}
.history-table td {
    padding: 4px 4px 4px 0;
    vertical-align: top;
}
.history-table tr:hover td { background: rgba(255, 255, 255, 0.03); }
.history-summary {
    margin-top: 8px;
    font-size: 0.6875rem;
    color: var(--text-dim);
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 900px) {
    #main {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        min-width: 0;
        max-height: 42vh;
        border-left: none;
        border-top: 1px solid var(--border);
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 12px;
        align-content: start;
    }
    .panel--account { grid-column: 1 / -1; }
    .chart-context { display: none; }
    .toolbar-legend .lg-txt { display: none; }
    .toolbar-legend .lg-swatch { margin-left: 4px; }
}

@media (max-width: 560px) {
    #sidebar {
        grid-template-columns: 1fr;
        max-height: 50vh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .history-table tbody tr {
        transition: none;
    }
    .daily-meter-fill {
        transition: none;
    }
}
