/* Theme tokens come from AlgoTrading's design system (design.css). The names this file has always used
   map onto them here, so every existing page picks up the new palette without touching its rules. */
:root {
    --text-muted: var(--muted);
    --hover: var(--panel-2);
    --danger: var(--red);
    --accent-text: #ffffff;
    --shadow: var(--shadow-lg);
}

/* The chart terminal keeps TradingView's own look: same palette as the canvas (js/tradingChart.js THEMES). */
.terminal,
:root[data-theme="dark"] .terminal {
    --bg: #131722;
    --panel: #1e222d;
    --panel-2: #2a2e39;
    --border: #2a2e39;
    --text: #d1d4dc;
    --muted: #787b86;
    --text-muted: #787b86;
    --accent: #2962ff;
    --accent-bg: rgba(41, 98, 255, 0.16);
    --hover: #2a2e39;
    --red: #f23645;
    --danger: #f23645;
    --green: #089981;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    background: var(--bg);
    color: var(--text);
    font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
}

:root[data-theme="light"] .terminal {
    --bg: #ffffff;
    --panel: #ffffff;
    --panel-2: #f0f3fa;
    --border: #e0e3eb;
    --text: #131722;
    --muted: #6a6d78;
    --text-muted: #6a6d78;
    --hover: #f0f3fa;
    --shadow: 0 8px 24px rgba(19, 23, 34, 0.15);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font: 13px/1.45 "Inter Tight", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }

.terminal {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 360px;
}

/* ---------- toolbar ---------- */

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

.tb-group { display: flex; flex-wrap: wrap; gap: 1px; }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.tb-spacer { flex: 1; }

.tb-btn, .tb-select {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

.tb-btn:hover, .tb-select:hover { background: var(--hover); }
.tb-btn.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tb-btn.icon { width: 32px; justify-content: center; font-size: 16px; padding: 0; }
.tb-select { background: var(--panel); }
.fx { font-style: italic; font-weight: 600; }

.tb-menu { position: relative; }

/* Interval bar: a few recent intervals, the rest in the ▾ menu. */
.tf-bar .tf-btn { padding: 0 6px; min-width: 26px; justify-content: center; }
.tf-menu { min-width: 0; width: 232px; padding: 8px; }
.tf-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.tf-item { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.tf-item.active { border-color: var(--accent); color: var(--accent); }
.menu .tf-item button { width: auto; padding: 4px 8px; text-align: center; }
.menu .tf-item .tf-del { padding: 4px 6px; border-left: 1px solid var(--border); color: var(--text-muted); }
.menu .tf-item .tf-del:hover { color: #f23645; }
.tf-add { display: flex; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.tf-input { flex: 1; min-width: 0; height: 26px; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg, transparent); color: inherit; }
.menu .tf-plus { width: 28px; padding: 0; border: 1px solid var(--border); border-radius: 4px; text-align: center; font-weight: 600; }
.tf-error { margin-top: 6px; font-size: 12px; color: #f23645; }

.menu {
    position: absolute;
    top: 34px;
    left: 0;
    z-index: 30;
    min-width: 260px;
    padding: 4px 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.menu button {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

.menu button:hover { background: var(--hover); }

/* ---------- Kite ---------- */

.tb-menu.kite .menu { left: auto; right: 0; }
a.tb-btn { text-decoration: none; }
.tb-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.kite-connect { border: 1px solid var(--border); }
.kite-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.kite-dot.on { background: #089981; box-shadow: 0 0 0 3px color-mix(in srgb, #089981 25%, transparent); }
.kite-info { padding: 8px 14px 10px; border-bottom: 1px solid var(--border); }
.kite-user { font-weight: 600; }
.kite-id, .kite-sub { color: var(--text-muted); font-weight: 400; font-size: 12px; }

.notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: color-mix(in srgb, #089981 14%, var(--bg));
    border-bottom: 1px solid var(--border);
}
.notice.error { background: color-mix(in srgb, var(--danger) 14%, var(--bg)); }

/* ---------- symbol search ---------- */

.symbol-search { position: relative; }

.symbol-search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.symbol-input {
    width: 210px;
    height: 30px;
    padding: 0 8px 0 24px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel-2);
    font-weight: 600;
    text-transform: uppercase;
}

.symbol-input::placeholder { text-transform: none; font-weight: 400; color: var(--text-muted); }
.symbol-input:focus { outline: none; border-color: var(--accent); }

.symbol-list {
    position: absolute;
    top: 34px;
    left: 0;
    z-index: 40;
    width: min(440px, calc(100vw - 16px));
    max-height: 60vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.symbol-group {
    position: sticky;
    top: 0;
    padding: 6px 12px;
    background: var(--panel-2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.symbol-item {
    display: grid;
    grid-template-columns: minmax(130px, auto) 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 7px 12px;
    cursor: pointer;
}

.symbol-item.active { background: var(--hover); }
.symbol-name { font-weight: 600; }
.symbol-desc { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.symbol-price { text-align: right; font-variant-numeric: tabular-nums; }
.symbol-badge { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; }
.symbol-empty { padding: 12px; color: var(--text-muted); }
.symbol-empty.error { color: var(--danger); }

/* ---------- chart header ---------- */

.chart-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.ch-symbol { font-size: 15px; font-weight: 700; }
.ch-meta { color: var(--text-muted); }
.ch-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 4px 0 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
}

.chip.muted .chip-name { color: var(--text-muted); text-decoration: line-through; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; }
.chip-btn {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
}
.chip-btn:hover { background: var(--hover); color: var(--text); }

.ind-editor {
    position: absolute;
    top: 30px;
    left: 0;
    z-index: 35;
    display: grid;
    gap: 8px;
    width: 240px;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.ind-editor-title { font-weight: 600; }
.ind-editor label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); }
.ind-editor input[type="number"], .ind-editor input[type="text"] {
    width: 110px;
    height: 26px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel-2);
}
.ind-editor input[type="color"] { width: 40px; height: 24px; padding: 0; border: 0; background: none; }
.ind-editor-error { color: var(--danger); }
.ind-editor-actions { display: flex; justify-content: flex-end; gap: 6px; }

.btn {
    height: 28px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel-2);
    cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- chart ---------- */

.chart-area { position: relative; flex: 1; min-height: 0; }
.chart-host { position: absolute; inset: 0; }
.chart-canvas { position: absolute; inset: 0; }

.chart-legend {
    position: absolute;
    top: 6px;
    left: 10px;
    z-index: 5;
    pointer-events: none;
    font-size: 12px;
    color: var(--text);
}

.chart-legend .lg-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; line-height: 20px; }
.chart-legend .lg-time { color: var(--text-muted); }
.chart-legend b { font-weight: 500; font-variant-numeric: tabular-nums; }

.chart-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 10;
    transform: translate(-50%, -50%);
    max-width: 80%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    box-shadow: var(--shadow);
    text-align: center;
}
.chart-overlay[hidden] { display: none; }
.chart-overlay[data-kind="error"] { color: var(--danger); }

/* ---------- small screens ---------- */

@media (max-width: 700px) {
    .toolbar { padding: 4px; }
    .symbol-input { width: 150px; }
    .tb-sep { display: none; }
    .tb-btn { padding: 0 6px; }
}

#blazor-error-ui {
    background: lightyellow;
    color: #000;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- Kite dropdown summary ---------- */

.kite-menu { width: 300px; }
.kite-summary { display: grid; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.ks-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ks-label { color: var(--text-muted); font-size: 12px; }
.ks-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.ks-pnl { margin-left: 6px; font-weight: 500; }
.ks-orders { display: flex; flex-wrap: wrap; gap: 4px; }
.ks-badge { padding: 1px 6px; border-radius: 3px; font-size: 11px; background: var(--panel-2); color: var(--text-muted); }
.ks-badge.open { color: #2962ff; }
.ks-badge.done { color: #089981; }
.ks-badge.rejected { color: var(--danger); }
.kite-loading { color: var(--text-muted); }
.kite-error { color: var(--danger); }
.menu .menu-link { display: block; padding: 8px 14px; text-decoration: none; color: inherit; }
.menu .menu-link:hover { background: var(--hover); }
.menu .menu-link.primary { color: var(--accent); font-weight: 600; }
.pos { color: #089981; }
.neg { color: var(--danger); }

/* ---------- account page ---------- */

.account-page { display: flex; flex-direction: column; min-height: 100%; }
.acc-title { font-weight: 700; font-size: 15px; }
.acc-user { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.acc-body { padding: 16px; display: grid; gap: 16px; align-content: start; max-width: 1400px; width: 100%; margin: 0 auto; }
.acc-empty { padding: 32px; text-align: center; color: var(--text-muted); display: grid; gap: 12px; justify-items: center; }
.acc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.acc-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); display: grid; gap: 4px; }
.acc-big { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.acc-tabs, .acc-subtabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.acc-subtabs { border: 0; }
.acc-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.acc-panel { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); padding: 12px 16px; }
.acc-panel h3 { margin: 0 0 8px; font-size: 14px; }
.acc-kv { width: 100%; border-collapse: collapse; }
.acc-kv th { text-align: left; font-weight: 400; color: var(--text-muted); padding: 4px 0; }
.acc-kv td { text-align: right; font-variant-numeric: tabular-nums; padding: 4px 0; }
.acc-kv tr.sep th, .acc-kv tr.sep td { border-top: 1px solid var(--border); padding-top: 8px; }
.acc-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.acc-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.acc-table th, .acc-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.acc-table thead th { color: var(--text-muted); font-weight: 500; font-size: 12px; background: var(--panel); position: sticky; top: 0; }
.acc-table tfoot th { font-weight: 600; border-bottom: 0; }
.acc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.acc-table tr.closed td { color: var(--text-muted); }
.acc-table tbody tr:hover { background: var(--hover); }
.tag { font-size: 11px; padding: 1px 5px; border-radius: 3px; background: var(--panel-2); color: var(--text-muted); }
.side { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.side.buy { color: #2962ff; background: color-mix(in srgb, #2962ff 14%, transparent); }
.side.sell { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.status { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; background: var(--panel-2); }
.status.completed { color: #089981; }
.status.rejected { color: var(--danger); }
.status.open { color: #2962ff; }
.status.cancelled { color: var(--text-muted); }
.status-msg { white-space: normal; max-width: 320px; }
.account-page a.tb-btn { color: inherit; }

/* ---------- symbol search: scope + inline completion ---------- */

.symbol-search { display: flex; align-items: center; gap: 4px; }
.scope-toggle { display: inline-flex; height: 30px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.scope-btn { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border: 0; background: transparent; cursor: pointer; font-size: 12px; }
.scope-btn + .scope-btn { border-left: 1px solid var(--border); }
.scope-btn:hover { background: var(--hover); }
.scope-btn.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 600; }
.symbol-field { position: relative; height: 30px; border-radius: 4px; background: var(--panel-2); }
.symbol-field .symbol-input { position: relative; z-index: 1; background: transparent; }
.symbol-ghost {
    position: absolute;
    inset: 0;
    padding: 0 8px 0 25px;
    display: flex;
    align-items: center;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.7;
}
.symbol-ghost .typed { color: transparent; }
.symbol-item mark { background: none; color: var(--accent); font-weight: 700; }
.symbol-empty .btn { display: inline-flex; align-items: center; margin-top: 8px; text-decoration: none; }
.ch-live { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; color: #fff; background: #089981; border-radius: 3px; padding: 1px 5px; }
.symbol-field .symbol-search-icon { z-index: 2; }

/* ---------- bottom bar (Go to) ---------- */

.chart-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px;
    border-top: 1px solid var(--border);
    background: var(--panel);
    font-size: 12px;
}
.chart-footer .tb-btn { height: 26px; }
.goto { position: relative; }
.goto-popover {
    position: absolute;
    bottom: 32px;
    left: 0;
    z-index: 35;
    display: grid;
    gap: 8px;
    width: 260px;
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow);
}
.goto-title { font-weight: 600; }
.goto-popover label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); }
.goto-popover input { height: 28px; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); }
.goto-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-btn.wide { width: auto; height: 22px; padding: 0 8px; border-radius: 11px; border: 1px solid var(--border); font-size: 11px; }
.goto-msg { color: var(--text-muted); }
.footer-tz { color: var(--text-muted); }
.footer-auto { font-weight: 600; color: var(--text-muted); }
.footer-auto.active { color: var(--accent); }
.chart-footer .tb-sep { height: 16px; }

/* ---------- adaptive SuperTrend ---------- */
.ind-editor select { height: 26px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); padding: 0 4px; }
.ind-editor-note { font-size: 11px; color: var(--text-muted); line-height: 1.35; }
.chart-legend .lg-vol { font-size: 10px; padding: 0 5px; border-radius: 3px; background: var(--panel-2); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.chart-legend .lg-vol-high { color: #f23645; }
.chart-legend .lg-vol-medium { color: #ff9800; }
.chart-legend .lg-vol-low { color: #089981; }

/* ---------- crypto / Delta ---------- */
.ch-crypto { font-size: 10px; font-weight: 700; color: #f7931a; border: 1px solid #f7931a; border-radius: 3px; padding: 0 4px; }
.tb-group .tb-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.delta-dot { background: #fd7d02; }

/* ---------- trade panel ---------- */
.workspace { display: flex; flex: 1; min-height: 0; }
.workspace .chart-area { flex: 1; min-width: 0; }
.trade-panel {
    width: 300px;
    flex: none;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 10px 12px;
    border-left: 1px solid var(--border);
    background: var(--panel);
}
.tp-head { display: flex; justify-content: space-between; align-items: center; }
.tp-title { font-weight: 700; }
.tp-note { padding: 8px 10px; border-radius: 6px; background: var(--panel-2); font-size: 12px; display: grid; gap: 8px; }
.tp-note.warn { background: color-mix(in srgb, var(--danger) 14%, var(--panel)); }
.tp-note.ok { background: color-mix(in srgb, #089981 16%, var(--panel)); }
.tp-quote { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-variant-numeric: tabular-nums; }
.tp-side { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tp-side button { height: 34px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); cursor: pointer; font-weight: 600; }
.tp-side .tp-buy.active { background: #089981; border-color: #089981; color: #fff; }
.tp-side .tp-sell.active { background: #f23645; border-color: #f23645; color: #fff; }
.tp-kind { display: flex; gap: 4px; }
.tp-field { display: grid; gap: 4px; color: var(--text-muted); font-size: 12px; }
.tp-field input { height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); font-variant-numeric: tabular-nums; }
.tp-inline { display: flex; gap: 6px; align-items: center; }
.tp-inline input { flex: 1; min-width: 0; }
.tp-notional { margin-top: -6px; }
.tp-checks { display: flex; gap: 14px; font-size: 12px; }
.tp-submit { height: 38px; font-weight: 700; color: #fff; border: 0; }
.tp-submit.buy, .btn.buy { background: #089981; color: #fff; border-color: #089981; }
.tp-submit.sell, .btn.sell { background: #f23645; color: #fff; border-color: #f23645; }
.tp-submit:disabled { opacity: 0.45; cursor: not-allowed; }
.tp-section { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.tp-section-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.tp-pos { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.tp-order { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.tp-order .chip-btn { margin-left: auto; }
.tp-modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); }
.tp-modal { width: min(380px, calc(100vw - 32px)); display: grid; gap: 12px; padding: 16px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); }
.tp-modal-title { font-weight: 700; font-size: 15px; }
@media (max-width: 700px) {
    .workspace { flex-direction: column; }
    .trade-panel { width: auto; border-left: 0; border-top: 1px solid var(--border); max-height: 50vh; }
}

/* ---------- chart right-click menu ---------- */
.ctx-menu { position: fixed; top: 0; left: 0; z-index: 60; min-width: 220px; }
.ctx-head { padding: 6px 14px; font-weight: 700; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.ctx-note { padding: 6px 14px; font-size: 11px; color: var(--danger); max-width: 260px; }
.menu .ctx-buy { color: #089981; font-weight: 600; }
.menu .ctx-sell { color: #f23645; font-weight: 600; }
.menu button:disabled { opacity: 0.45; cursor: not-allowed; }
.ctx-sep { height: 1px; margin: 4px 0; background: var(--border); }
.ind-editor label.ind-check { justify-content: flex-start; }
/* A long sound name must shrink inside the popover instead of pushing past its edge. */
.ind-editor label.ind-sound select { flex: 1; min-width: 0; max-width: 170px; text-overflow: ellipsis; }

/* ---------- research ---------- */

.rs-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.rs-hero-card { text-decoration: none; color: inherit; gap: 8px; }
.rs-hero-card:hover { border-color: var(--accent); }
.rs-hero-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rs-hero-title { font-weight: 600; font-size: 15px; }
.rs-hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rs-hero-summary { white-space: normal; }
.rs-targets { font-size: 15px; }
.rs-status { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.03em; background: var(--panel-2); color: var(--text-muted); }
.rs-status.winner { color: #089981; background: color-mix(in srgb, #089981 16%, transparent); }
.rs-status.runner-up { color: #2962ff; background: color-mix(in srgb, #2962ff 16%, transparent); }
.rs-status.candidate { color: #e08a00; background: color-mix(in srgb, #f7a600 16%, transparent); }
.rs-status.rejected { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.rs-badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 3px; background: var(--panel-2); white-space: nowrap; }
.rs-badge.ok { color: #089981; background: color-mix(in srgb, #089981 14%, transparent); }
.rs-badge.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.rs-badge.warn { color: #e08a00; background: color-mix(in srgb, #f7a600 14%, transparent); }
.rs-row { cursor: pointer; }
.rs-row.focused td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rs-link { color: inherit; font-weight: 600; text-decoration: none; }
.rs-link:hover { color: var(--accent); }
.rs-rounds { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.rs-rounds .kite-sub { white-space: normal; }
.rs-round-name { font-weight: 600; }
.rs-steps { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.rs-cmd { display: block; margin-top: 4px; padding: 6px 8px; border-radius: 4px; background: var(--panel-2); font-size: 12px; overflow-x: auto; white-space: nowrap; }
.rs-summary { margin: 0; color: var(--text-muted); }
.rs-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rs-charts-panel { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); padding: 8px 12px 12px; display: grid; gap: 8px; }
.rs-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.rs-legend .tb-btn { margin-left: auto; }
.rs-dot { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 4px; }
.rs-dot.up { background: #089981; }
.rs-dot.down { background: #f23645; }
.rs-charts { display: grid; gap: 10px; min-height: 120px; }
.rs-chart-title { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.rs-chart-box { width: 100%; }
.rs-hint { margin-left: 8px; align-self: center; }
.rs-trades { max-height: 560px; overflow-y: auto; }
.rs-rules { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.rs-key { word-break: break-all; margin-top: 8px; }
.rs-sub { margin-top: 12px !important; }
.rs-weak { margin: 0; padding-left: 18px; font-size: 12px; display: grid; gap: 4px; }
.rs-heat-wrap { overflow-x: auto; }
.rs-heat { border-collapse: separate; border-spacing: 1px; font-size: 10px; font-variant-numeric: tabular-nums; }
.rs-heat th { color: var(--text-muted); font-weight: 500; padding: 2px 4px; white-space: nowrap; }
.rs-heat td { color: #fff; text-align: center; min-width: 30px; height: 22px; padding: 0 2px; }
.rs-heat td.pass { outline: 2px solid #fff; outline-offset: -3px; }
.rs-heat td.chosen { outline: 3px solid var(--text); outline-offset: -2px; font-weight: 700; }
.rs-heat td.weak { outline: 2px dashed #ff6b6b; outline-offset: -3px; }
.rs-heat-metric { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.rs-nb th:first-child { text-align: left; }
.rs-nb td { min-width: 56px; height: 26px; font-size: 11px; }
.rs-nb-table { margin-top: 10px; }
.rs-nb-table summary { cursor: pointer; color: var(--text-muted); font-size: 12px; }
.rs-nb-weak td { color: #ff8a8a; }

@media (max-width: 640px) {
    .rs-hero { grid-template-columns: 1fr; }
    .rs-hero-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- price alerts ---------- */

.menu .ctx-alert { color: #f7a600; font-weight: 600; }
.ctx-note.muted { color: var(--text-muted); }
.alerts-menu { left: 0; right: auto; width: min(360px, calc(100vw - 16px)); max-height: 75vh; overflow-y: auto; padding: 4px 0; }
.alerts-section { padding: 8px 14px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.alerts-section:last-child { border-bottom: 0; }
.alerts-title { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); display: flex; justify-content: space-between; }
.alert-row { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.alert-row .chip-btn:first-of-type { margin-left: auto; }
.alert-row.fired { opacity: 0.75; }
.alert-sym { font-weight: 600; }
.alert-kinds { display: flex; gap: 14px; }
.alert-kinds label, .alert-controls label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.alert-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.alert-controls input[type=number] { width: 56px; background: var(--panel-2); color: inherit; border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px; }
.alert-input { width: 100%; background: var(--panel-2); color: inherit; border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; }
.alert-input:focus { outline: none; border-color: var(--accent); }
.alert-file { font-size: 12px; }
.alert-actions { display: flex; gap: 8px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 12px; text-transform: none; letter-spacing: 0; padding: 0; }
.alert-toasts { position: fixed; right: 16px; bottom: 48px; z-index: 80; display: grid; gap: 8px; max-width: min(520px, calc(100vw - 32px)); }
.alert-toast { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--panel); border: 1px solid #f7a600; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); font-variant-numeric: tabular-nums; }
.alert-toast > span { flex: 1; }
.alert-yt { position: fixed; left: 16px; bottom: 48px; z-index: 81; background: #000; border: 1px solid #f7a600; border-radius: 8px; padding: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); }
/* The stop button sits in its own bar above the video so the player can never cover it. */
.alert-yt-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px 4px; color: #f7a600; font-size: 12px; }
.alert-yt-close { height: 24px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; }
.alert-yt-close:hover { border-color: #f7a600; }
.alert-time { width: 72px; background: var(--panel-2); color: inherit; border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; font-variant-numeric: tabular-nums; }
.alert-time:focus { outline: none; border-color: var(--accent); }
.rs-tracks { align-items: center; }
.rs-tracks a.tb-btn { color: inherit; font-weight: 600; }
.rs-track-blurb { margin-left: 12px; }
.rs-sections { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0 0; }
.rs-sections a { padding: 4px 12px; border-radius: 14px; color: var(--text-muted); text-decoration: none; font-weight: 600; border: 1px solid var(--border); }
.rs-sections a.active { color: var(--text); border-color: var(--accent, #2962ff); background: color-mix(in srgb, var(--accent, #2962ff) 12%, transparent); }
.rs-sections a:hover { color: var(--text); }
.rs-sections .rs-empty-tab { opacity: 0.6; }
.rs-convert { white-space: nowrap; }
.rs-convert[disabled] { opacity: 0.5; cursor: not-allowed; }
.rs-views { display: flex; gap: 4px; margin: 8px 0 12px; border-bottom: 1px solid var(--border); }
.rs-views a { padding: 6px 14px; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.rs-views a.active { color: var(--text); border-bottom-color: var(--accent, #2962ff); }
.rs-views a:hover { color: var(--text); }
.rs-md { max-width: 1100px; line-height: 1.55; }
.rs-md-src { margin-bottom: 6px; }
.rs-md h2 { font-size: 20px; margin: 4px 0 10px; }
.rs-md h3 { font-size: 16px; margin: 22px 0 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.rs-md h4, .rs-md h5 { font-size: 14px; margin: 16px 0 6px; }
.rs-md p { margin: 8px 0; }
.rs-md ul, .rs-md ol { margin: 6px 0 10px; padding-left: 22px; }
.rs-md li { margin: 3px 0; }
.rs-md code { font: 12px ui-monospace, Consolas, monospace; background: var(--panel-2, rgba(127,127,127,.15)); padding: 1px 4px; border-radius: 3px; }
.rs-md pre { background: var(--panel-2, rgba(127,127,127,.15)); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.rs-md pre code { background: none; padding: 0; }
.rs-md-img { display: block; width: 104px; height: auto; }
.rs-md-table { overflow-x: auto; margin: 10px 0; }
.rs-md-table table { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rs-md-table th, .rs-md-table td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; vertical-align: top; }
.rs-md-table th { background: var(--panel-2, rgba(127,127,127,.12)); font-weight: 600; white-space: nowrap; }

/* ---------- alert form + saved sounds ---------- */

.alert-modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); }
.alert-modal { width: min(440px, calc(100vw - 32px)); display: grid; gap: 12px; padding: 16px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45); }
.alert-modal-head { display: flex; align-items: baseline; gap: 10px; }
.alert-modal-head h3 { margin: 0; font-size: 15px; }
.alert-field { display: grid; gap: 4px; color: var(--text-muted); font-size: 12px; }
.alert-field .alert-input { color: var(--text); font-size: 13px; }
select.alert-input { cursor: pointer; }
.alert-new-sound { display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--border); border-radius: 6px; }
.alert-modal-actions { align-items: center; }
.alert-sound-tag { font-size: 11px; color: var(--text-muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-row { align-items: flex-start; }
.sound-name { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sound-name > span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-name .rs-badge { margin-left: 6px; }
.alert-add { display: grid; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--border); }
.alert-row .chip-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------- draggable alert lines ---------- */

.alert-handles { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.alert-handle {
    position: absolute; left: 8px; transform: translateY(-50%); pointer-events: auto; cursor: ns-resize; user-select: none;
    display: inline-flex; align-items: center; gap: 4px; padding: 1px 2px 1px 7px; border-radius: 4px;
    background: #f7a600; color: #131722; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); touch-action: none; white-space: nowrap;
}
.alert-handle[data-pos="middle"] { left: 50%; transform: translate(-50%, -50%); }
.alert-handle[data-pos="right"] { left: auto; }
.alert-handle.dragging { box-shadow: 0 0 0 2px rgba(247, 166, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.45); }
.alert-handle-gear { border: 0; background: rgba(19, 23, 34, 0.15); color: inherit; border-radius: 3px; cursor: pointer; font-size: 12px; line-height: 1; padding: 2px 4px; }
.alert-handle-gear:hover { background: rgba(19, 23, 34, 0.3); }
.alert-line-hover, .alert-line-hover * { cursor: ns-resize !important; }
body.alert-dragging, body.alert-dragging * { cursor: ns-resize !important; user-select: none; }

/* ---------- landing page (skinned background + sign in) ---------- */

/* Each skin sets the panel's colours and type; the moving background is drawn by js/landing.js. */
.mx-page {
    --sk-bg: #000; --sk-acc: 0, 255, 102; --sk-text: #b8ffcf; --sk-bright: #e6ffe6; --sk-dim: #5fdc8e; --sk-foot: #3fae6a;
    --sk-panel: rgba(0, 12, 4, 0.82); --sk-input: rgba(0, 0, 0, 0.7); --sk-font: ui-monospace, "Cascadia Mono", Consolas, monospace;
    --sk-radius: 10px; --sk-glow: 1; --sk-blur: 2px; --sk-case: lowercase; --sk-btn-case: uppercase;
    position: fixed; inset: 0; background: var(--sk-bg); display: grid; place-items: center; overflow: auto; padding: 16px; font-family: var(--sk-font);
}
.mx-page[data-skin="market"] {
    --sk-bg: #0b0e14; --sk-acc: 41, 98, 255; --sk-text: #d1d4dc; --sk-bright: #ffffff; --sk-dim: #8b93a7; --sk-foot: #6b7280;
    --sk-panel: rgba(19, 23, 34, 0.9); --sk-input: #0f131c; --sk-font: system-ui, "Segoe UI", Roboto, sans-serif;
    --sk-radius: 12px; --sk-glow: 0; --sk-blur: 6px; --sk-case: none; --sk-btn-case: none;
}
.mx-page[data-skin="amber"] {
    --sk-bg: #0a0700; --sk-acc: 255, 176, 0; --sk-text: #ffcf70; --sk-bright: #fff1cc; --sk-dim: #c98f1c; --sk-foot: #9a6c12;
    --sk-panel: rgba(12, 8, 0, 0.9); --sk-input: #000; --sk-radius: 2px; --sk-glow: 0.7; --sk-blur: 0px; --sk-case: uppercase;
}
.mx-page[data-skin="aurora"] {
    --sk-bg: #070814; --sk-acc: 167, 139, 250; --sk-text: #e5e7f5; --sk-bright: #ffffff; --sk-dim: #a5a9c8; --sk-foot: #8187ad;
    --sk-panel: rgba(255, 255, 255, 0.07); --sk-input: rgba(255, 255, 255, 0.06); --sk-font: system-ui, "Segoe UI", Roboto, sans-serif;
    --sk-radius: 20px; --sk-glow: 0.4; --sk-blur: 18px; --sk-case: none; --sk-btn-case: none;
}
.mx-page[data-skin="network"] {
    --sk-bg: #020617; --sk-acc: 56, 189, 248; --sk-text: #cbe7f7; --sk-bright: #f0f9ff; --sk-dim: #7aa7c2; --sk-foot: #5b7d93;
    --sk-panel: rgba(2, 6, 23, 0.82); --sk-input: rgba(15, 23, 42, 0.9); --sk-font: system-ui, "Segoe UI", Roboto, sans-serif;
    --sk-radius: 14px; --sk-glow: 0.6; --sk-blur: 4px; --sk-case: none; --sk-btn-case: none;
}
#mx-bg { position: fixed; inset: 0; z-index: 0; }
/* Amber terminal: CRT scanlines over the board. */
.mx-page[data-skin="amber"]::after {
    content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
}
.mx-panel {
    position: relative; z-index: 1; width: min(420px, 100%); display: grid; gap: 14px; padding: 26px 24px 20px;
    background: var(--sk-panel); border: 1px solid rgba(var(--sk-acc), 0.45); border-radius: var(--sk-radius); color: var(--sk-text);
    box-shadow: 0 0 calc(40px * var(--sk-glow)) rgba(var(--sk-acc), 0.18), 0 20px 50px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(var(--sk-blur)); -webkit-backdrop-filter: blur(var(--sk-blur));
}
.mx-page[data-skin="aurora"] .mx-panel { border-color: rgba(255, 255, 255, 0.16); }
.mx-brand { text-align: center; display: grid; gap: 4px; }
.mx-logo { color: rgb(var(--sk-acc)); font-size: 22px; letter-spacing: -2px; text-shadow: 0 0 calc(10px * var(--sk-glow)) rgb(var(--sk-acc)); }
.mx-page[data-skin="market"] .mx-logo { letter-spacing: 0; }
.mx-page[data-skin="market"] .mx-logo span:first-child { color: #26a69a; }
.mx-page[data-skin="market"] .mx-logo span:last-child { color: #ef5350; }
.mx-title { margin: 0; font-size: 26px; color: var(--sk-bright); letter-spacing: 1px;
    text-shadow: 0 0 calc(8px * var(--sk-glow)) rgba(var(--sk-acc), 0.8), 0 0 calc(22px * var(--sk-glow)) rgba(var(--sk-acc), 0.35); }
.mx-page[data-skin="aurora"] .mx-title {
    background: linear-gradient(90deg, #c4b5fd, #67e8f9, #f9a8d4); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none;
}
.mx-tag { margin: 0; font-size: 11px; color: var(--sk-dim); text-transform: var(--sk-case); letter-spacing: 0.5px; }
.mx-note { font-size: 12px; color: rgb(var(--sk-acc)); border-left: 2px solid rgb(var(--sk-acc)); padding: 4px 8px; background: rgba(var(--sk-acc), 0.06); }
.mx-tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid rgba(var(--sk-acc), 0.35); border-radius: calc(var(--sk-radius) * 0.6); overflow: hidden; }
.mx-tabs a { text-align: center; padding: 8px; color: var(--sk-dim); text-decoration: none; font-size: 13px; }
.mx-tabs a.active { background: rgba(var(--sk-acc), 0.16); color: var(--sk-bright); font-weight: 700; }
.mx-tabs a:hover { color: var(--sk-bright); }
.mx-msg { font-size: 12px; padding: 6px 8px; border-radius: 4px; background: rgba(var(--sk-acc), 0.08); color: var(--sk-text); }
.mx-msg.err { background: rgba(255, 60, 60, 0.12); color: #ff9a9a; border-left: 2px solid #ff5c5c; }
.mx-form { display: grid; gap: 12px; }
.mx-form label { display: grid; gap: 4px; font-size: 11px; color: var(--sk-dim); text-transform: var(--sk-case); }
.mx-form input:not([type=checkbox]) {
    background: var(--sk-input); border: 1px solid rgba(var(--sk-acc), 0.35); border-radius: calc(var(--sk-radius) * 0.4); padding: 9px 10px;
    color: var(--sk-bright); font: 14px var(--sk-font); caret-color: rgb(var(--sk-acc));
}
.mx-form input:focus { outline: none; border-color: rgb(var(--sk-acc)); box-shadow: 0 0 0 2px rgba(var(--sk-acc), 0.25); }
.mx-form .mx-check { display: flex; align-items: center; gap: 8px; text-transform: none; font-size: 12px; cursor: pointer; }
.mx-form .mx-check input { accent-color: rgb(var(--sk-acc)); }
.mx-form button {
    margin-top: 4px; padding: 10px; border: 1px solid rgb(var(--sk-acc)); border-radius: calc(var(--sk-radius) * 0.4); background: rgba(var(--sk-acc), 0.14);
    color: var(--sk-bright); font: 700 14px var(--sk-font); letter-spacing: 1px; cursor: pointer; text-transform: var(--sk-btn-case);
}
.mx-page[data-skin="market"] .mx-form button { background: rgb(var(--sk-acc)); letter-spacing: 0.3px; }
.mx-page[data-skin="aurora"] .mx-form button { background: linear-gradient(90deg, #7c3aed, #0ea5e9); border: 0; letter-spacing: 0.3px; }
.mx-form button:hover { background: rgba(var(--sk-acc), 0.28); box-shadow: 0 0 14px rgba(var(--sk-acc), 0.35); }
.mx-page[data-skin="market"] .mx-form button:hover { background: #1e53e5; }
.mx-page[data-skin="aurora"] .mx-form button:hover { background: linear-gradient(90deg, #7c3aed, #0ea5e9); filter: brightness(1.12); }
.mx-hint { margin: 0; font-size: 11px; color: var(--sk-dim); }
.mx-foot { font-size: 10px; color: var(--sk-foot); text-align: center; }
.mx-skins { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: center; font-size: 10px; color: var(--sk-foot); }
.mx-skins button {
    border: 1px solid rgba(var(--sk-acc), 0.3); background: transparent; color: var(--sk-dim); border-radius: 999px; padding: 3px 9px;
    font: 11px var(--sk-font); cursor: pointer;
}
.mx-skins button[aria-pressed="true"] { background: rgba(var(--sk-acc), 0.2); color: var(--sk-bright); border-color: rgb(var(--sk-acc)); }
.mx-skins button:hover { color: var(--sk-bright); }
@media (prefers-reduced-motion: reduce) { .mx-form button:hover { box-shadow: none; } }
.users-form { display: grid; gap: 8px; max-width: 360px; }
.users-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.account-menu { right: 0; left: auto; min-width: 200px; }
.account-menu form { margin: 0; }
.account-logout { width: 100%; text-align: left; border: 0; background: none; color: var(--danger); font: inherit; cursor: pointer; }
.rs-download .rs-dl-contract { width: 220px; }


/* ---------- app frame: left rail or top bar, bottom bar on phones (Components/Layout/AppShell.razor) ---------- */

.shell { display: grid; height: 100vh; height: 100dvh; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.shell-main { min-width: 0; min-height: 0; overflow: auto; position: relative; }
.shell-top, .shell-bottom { display: none; }
:root[data-nav="top"] .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); }
:root[data-nav="top"] .shell-rail { display: none; }
:root[data-nav="top"] .shell-top { display: flex; }

.shell-icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.shell-icon.sm { width: 16px; height: 16px; }
.shell-logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #2962ff, #26a69a);
    color: #fff; font-weight: 800; font-size: 13px; letter-spacing: -1px; text-decoration: none; flex: none; }
.shell-avatar { width: 30px; height: 30px; border-radius: 50%; background: #7c3aed; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.shell-avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.shell-badge { position: absolute; top: 4px; right: 4px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--danger);
    color: #fff; font-size: 10px; line-height: 15px; font-weight: 700; text-align: center; }
.shell-badge.warn { background: #f0b90b; color: #131722; }
.shell-badge.inline { position: static; display: inline-block; }
.shell-grow { flex: 1; }

/* left rail */
.shell-rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; background: var(--panel); border-right: 1px solid var(--border); z-index: 20; }
.shell-rail .shell-logo { margin-bottom: 10px; }
.rail-btn { position: relative; width: 40px; height: 40px; border: 0; background: none; border-radius: 8px; color: var(--text-muted);
    display: grid; place-items: center; cursor: pointer; text-decoration: none; padding: 0; }
.rail-btn:hover { background: var(--panel-2); color: var(--text); }
.rail-btn.active { color: var(--accent); background: rgba(41, 98, 255, .16); }
.rail-btn.active::before { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-tip { position: absolute; left: 48px; top: 50%; transform: translateY(-50%); background: var(--text); color: var(--bg); padding: 4px 8px;
    border-radius: 4px; font-size: 12px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 50; }
.rail-tip kbd { font: inherit; opacity: .7; margin-left: 4px; }
.rail-btn:hover .rail-tip, .rail-btn:focus-visible .rail-tip { opacity: 1; }
.rail-sep { width: 28px; height: 1px; background: var(--border); margin: 6px 0; }
.rail-spacer { flex: 1; }

/* top bar */
.shell-top { align-items: center; gap: 2px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--border); min-width: 0; overflow-x: auto; z-index: 20; }
.shell-top::-webkit-scrollbar { display: none; }
.shell-top .shell-logo { width: 28px; height: 28px; font-size: 11px; margin-right: 8px; }
.shell-brand { font-weight: 700; margin-right: 12px; color: var(--text); text-decoration: none; white-space: nowrap; }
.top-tab { display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 11px; color: var(--text-muted); text-decoration: none; white-space: nowrap;
    border-bottom: 2px solid transparent; }
.top-tab:hover { color: var(--text); }
.top-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.shell-search { display: flex; align-items: center; gap: 8px; min-width: 200px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg); color: var(--text-muted); cursor: pointer; margin-right: 6px; white-space: nowrap; }
.shell-search kbd { margin-left: auto; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; font-family: inherit; }
.shell-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted);
    font-size: 12px; text-decoration: none; white-space: nowrap; margin-right: 4px; }
.shell-pill:hover { color: var(--text); background: var(--panel-2); }
.top-icon { border: 0; background: none; color: var(--text-muted); padding: 6px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.top-icon:hover { background: var(--panel-2); color: var(--text); }

/* account menu */
.shell-menu { position: fixed; z-index: 1000; min-width: 240px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: var(--shadow); padding: 6px; display: none; }
.shell-menu.open { display: block; }
.shell-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.shell-menu-head small { color: var(--text-muted); display: block; }
.shell-menu a, .shell-menu button[role="menuitem"] { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 7px 10px;
    border-radius: 5px; cursor: pointer; text-align: left; color: var(--text); text-decoration: none; font: inherit; }
.shell-menu a:hover, .shell-menu button[role="menuitem"]:hover { background: var(--panel-2); }
.shell-menu .r { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.shell-menu .danger { color: var(--danger); }
.shell-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.shell-menu form { margin: 0; }
.shell-menu-label { font-size: 11px; color: var(--text-muted); padding: 4px 10px 2px; text-transform: uppercase; letter-spacing: .5px; }
.shell-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px 10px 8px; }
.shell-seg button { display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: none; color: var(--text-muted);
    border-radius: 6px; padding: 5px 0; cursor: pointer; font: inherit; }
.shell-seg button[aria-checked="true"] { border-color: var(--accent); color: var(--accent); background: rgba(41, 98, 255, .12); font-weight: 600; }

/* Ctrl+K palette */
.palette-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1100; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette-bg[hidden] { display: none; }
.palette { width: min(580px, 92vw); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.palette input { width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font-size: 15px; outline: none; }
.palette-list { padding: 6px; max-height: 55vh; overflow: auto; }
.palette-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px 4px; letter-spacing: .5px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.palette-item.sel, .palette-item:hover { background: rgba(41, 98, 255, .14); }
.palette-item small { margin-left: auto; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }

/* phones: bottom tab bar instead of the rail / top bar */
@media (max-width: 760px) {
    .shell, :root[data-nav="top"] .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 58px; }
    .shell-rail, :root[data-nav="top"] .shell-top { display: none; }
    .shell-bottom { display: flex; background: var(--panel); border-top: 1px solid var(--border); z-index: 20; }
    .shell-bottom a, .shell-bottom button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 3px; color: var(--text-muted); font-size: 11px; position: relative; text-decoration: none; cursor: pointer; font-family: inherit; }
    .shell-bottom .active { color: var(--accent); }
    .shell-bottom .shell-badge { top: 6px; right: auto; left: 54%; }
}

/* ---------- positions & orders ---------- */

.pf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.pf-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pf-tabs button { border: 0; background: none; padding: 8px 14px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.pf-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.pf-tabs .count { font-size: 10px; background: var(--panel-2); border-radius: 8px; padding: 0 6px; margin-left: 4px; color: var(--text-muted); }
.pf-broker { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 12px; }
.pf-state { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-dock { border-top: 1px solid var(--border); background: var(--panel); flex: none; display: flex; flex-direction: column; }
.pf-dock-bar { display: flex; align-items: center; gap: 2px; padding: 0 6px; height: 32px; }
.pf-dock-bar .pf-tabs { border-bottom: 0; flex-wrap: nowrap; }
.pf-dock-bar .pf-tabs button { padding: 0 10px; height: 32px; }
.pf-dock-body { height: 180px; overflow: auto; border-top: 1px solid var(--border); }
.pf-dock-body table td, .pf-dock-body table th { padding: 5px 10px; font-size: 12px; white-space: nowrap; }
.pf-row-current td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.pf-sym { color: inherit; text-decoration: none; }
.pf-sym:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 760px) {
    /* Phones: the chart toolbar is one row that scrolls sideways instead of wrapping over the chart. */
    .terminal > .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .terminal > .toolbar::-webkit-scrollbar { display: none; }
    .terminal > .toolbar > * { flex: none; }
    .pf-dock-bar > .kite-sub { display: none; }
}

/* ── Drawing tools (left bar, floating properties, cursors) ───────────────── */
.draw-bar { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 44px; padding: 6px 0; flex: none;
    border-right: 1px solid var(--border); background: var(--panel); overflow-y: auto; }
.draw-btn { display: grid; place-items: center; width: 34px; height: 32px; border: 0; border-radius: 6px; background: transparent;
    color: var(--text); cursor: pointer; opacity: 0.85; }
.draw-btn:hover { background: var(--hover, rgba(127, 127, 127, 0.15)); opacity: 1; }
.draw-btn.active { background: var(--accent-bg, rgba(41, 98, 255, 0.15)); color: var(--accent, #2962ff); opacity: 1; }
.draw-btn.danger.active { background: rgba(242, 54, 69, 0.15); color: #f23645; }
.draw-sep { width: 24px; height: 1px; margin: 4px 0; background: var(--border); }
.chart-canvas.drawing-tool, .chart-canvas.drawing-tool * { cursor: crosshair !important; }
.chart-canvas.drawing-hover, .chart-canvas.drawing-hover * { cursor: pointer !important; }
.chart-canvas.drawing-hover-handle, .chart-canvas.drawing-hover-handle *,
.chart-canvas.drawing-drag, .chart-canvas.drawing-drag * { cursor: move !important; }
.drawing-props { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 4px;
    padding: 4px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
.drawing-props[hidden] { display: none; }
.drawing-swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.drawing-swatch.on { border-color: var(--text); }
.drawing-swatch[hidden] { display: none; }
.drawing-btn { min-width: 28px; height: 24px; padding: 0 6px; border: 1px solid var(--border); border-radius: 5px; background: transparent;
    color: var(--text); font-size: 12px; cursor: pointer; }
.drawing-btn:hover { background: var(--hover, rgba(127, 127, 127, 0.15)); }
.drawing-btn.danger:hover { color: #f23645; }
.drawing-btn[hidden] { display: none; }
@media (max-width: 700px) {
    .draw-bar { flex-direction: row; width: auto; height: 40px; padding: 0 6px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; }
    .draw-sep { width: 1px; height: 20px; margin: 0 4px; }
}
.draw-bar.collapsed { width: 24px; padding: 4px 0; overflow: hidden; }
.draw-bar.collapsed .draw-btn { width: 20px; }
.draw-fold { height: 22px; opacity: 0.6; }
@media (max-width: 700px) { .draw-bar.collapsed { width: auto; height: 28px; } .draw-bar.collapsed .draw-btn { width: 28px; height: 24px; } }
.rs-tracks .rs-empty-tab { opacity: 0.6; }

/* Super research: one account for the SOL and ETH legs and their retracement sleeves */
.sr-settings { display: grid; gap: 18px; }
.sr-block h3 { margin: 0 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.sr-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; align-items: end; }
.sr-fields label, .sr-sleeves th { font-size: 12px; color: var(--text-muted); }
.sr-fields label { display: grid; gap: 4px; }
.sr-fields input[type=number], .sr-sleeves select, .sr-sleeves input[type=number] { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; width: 100%; box-sizing: border-box; }
.sr-fields input[type=number]:focus, .sr-sleeves select:focus, .sr-sleeves input:focus { outline: none; border-color: var(--accent); }
.sr-split { grid-column: span 2; }
.sr-split input[type=range] { width: 100%; accent-color: var(--accent); }
.sr-fields .sr-check { display: flex; align-items: center; gap: 8px; align-self: center; }
.sr-block + .sr-block { padding-top: 16px; border-top: 1px solid var(--border); }
.sr-sleeves { border-collapse: separate; border-spacing: 12px 8px; margin: -8px -12px; }
.sr-sleeves th { text-align: left; font-weight: 500; white-space: nowrap; }
.sr-sleeves tbody th { font-size: 13px; font-weight: 600; color: var(--text); }
.sr-sleeves td { min-width: 130px; }
.sr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.sr-actions p { margin: 0; flex: 1 1 320px; }
.sr-recalc { height: 34px; padding: 0 20px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.sr-recalc:hover:not(:disabled) { filter: brightness(1.1); }
.sr-recalc:disabled { opacity: .5; cursor: default; box-shadow: none; }
.sr-warn { margin: 0; color: var(--danger); }
.sr-open { margin: 4px 0; }
.sr-chart { display: grid; gap: 8px; }
.sr-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--text-muted); }
.sr-sw { display: inline-block; width: 18px; height: 3px; margin-right: 6px; vertical-align: middle; background: currentColor; }
.sr-svg { width: 100%; height: auto; display: block; }
.sr-lanes { margin-top: 4px; }
.sr-grid-line { stroke: var(--border); stroke-width: 1; }
.sr-axis { fill: var(--text-muted); font-size: 10px; }
.sr-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.sr-acct { stroke: var(--accent); color: var(--accent); }
.sr-buck { stroke: var(--green); color: var(--green); }
.sr-none { stroke: var(--muted); color: var(--muted); stroke-dasharray: 5 4; }
.sr-wdline { stroke: var(--green); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.sr-wdot { fill: var(--green); }
.sr-win { fill: var(--green); }
.sr-loss { fill: var(--red); }
.sr-bar { opacity: .85; }
.sr-bar-r { opacity: .95; }
.sr-table .sr-retr td { background: color-mix(in srgb, var(--accent) 6%, transparent); color: var(--text-muted); }
.sr-table .sr-retr td:first-child { padding-left: 28px; }
.sr-table .sr-wdrow td { background: color-mix(in srgb, var(--green) 14%, transparent); font-size: 12px; }
.sr-tag { display: inline-block; padding: 1px 6px; border: 1px solid var(--border); border-radius: 10px; font-size: 11px; }
.sr-logrow td { white-space: normal; background: var(--bg); }
.sr-log { list-style: none; margin: 0; padding: 4px 0 4px 12px; display: grid; gap: 3px; font-size: 12px; }
.sr-log time { color: var(--text-muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.sr-log .sr-l1 { margin-left: 24px; border-left: 2px solid var(--accent); padding-left: 8px; }
.sr-log .sr-k-entry, .sr-log .sr-k-sleeveentry { font-weight: 600; }
.sr-log .sr-k-exit, .sr-log .sr-k-sleeveexit { font-weight: 600; }
.sr-log .sr-k-candle { color: var(--text-muted); font-family: ui-monospace, Consolas, monospace; }
.sr-log .sr-k-partial { color: var(--green); }
.sim { display: grid; gap: 12px; }
.sim-note { margin: 12px 0 0; }
.sim-part { margin: 4px 0 8px; }
.sim .sr-fields select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; width: 100%; box-sizing: border-box; }
.sim-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.sim-filters label { display: grid; gap: 4px; font-size: 12px; color: var(--text-muted); }
.sim-filters select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.sim-filters .kite-sub { flex: 1 1 240px; align-self: center; }
.sim .acc-table .pos { color: var(--green); }
.sim .acc-table .neg { color: var(--red); }
.sim-stops-on { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.sim-stopped { margin: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.sim-stopped.fired { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.sim-stoprow td { background: color-mix(in srgb, var(--accent) 10%, transparent); font-size: 12px; white-space: normal; }
.sim-stoprow.fired td { background: color-mix(in srgb, var(--red) 18%, transparent); }
.sim-stopline { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 3; opacity: .6; }
.sim-stopline.fired { stroke: var(--red); stroke-width: 2; stroke-dasharray: none; opacity: 1; }
.sim-danger { color: var(--red); border-color: var(--red); }
.sim-wrap { white-space: normal; min-width: 260px; }
.sleeve-from-research { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; margin-bottom: 12px; }
.sleeve-from-research label { display: grid; gap: 4px; font-size: 12px; color: var(--text-muted); flex: 1 1 280px; }
.sleeve-from-research select, .main-from-research { max-width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
.main-from-research { width: 220px; }
.sim-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.sim-fieldset:disabled input { opacity: .6; }
.sim-save { margin-top: 14px; }

/* Strategy snapshot: main and retracement state per leg, with a replay range */
.snap-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 14px; }
.snap-bar label { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.snap-card { border: 1px solid var(--border, #2a2e39); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.snap-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.snap-title { font-weight: 600; }
.snap-pills { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.snap-sleeve { border-left: 2px solid var(--border, #2a2e39); padding-left: 12px; margin: 12px 0 8px; }
.snap-line { font-size: 13px; margin: 4px 0; }
.snap-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.snap-table th, .snap-table td { padding: 5px 8px; text-align: left; border-top: 1px solid var(--border, #2a2e39); }
.snap-table th { color: var(--muted, #868993); font-weight: 400; border-top: none; }
.snap-table .num { text-align: right; }
.snap-table tr.snap-open td { background: rgba(245, 158, 11, 0.08); }
.snap-tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(120, 130, 160, 0.18); }

/* Goals: the six-step wizard and the list */
.goal-steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.goal-step { flex: 1; min-width: 96px; text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; background: rgba(120, 130, 160, 0.12); color: var(--muted, #868993); cursor: pointer; font-size: 12px; }
.goal-step b { font-weight: 500; }
.goal-step.on { border-color: #2962ff; background: rgba(41, 98, 255, 0.14); color: #5b8def; }
.goal-step.done b::after { content: " ✓"; color: #089981; }
.goal-step:disabled { opacity: 0.5; cursor: default; }
.goal-panel, .goal-item { border: 1px solid var(--border, #2a2e39); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.goal-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.goal-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.goal-card { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border, #2a2e39); background: transparent; color: inherit; cursor: pointer; font-size: 12px; }
.goal-card b { font-weight: 600; }
.goal-card span { color: var(--muted, #868993); }
.goal-card.sel { border: 2px solid #2962ff; }
.goal-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.goal-metrics > div { background: rgba(120, 130, 160, 0.1); border-radius: 8px; padding: 8px 10px; }
.goal-metrics span, .goal-metrics small { display: block; font-size: 11px; color: var(--muted, #868993); }
.goal-metrics b { font-size: 15px; font-weight: 600; }
.goal-timeline { display: flex; height: 24px; border-radius: 6px; overflow: hidden; margin: 10px 0; font-size: 11px; }
.goal-timeline i { display: flex; align-items: center; justify-content: center; font-style: normal; padding: 0 6px; white-space: nowrap; overflow: hidden; }
.goal-timeline .build { background: rgba(41, 98, 255, 0.2); }
.goal-timeline .pay { background: rgba(8, 153, 129, 0.25); }
.goal-nav, .goal-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.goal-nav { justify-content: space-between; }
.goal-verdict { margin: 4px 0 8px; }
.goal-chart { margin: 6px 0; }
.goal-chart .axis { stroke: var(--border, #2a2e39); }
.goal-chart .pot { stroke: #2962ff; stroke-width: 2; }
.goal-chart .start { stroke: #868993; stroke-dasharray: 4 3; }
.goal-chart-wrap { margin: 6px 0; }
.goal-chart { display: block; height: 130px; }
.goal-chart-axis { position: relative; height: 52px; font-size: 11px; color: #868993; }
.goal-chart-axis span { position: absolute; top: 2px; white-space: nowrap; }
.goal-chart-axis span.mid { top: 17px; }
.goal-chart-axis span.out { top: 32px; color: #f23645; }
.goal-list { display: grid; gap: 12px; }

/* Renko settings popover (chart toolbar) */
.renko-menu { min-width: 280px; padding: 10px 12px; }
.renko-title { font-weight: 600; margin-bottom: 4px; }
.renko-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin: 8px 0; }
.renko-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-muted); }
.renko-grid input, .renko-grid select { height: 28px; font-size: 12px; }
.renko-grid input[type=color] { padding: 0 2px; }
.renko-grid .renko-check { flex-direction: row; align-items: center; gap: 6px; }
.renko-grid .renko-check input { height: auto; }
.renko-error { color: #f23645; font-size: 12px; margin: 4px 0; }
.renko-actions { display: flex; justify-content: flex-end; gap: 6px; }

/* ---------- watchlist ---------- */
.watchlist { width: 340px; flex: none; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border); background: var(--panel); font-size: 13px; }
.wl-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.wl-title { font-weight: 700; }
.wl-ico { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.wl-ico:hover { background: var(--panel-2); color: var(--text); }
.wl-ico.danger { color: var(--red); }
.wl-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.wl-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); padding: 6px 10px; cursor: pointer; white-space: nowrap; font-size: 13px; }
.wl-tabs button:hover { color: var(--text); }
.wl-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.wl-tabs .wl-plus { margin-left: auto; font-size: 16px; padding: 4px 10px; }
.wl-body { flex: 1; min-height: 0; overflow-y: auto; }
.wl-sec { display: flex; justify-content: space-between; padding: 8px 12px 4px; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-top: 1px solid var(--border); }
.wl-sec:first-child { border-top: 0; }
.wl-spot { text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.wl-empty, .wl-hint, .wl-notice { padding: 14px 12px; color: var(--text-muted); font-size: 12px; }
.wl-notice { padding: 6px 12px; color: var(--red); }
.wl-listbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 0 12px; }
.wl-listname { flex: 1; font-weight: 600; }
.wl-count { color: var(--text-muted); font-weight: 400; font-size: 11px; margin-left: 4px; }
.wl-rename { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--accent); border-radius: 4px; background: var(--panel-2); color: var(--text); }
.wl-add { padding: 6px 8px; }
.wl-add .symbol-search { width: 100%; flex-wrap: wrap; }
.wl-add .symbol-field { flex: 1; min-width: 0; }
.wl-add .symbol-input { width: 100%; }
.wl-item { border-top: 1px solid var(--border); }
.wl-item.current { background: var(--accent-bg); }
.wl-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 58px 70px 82px; gap: 6px; align-items: center; padding: 9px 12px; cursor: pointer; }
.wl-row:hover { background: var(--hover); }
.wl-row.off { cursor: default; opacity: .75; }
.wl-name { min-width: 0; }
.wl-sym { font-size: 14px; }
.wl-row.up .wl-sym, .wl-row.up .wl-last { color: var(--green); }
.wl-row.dn .wl-sym, .wl-row.dn .wl-last { color: var(--red); }
.wl-kind { margin-left: 5px; font-size: 10px; color: var(--text-muted); }
.wl-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-chg, .wl-pct, .wl-last { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wl-chg { color: var(--text-muted); font-size: 12px; }
.wl-pct { font-size: 12px; }
.wl-row.up .wl-pct { color: var(--green); }
.wl-row.dn .wl-pct { color: var(--red); }
.wl-bar { display: none; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); gap: 4px; align-items: center; padding: 3px; background: var(--panel); border-radius: 6px; box-shadow: var(--shadow); z-index: 2; }
.wl-row:hover .wl-bar, .wl-bar:focus-within { display: flex; }
.wl-bar button { border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.wl-bar button:hover:not(:disabled) { border-color: var(--accent); }
.wl-bar .wl-b { background: #3d7be0; border-color: #3d7be0; color: #fff; font-weight: 600; }
.wl-bar .wl-s { background: #d9602f; border-color: #d9602f; color: #fff; font-weight: 600; }
.wl-bar button:disabled { background: var(--panel-2); border-color: var(--border); color: var(--text-muted); cursor: not-allowed; }
.wl-menu { position: absolute; right: 6px; top: calc(100% - 4px); width: 210px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); z-index: 5; padding: 4px 0; cursor: default; }
.wl-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 7px 14px; cursor: pointer; font-size: 13px; }
.wl-menu button:hover { background: var(--hover); }
.wl-menu .danger { color: var(--red); }
.wl-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.wl-depth { padding: 8px 12px 12px; background: var(--bg); border-top: 1px solid var(--border); }
.wl-depth-head { display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); font-size: 11px; margin-bottom: 4px; }
.wl-depth table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 12px; }
.wl-depth th { color: var(--text-muted); font-weight: 400; font-size: 10.5px; text-align: right; padding: 2px 4px; }
.wl-depth td { text-align: right; padding: 3px 4px; position: relative; }
.wl-depth .l { text-align: left; padding-left: 10px; }
.wl-depth .bid { color: #6fa8ff; }
.wl-depth .ask { color: #ff9a62; }
.wl-depth .bar { position: absolute; top: 2px; bottom: 2px; opacity: .2; z-index: 0; }
.wl-depth .bar.b { right: 0; background: #3d7be0; }
.wl-depth .bar.a { left: 0; background: #d9602f; }
.wl-depth td span { position: relative; z-index: 1; }
.wl-total { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin: 8px 0 3px; background: #d9602f; }
.wl-total i { display: block; background: #3d7be0; }
.wl-total-text { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.wl-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.wl-stats span { display: block; color: var(--text-muted); font-size: 10.5px; }
.wl-foot { display: flex; justify-content: space-between; padding: 7px 12px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 11px; }
.wl-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 5px; }
.wl-dot.on { background: var(--green); }
.wl-last.flash-u0 { animation: wl-up0 .9s ease-out; } .wl-last.flash-u1 { animation: wl-up1 .9s ease-out; }
.wl-last.flash-d0 { animation: wl-dn0 .9s ease-out; } .wl-last.flash-d1 { animation: wl-dn1 .9s ease-out; }
@keyframes wl-up0 { 0% { background: rgba(8, 153, 129, .45); } 100% { background: transparent; } }
@keyframes wl-up1 { 0% { background: rgba(8, 153, 129, .45); } 100% { background: transparent; } }
@keyframes wl-dn0 { 0% { background: rgba(242, 54, 69, .45); } 100% { background: transparent; } }
@keyframes wl-dn1 { 0% { background: rgba(242, 54, 69, .45); } 100% { background: transparent; } }

.wl-hintline { color: var(--text-muted); font-size: 11px; }
.wl-page .watchlist { width: 360px; max-width: 100%; height: 100%; border-left: 0; border-right: 1px solid var(--border); }
.wl-page { position: absolute; inset: 0; display: flex; justify-content: flex-start; background: var(--bg); }
.wl-link { position: absolute; inset: 0; z-index: 1; }
.wl-bar { z-index: 2; }
.wl-bar a { border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 12px; text-decoration: none; }
.wl-bar a:hover { border-color: var(--accent); }
.wl-bar a.wl-b { background: #3d7be0; border-color: #3d7be0; color: #fff; font-weight: 600; }
.wl-bar a.wl-s { background: #d9602f; border-color: #d9602f; color: #fff; font-weight: 600; }
.wl-menu a { display: block; text-align: left; color: var(--text); padding: 7px 14px; font-size: 13px; text-decoration: none; }
.wl-menu a:hover { background: var(--hover); }
.wl-menu { z-index: 5; }
.wl-ticks { margin-left: 4px; font-variant-numeric: tabular-nums; }
