/* ==========================================================================
   Spot Scanner — dark exchange-style theme
   ========================================================================== */

:root {
    --bg: #0b0e11;
    --bg-2: #12161c;
    --card: #181a20;
    --card-2: #1e2329;
    --hover: #2b3139;
    --line: #2b3139;
    --line-soft: #22272e;

    --text: #eaecef;
    --text-2: #b7bdc6;
    --muted: #848e9c;
    --faint: #5e6673;

    --brand: #f0b90b;
    --brand-2: #fcd535;
    --brand-ink: #181a20;
    --up: #0ecb81;
    --down: #f6465d;
    --warn: #f0b90b;
    --info: #3d8bfd;

    --up-bg: rgba(14, 203, 129, 0.12);
    --down-bg: rgba(246, 70, 93, 0.12);
    --warn-bg: rgba(240, 185, 11, 0.12);
    --info-bg: rgba(61, 139, 253, 0.12);

    --radius: 12px;
    --radius-sm: 8px;
    --sidebar: 248px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.warn { color: var(--warn); }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--hover); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
    display: flex; flex-direction: column;
    background: var(--bg-2); border-right: 1px solid var(--line-soft);
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .65rem;
    height: 64px; padding: 0 1.25rem; border-bottom: 1px solid var(--line-soft);
    color: var(--text); font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em;
}
.sidebar-brand:hover { color: var(--text); }
.logo {
    width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand-2), var(--brand));
    color: var(--brand-ink); box-shadow: 0 4px 14px rgba(240, 185, 11, .25);
}
.logo svg { width: 18px; height: 18px; stroke: var(--brand-ink); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-brand small { display: block; font-size: .68rem; font-weight: 500; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.nav { padding: 1rem .75rem; display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: .75rem .75rem .4rem; font-size: .68rem; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .62rem .75rem; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; font-size: .9rem;
    background: none; border: 0; width: 100%; cursor: pointer; font-family: inherit; text-align: left;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--card-2); color: var(--text); }
.nav-item.active { background: var(--card-2); color: var(--text); box-shadow: inset 3px 0 0 var(--brand); }
.nav-item.active svg { color: var(--brand); }

.sidebar-foot { margin-top: auto; padding: .9rem; border-top: 1px solid var(--line-soft); display: grid; gap: .75rem; }
.mini-market {
    padding: .8rem .9rem; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line-soft);
}
.mini-market .row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.mini-market .lbl { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mini-market .sym { font-weight: 600; font-size: .85rem; }
.mini-market .meta { margin-top: .35rem; font-size: .75rem; color: var(--muted); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar); display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30; height: 64px;
    display: flex; align-items: center; gap: 1rem; padding: 0 1.75rem;
    background: rgba(11, 14, 17, .85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-soft);
}
.topbar h1 { margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }
.topbar .crumb { color: var(--muted); font-size: .8rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.menu-toggle { display: none; background: none; border: 0; color: var(--text); cursor: pointer; padding: .4rem; border-radius: 8px; }
.menu-toggle:hover { background: var(--card-2); }
.clock { font-family: var(--mono); font-size: .78rem; color: var(--muted); padding: .35rem .65rem; border: 1px solid var(--line-soft); border-radius: 999px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up); margin-right: .4rem; box-shadow: 0 0 0 3px var(--up-bg); vertical-align: middle; }

.content { padding: 1.5rem 1.75rem 3rem; max-width: 1480px; width: 100%; }

.backdrop { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h2 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card {
    background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
    margin-bottom: 1.25rem;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { margin: 0; font-size: .98rem; font-weight: 600; display: flex; align-items: center; gap: .55rem; }
.card-head p { margin: .15rem 0 0; color: var(--muted); font-size: .8rem; }
.card-body { padding: 1.1rem 1.25rem; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat {
    background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
    padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center;
}
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--card-2); color: var(--text-2); }
.stat-icon.brand { background: var(--warn-bg); color: var(--brand); }
.stat-icon.up { background: var(--up-bg); color: var(--up); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }
.stat-label { font-size: .75rem; color: var(--muted); }
.stat-value { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; font-family: var(--mono); line-height: 1.25; }
.stat-sub { font-size: .72rem; color: var(--muted); }

/* ---------- Market hero ---------- */
.market {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; gap: 0;
    background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
    margin-bottom: 1.25rem;
}
.market::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--muted); }
.market.is-bullish::before { background: var(--up); }
.market.is-bearish::before { background: var(--down); }
.market.is-neutral::before { background: var(--warn); }
.market-cell { padding: 1.1rem 1.35rem; border-right: 1px solid var(--line-soft); }
.market-cell:last-child { border-right: 0; }
.market-cell .lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .45rem; display: flex; gap: .4rem; align-items: center; }
.market-state { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: .55rem; }
.market-state.bullish { color: var(--up); }
.market-state.bearish { color: var(--down); }
.market-state.neutral { color: var(--warn); }
.market-state.unknown, .market-state.off { color: var(--muted); }
.market-note { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.big-num { font-family: var(--mono); font-size: 1.3rem; font-weight: 600; }

.gauge { position: relative; height: 6px; border-radius: 999px; margin-top: .7rem;
    background: linear-gradient(90deg, var(--down) 0%, var(--down) 30%, #3a3f47 30%, #3a3f47 70%, var(--up) 70%, var(--up) 100%); opacity: .9; }
.gauge-pin { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--text);
    border: 2px solid var(--card); transform: translate(-50%, -50%); box-shadow: 0 0 0 2px rgba(255,255,255,.15); }
.gauge-scale { display: flex; justify-content: space-between; font-size: .66rem; color: var(--faint); margin-top: .35rem; font-family: var(--mono); }

.ema-row { display: flex; justify-content: space-between; font-size: .82rem; padding: .18rem 0; }
.ema-row span:first-child { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    height: 38px; padding: 0 1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
    background: var(--brand); color: var(--brand-ink); font-family: inherit; font-weight: 600; font-size: .87rem;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s, opacity .15s; white-space: nowrap; vertical-align: middle;
}
.btn:hover { background: var(--brand-2); color: var(--brand-ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: var(--card-2); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-sm { height: 30px; padding: 0 .7rem; font-size: .78rem; border-radius: 7px; }
.btn-link { background: none; border: 0; color: var(--text-2); padding: 0 .4rem; height: auto; }
.btn-link:hover { background: none; color: var(--brand); }
.btn .spinner { width: 14px; height: 14px; border: 2px solid rgba(24,26,32,.3); border-top-color: var(--brand-ink); border-radius: 50%; animation: spin .7s linear infinite; display: none; }
.btn.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem; height: 22px; padding: 0 .55rem; border-radius: 6px;
    font-size: .72rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap; background: var(--card-2); color: var(--text-2);
}
.badge-up, .badge-pass, .badge-bullish { background: var(--up-bg); color: var(--up); }
.badge-down, .badge-fail, .badge-bearish { background: var(--down-bg); color: var(--down); }
.badge-warn, .badge-neutral { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-unknown, .badge-off { background: var(--card-2); color: var(--muted); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; border-radius: 6px; background: var(--card-2);
    font-size: .74rem; color: var(--text-2); font-family: var(--mono); white-space: nowrap; }
.chip b { color: var(--muted); font-weight: 500; font-family: var(--font); }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; padding: .7rem 1.25rem; font-size: .72rem; font-weight: 500; color: var(--muted);
    text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line-soft); white-space: nowrap; background: var(--card);
}
td { padding: .8rem 1.25rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(43, 49, 57, .45); }
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }

.pair { display: flex; align-items: center; gap: .7rem; }
.coin {
    width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
    font-size: .66rem; font-weight: 700; color: #fff; letter-spacing: -.02em;
}
.pair-name { font-weight: 600; }
.pair-name small { color: var(--muted); font-weight: 400; }

.score { display: flex; align-items: center; gap: .6rem; min-width: 130px; }
.score-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.score-fill { height: 100%; border-radius: inherit; background: var(--down); }
.score-fill.mid { background: var(--warn); }
.score-fill.high { background: var(--up); }
.score-num { font-family: var(--mono); font-size: .78rem; color: var(--text-2); min-width: 36px; text-align: right; }

.fail-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.fail-list span { font-size: .74rem; color: var(--text-2); background: var(--down-bg); color: #f7a1ad; padding: .1rem .45rem; border-radius: 5px; }
.fail-list .more { background: var(--card-2); color: var(--muted); }

/* ---------- Empty state ---------- */
.empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--muted); }
.empty-icon { width: 46px; height: 46px; border-radius: 12px; margin: 0 auto .8rem; display: grid; place-items: center; background: var(--card-2); color: var(--faint); }
.empty strong { display: block; color: var(--text-2); margin-bottom: .25rem; font-weight: 600; }
.empty p { margin: 0; font-size: .85rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; padding: .25rem; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; }
.tab {
    border: 0; background: none; color: var(--muted); font-family: inherit; font-size: .82rem; font-weight: 600;
    padding: .4rem .85rem; border-radius: 7px; cursor: pointer; display: inline-flex; gap: .4rem; align-items: center;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--card-2); color: var(--text); }
.tab .count { font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Progress ---------- */
.scan-progress { display: none; padding: 1rem 1.25rem; }
.scan-progress.visible { display: block; }
.progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--card-2); }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .35s ease; }
.progress-copy { display: flex; justify-content: space-between; gap: 1rem; margin-top: .55rem; color: var(--muted); font-size: .8rem; }
.progress-copy #scan-progress-count { font-family: var(--mono); }

/* ---------- Alerts ---------- */
.flash { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-radius: var(--radius-sm);
    background: var(--up-bg); color: var(--up); border: 1px solid rgba(14, 203, 129, .25); margin-bottom: 1.25rem; font-size: .88rem; }
.error { color: var(--down); font-size: .84rem; margin-top: .6rem; }

/* ---------- Forms ---------- */
.field label.lbl { display: block; font-size: .8rem; font-weight: 500; color: var(--text-2); margin-bottom: .35rem; }
.field .key { font-family: var(--mono); font-size: .68rem; color: var(--faint); margin-left: .3rem; font-weight: 400; }
.input, .field input[type=text], .field input[type=number], .field input[type=email], .field input[type=password] {
    width: 100%; height: 40px; padding: 0 .8rem; border-radius: var(--radius-sm);
    background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
    font-family: var(--mono); font-size: .86rem; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(240, 185, 11, .15); }
.textarea { height: auto; padding: .6rem .8rem; line-height: 1.6; resize: vertical; }
.field:has(.textarea) { grid-column: 1 / -1; }
.field .hint { font-size: .74rem; color: var(--muted); margin-top: .3rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem 1.25rem; }

.switch { position: relative; display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; color: var(--text-2); font-size: .85rem; user-select: none; }
.switch input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--hover); position: relative; transition: background .18s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--brand-ink); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(240, 185, 11, .25); }

.settings-nav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; position: sticky; top: 64px; z-index: 5; padding: .6rem 0; background: var(--bg); }
.settings-nav a { padding: .38rem .8rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line-soft); color: var(--text-2); font-size: .8rem; font-weight: 500; }
.settings-nav a:hover { color: var(--text); border-color: var(--line); }

.save-bar {
    position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 1rem;
    padding: .9rem 1.25rem; margin-top: 1rem; border-radius: var(--radius);
    background: rgba(24, 26, 32, .92); backdrop-filter: blur(8px); border: 1px solid var(--line-soft); box-shadow: var(--shadow);
}
.save-bar span { color: var(--muted); font-size: .82rem; margin-right: auto; }

/* ---------- Strategy cards ---------- */

/* ---------- Result detail ---------- */
.detail-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.detail-head .coin { width: 46px; height: 46px; font-size: .85rem; }
.detail-head h2 { margin: 0; font-size: 1.5rem; }
.kv { display: grid; grid-template-columns: minmax(130px, 40%) 1fr; }
.kv div { padding: .62rem 1.25rem; border-bottom: 1px solid var(--line-soft); font-size: .86rem; word-break: break-word; }
.kv div:nth-child(odd) { color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.kv div:nth-child(even) { font-family: var(--mono); }
.kv div:nth-last-child(-n+2) { border-bottom: 0; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: .85rem; align-items: flex-start; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line-soft); }
.checklist li:last-child { border-bottom: 0; }
.check-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.check-ic.pass { background: var(--up-bg); color: var(--up); }
.check-ic.fail { background: var(--down-bg); color: var(--down); }
.check-ic svg { width: 14px; height: 14px; stroke-width: 2.6; }
.checklist .title { font-weight: 500; }
.checklist .reason { font-family: var(--mono); font-size: .76rem; color: var(--muted); margin-top: .15rem; }

/* ---------- Login ---------- */
.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background:
        radial-gradient(800px 400px at 50% -10%, rgba(240, 185, 11, .08), transparent 60%),
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 40px 40px,
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 40px 40px,
        var(--bg);
}
.auth-card { width: 100%; max-width: 410px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); }
.auth-card .brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; font-size: 1.15rem; margin-bottom: 1.5rem; }
.auth-card h1 { margin: 0 0 .3rem; font-size: 1.4rem; letter-spacing: -.02em; }
.auth-card .sub { margin: 0 0 1.5rem; color: var(--muted); font-size: .88rem; }
.auth-card form { display: grid; gap: 1rem; }
.auth-card .btn { height: 44px; width: 100%; font-size: .95rem; }
.check { display: flex; gap: .5rem; align-items: center; color: var(--text-2); font-size: .85rem; }
.check input { accent-color: var(--brand); }

/* ---------- Prediction ---------- */
.small { font-size: .78rem; }
.toolbar { gap: .75rem; }
.search { position: relative; flex: 1 1 240px; max-width: 340px; }
.search svg.icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search .input { padding-left: 2.2rem; font-family: var(--font); }
.search .input::-webkit-search-cancel-button { filter: invert(.6); }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 30px; padding: 0 .75rem; border: 0; border-radius: 6px; background: none; color: var(--muted); font: 500 .8rem var(--font); cursor: pointer; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--card-2); color: var(--brand); box-shadow: inset 0 0 0 1px var(--line); }

.select, select.input {
    appearance: none; -webkit-appearance: none; width: 100%; height: 40px; padding: 0 2rem 0 .8rem; border-radius: var(--radius-sm);
    background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23848e9c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .7rem center;
    border: 1px solid var(--line); color: var(--text); font: .86rem var(--font); cursor: pointer;
}
.select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(240, 185, 11, .15); }
.select option { background: var(--card); }
.select-sm { height: 32px; width: auto; font-size: .78rem; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: "↕"; margin-left: .35rem; opacity: .35; font-size: .7rem; }
th.sortable.asc::after { content: "↑"; opacity: 1; color: var(--brand); }
th.sortable.desc::after { content: "↓"; opacity: 1; color: var(--brand); }
th.sortable.asc, th.sortable.desc { color: var(--text); }
.coins-table td { padding-top: .65rem; padding-bottom: .65rem; }
#coins-body { transition: opacity .15s; }
#coins-body.is-loading { opacity: .45; }
.table-msg { text-align: center; padding: 2.5rem 1rem !important; color: var(--muted); }
.spin-sm { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: .4rem; }
.predict-btn svg.icon { width: 15px; height: 15px; }

.rsi-pill { display: inline-flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.rsi-track { width: 46px; height: 4px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.rsi-fill { display: block; height: 100%; background: var(--muted); border-radius: inherit; }
.rsi-fill.up { background: var(--up); }
.rsi-fill.down { background: var(--down); }
.rsi-pill .num { min-width: 34px; text-align: right; font-size: .82rem; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .8rem 1.25rem; border-top: 1px solid var(--line-soft); }
.pager-info { color: var(--text-2); font-size: .8rem; }
.pager-info b { color: var(--text); font-weight: 600; }
.pager-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.pages { display: flex; gap: .25rem; align-items: center; }
.page-btn { min-width: 32px; height: 32px; padding: 0 .55rem; border-radius: 7px; border: 1px solid var(--line); background: var(--card-2); color: var(--text-2); font: 500 .8rem var(--mono); cursor: pointer; }
.page-btn:hover:not([disabled]) { background: var(--hover); color: var(--text); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.page-btn[disabled] { opacity: .35; cursor: not-allowed; }
.page-gap { color: var(--faint); padding: 0 .2rem; }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(920px, 100%);
    background: var(--bg-2); border-left: 1px solid var(--line); box-shadow: var(--shadow);
    transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column;
}
body.drawer-open { overflow: hidden; }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1.25rem; height: 64px; border-bottom: 1px solid var(--line-soft); flex: none; }
.drawer-head .coin { width: 36px; height: 36px; font-size: .72rem; }
.drawer-head .pair-name { font-size: 1.05rem; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.drawer-body { overflow-y: auto; padding: 1.25rem; flex: 1; }

.pred-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem 1rem; padding: 1rem; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.pred-form .field .hint { min-height: 1em; }
.pred-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.pred-actions .btn { min-width: 170px; }
.pred-actions .btn.loading svg.icon { display: none; }

#pred-result { margin-top: 1.1rem; transition: opacity .2s; }
#pred-result.is-stale { opacity: .45; pointer-events: none; }
.pred-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.pstat { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .85rem 1rem; min-width: 0; }
.pstat-value { font-size: 1.12rem; font-weight: 600; margin: .2rem 0 .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pstat-value small { color: var(--muted); font-weight: 400; }
.pstat-value .range-val { white-space: normal; font-size: .98rem; line-height: 1.35; display: block; }
.pstat-value:has(.range-val) { overflow: visible; }
.stat-sub { font-size: .74rem; color: var(--muted); }

.chart-card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .8rem .8rem .4rem; margin-bottom: 1rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .74rem; color: var(--muted); padding: 0 .3rem .6rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend i { display: inline-block; width: 16px; height: 10px; border-radius: 2px; }
.lg-line { height: 2px !important; background: var(--text); }
.lg-median { height: 0 !important; border-top: 2px dashed var(--brand); }
.lg-b50 { background: rgba(240, 185, 11, .32); }
.lg-b90 { background: rgba(240, 185, 11, .13); }
.lg-tp { height: 0 !important; border-top: 2px dashed var(--up); }
.lg-sl { height: 0 !important; border-top: 2px dashed var(--down); }
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { fill: var(--faint); font: 10.5px var(--mono); }
.chart .future-zone { fill: rgba(240, 185, 11, .025); }
.chart .b90 { fill: rgba(240, 185, 11, .13); }
.chart .b50 { fill: rgba(240, 185, 11, .30); }
.chart .sim { fill: none; stroke: rgba(234, 236, 239, .16); stroke-width: 1; }
.chart .hist { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; }
.chart .median { fill: none; stroke: var(--brand); stroke-width: 2; stroke-dasharray: 6 4; }
.chart .lvl-tp, .chart .lvl-sl { stroke-width: 1.2; stroke-dasharray: 4 4; }
.chart .lvl-tp { stroke: var(--up); }
.chart .lvl-sl { stroke: var(--down); }
.chart .tag-tp { fill: var(--up); }
.chart .tag-sl { fill: var(--down); }
.chart .tag-text { fill: #0b0e11; font: 600 9.5px var(--mono); }
.chart .now { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart .now-label { fill: var(--muted); font: 600 9.5px var(--font); letter-spacing: .06em; }
.chart .now-dot { fill: var(--brand); stroke: var(--bg-2); stroke-width: 2; }
.chart .hover-x { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hover-dot { fill: var(--text); stroke: var(--bg-2); stroke-width: 2; }
.chart-tip { position: absolute; display: none; pointer-events: none; z-index: 2; min-width: 170px; padding: .55rem .7rem; border-radius: 8px;
    background: rgba(30, 35, 41, .97); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .76rem; }
.tip-time { color: var(--muted); margin-bottom: .3rem; font-size: .72rem; }
.tip-row { display: flex; justify-content: space-between; gap: 1rem; color: var(--text-2); }
.tip-row b { font: 500 .78rem var(--mono); color: var(--text); }
.tip-row.median b { color: var(--brand); }
.tip-row em { font-style: normal; margin-left: .3rem; }

.pred-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.pred-box { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.pred-box h4 { margin: 0 0 .8rem; font-size: .9rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.pred-box h4 svg.icon { color: var(--brand); width: 16px; height: 16px; }
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .42rem 0; border-bottom: 1px dashed var(--line-soft); font-size: .82rem; }
.kv-row:last-child { border-bottom: 0; }
.kv-row > span:first-child { color: var(--text-2); display: inline-flex; align-items: center; gap: .45rem; }
.kv-row .num { text-align: right; }
.prob-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--card-2); margin-bottom: .7rem; }
.prob-bar span { display: block; height: 100%; }
.pb-tp, .sw-tp { background: var(--up); }
.pb-sl, .sw-sl { background: var(--down); }
.pb-none, .sw-none { background: var(--hover); }
.sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.bt-text { margin: 0 0 .9rem; font-size: .82rem; color: var(--text-2); line-height: 1.6; }
.bt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.bt-cell { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: .7rem .8rem; }
.bt-value { font-size: 1.05rem; font-weight: 600; margin: .15rem 0; }
.disclaimer { font-size: .74rem; color: var(--faint); line-height: 1.6; margin: .25rem 0 0; }

@media (max-width: 900px) {
    .pred-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pred-stats, .bt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pred-grid { grid-template-columns: minmax(0, 1fr); }
    .hide-sm { display: none; }
}
@media (max-width: 600px) {
    .drawer-body { padding: 1rem .8rem; }
    .pred-actions .btn { width: 100%; }
    .search { max-width: none; }
    .pager { padding: .8rem .9rem; }
}

/* ---------- Settings list (label left, control right; always aligned) ---------- */
.setting-list { display: flex; flex-direction: column; }
.setting-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: center;
    padding: .95rem 1.25rem; border-bottom: 1px solid var(--line-soft); transition: background .12s;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row:hover { background: rgba(43, 49, 57, .25); }
.setting-row:focus-within { background: rgba(240, 185, 11, .035); }
.setting-row.is-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
.setting-info { min-width: 0; }
.setting-label { display: block; font-size: .88rem; font-weight: 600; color: var(--text); cursor: pointer; }
.setting-desc { font-size: .78rem; color: var(--muted); margin-top: .15rem; line-height: 1.5; }
.setting-key { display: inline-block; margin-top: .35rem; font-family: var(--mono); font-size: .68rem; color: var(--faint); background: var(--bg-2); border: 1px solid var(--line-soft); padding: .05rem .4rem; border-radius: 5px; }
.setting-control { display: flex; justify-content: flex-end; min-width: 0; }
.setting-control .input, .setting-control .select { width: 100%; height: 38px; }
.setting-control .input.is-number { text-align: right; }
.setting-control .textarea { height: auto; min-height: 96px; }
.setting-control .switch { height: 38px; }
.switch .switch-text::before { content: "Off"; color: var(--muted); }
.switch input:checked ~ .switch-text::before { content: "On"; color: var(--text); }

@media (max-width: 700px) {
    .setting-row, .setting-row.is-wide { grid-template-columns: minmax(0, 1fr); gap: .6rem; padding: .9rem 1rem; }
    .setting-control { justify-content: flex-start; }
}

/* ---------- Dashboard charts ---------- */
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-bottom: 0; }
.grid-main > .card { margin-bottom: 1.25rem; }
.sk-block { position: relative; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--card-2) 0%, var(--hover) 50%, var(--card-2) 100%); background-size: 200% 100%; animation: sk 1.4s ease infinite; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.chart-empty, .chart-loading { display: grid; place-items: center; min-height: 160px; color: var(--muted); font-size: .85rem; text-align: center; padding: 1rem; }
.chart-loading { min-height: 440px; }

.chart-panel { overflow: hidden; }
.chart-head { display: flex; align-items: center; gap: 1rem 1.5rem; flex-wrap: wrap; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line-soft); }
.chart-head .coin { width: 38px; height: 38px; font-size: .72rem; }
.mc-price-row { display: flex; align-items: baseline; gap: .55rem; }
.mc-price { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; }
.mc-stats { display: flex; gap: 1.4rem; }
.mc-stats div { display: flex; flex-direction: column; }
.mc-stats span { font-size: .7rem; color: var(--muted); }
.mc-stats b { font-size: .84rem; font-weight: 500; }
.mc-tools { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-wrap: wrap; }
.mc-tools .seg button { padding: 0 .6rem; }
.mc-tools select.input.select { width: auto; min-width: 92px; height: 38px; }
.mc-price-row .live-badge { height: 22px; font-size: .66rem; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 .45rem; border-radius: 6px; font-size: .78rem; font-weight: 600; background: var(--card-2); }
.pill.up { background: var(--up-bg); }
.pill.down { background: var(--down-bg); }

.live-badge { display: inline-flex; align-items: center; gap: .35rem; height: 26px; padding: 0 .6rem; border-radius: 99px; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; background: var(--card-2); color: var(--muted); }
.live-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.live-badge[data-state="live"] { background: var(--up-bg); color: var(--up); }
.live-badge[data-state="live"] .dot { animation: pulse 1.6s ease infinite; }
.live-badge[data-state="offline"] { background: var(--warn-bg); color: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(14, 203, 129, .6); } 70% { box-shadow: 0 0 0 7px rgba(14, 203, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(14, 203, 129, 0); } }

.sc-wrap { position: relative; padding: .2rem .4rem 0; }
.sc-wrap.is-loading { opacity: .5; transition: opacity .2s; }
.sc-candles { display: block; }
.sc-grid { stroke: var(--line-soft); stroke-width: 1; }
.sc-grid.dashed { stroke-dasharray: 3 4; stroke: #2b3139; }
.sc-axis { fill: var(--faint); font: 10.5px var(--mono); }
.sc-ema20 { fill: none; stroke: var(--brand); stroke-width: 1.4; }
.sc-ema50 { fill: none; stroke: var(--info); stroke-width: 1.4; }
.sc-rsi { fill: none; stroke: #b48cf6; stroke-width: 1.4; }
.sc-rsi-band { fill: rgba(180, 140, 246, .06); }
.sc-last { stroke-dasharray: 2 3; stroke-width: 1; opacity: .8; }
.sc-tag { fill: #0b0e11; font: 600 10px var(--mono); }
.sc-pane-label { fill: var(--muted); font: 600 10px var(--font); letter-spacing: .04em; }
.sc-cross-x, .sc-cross-y { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.sc-cross-tag { fill: var(--hover); }
.sc-cross-text { fill: var(--text); }
.sc-legend { position: absolute; top: .45rem; left: .9rem; right: 80px; display: flex; flex-wrap: wrap; gap: .15rem .8rem; font-size: .72rem; color: var(--muted); pointer-events: none; }
.sc-legend b { font: 500 .74rem var(--mono); color: var(--text); }
.sc-legend .sc-l-time { color: var(--text-2); }
.sc-l-ema20 b { color: var(--brand) !important; }
.sc-l-ema50 b { color: var(--info) !important; }
.sc-l-rsi b { color: #b48cf6 !important; }
.chart-foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .55rem 1.1rem .8rem; font-size: .74rem; color: var(--muted); }
.chart-foot span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-foot i { display: inline-block; width: 14px; height: 2px; }
.chart-foot .btn { margin-left: auto; }
.lg-ema20 { background: var(--brand); }
.lg-ema50 { background: var(--info); }
.lg-rsi { background: #b48cf6; }

.sc-donut { display: flex; align-items: center; gap: 1.1rem; }
.sc-donut svg { flex: none; }
.sc-donut-value { fill: var(--text); font: 700 22px var(--font); }
.sc-donut-label { fill: var(--muted); font: 500 10.5px var(--font); }
.sc-donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; gap: .5rem; font-size: .8rem; }
.sc-donut-legend li { display: grid; grid-template-columns: 10px 1fr auto 38px; align-items: center; gap: .5rem; }
.sc-donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.sc-donut-legend span { color: var(--text-2); }
.sc-donut-legend b { font: 600 .82rem var(--mono); }
.sc-donut-legend em { font-style: normal; color: var(--muted); font-size: .74rem; text-align: right; font-family: var(--mono); }
#br-donut.sk-block { height: 150px; }
.br-section { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.br-title { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-2); margin-bottom: .55rem; }
.br-title b { font-weight: 500; font-size: .78rem; }
.ad-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--card-2); gap: 2px; }
.ad-bar span { display: block; height: 100%; transition: width .6s ease; }
.ad-up { background: var(--up); }
.ad-down { background: var(--down); }
.ad-legend { display: flex; justify-content: space-between; font-size: .75rem; margin-top: .45rem; }
.ad-legend b { font-family: var(--mono); }
.sc-hist-n { fill: var(--text-2); font: 500 9.5px var(--mono); }

.heat-body { padding: .75rem; }
.sc-treemap { position: relative; overflow: hidden; border-radius: var(--radius-sm); }
.sc-tile { position: absolute; border: 1px solid var(--card); border-radius: 4px; padding: 0; cursor: pointer; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; overflow: hidden; font-family: var(--font); transition: background .6s ease, filter .15s; }
.sc-tile:hover { filter: brightness(1.25); z-index: 1; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5); }
.sc-tile-name { font-weight: 700; line-height: 1.1; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.sc-tile-ch { font: 600 .72rem var(--mono); opacity: .95; }
.sc-tile-px { font: .66rem var(--mono); opacity: .75; }
.heat-scale { display: flex; align-items: center; gap: .45rem; font: .7rem var(--mono); color: var(--muted); }
.heat-scale i { width: 110px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, rgba(246,70,93,.76), rgba(246,70,93,.16) 45%, #2b3139 50%, rgba(14,203,129,.16) 55%, rgba(14,203,129,.76)); }

.movers { display: flex; flex-direction: column; }
.mover { display: grid; grid-template-columns: 30px minmax(0, 1fr) 84px 78px; align-items: center; gap: .7rem; padding: .62rem 1.1rem; background: none; border: 0; border-bottom: 1px solid var(--line-soft); color: var(--text); text-align: left; cursor: pointer; font-family: var(--font); }
.mover:last-child { border-bottom: 0; }
.mover:hover { background: rgba(43, 49, 57, .45); }
.mover-name { display: flex; flex-direction: column; min-width: 0; }
.mover-name b { font-size: .86rem; }
.mover-name small { color: var(--muted); font-size: .74rem; transition: color .4s; }
.mover .pill { justify-content: flex-end; }
.flash-up { animation: flashUp 1s ease; }
.flash-down { animation: flashDown 1s ease; }
@keyframes flashUp { 0% { color: var(--up); } 100% { color: var(--muted); } }
@keyframes flashDown { 0% { color: var(--down); } 100% { color: var(--muted); } }

.regime-legend { display: flex; gap: .9rem; font-size: .74rem; color: var(--muted); }
.regime-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.regime-legend i { width: 14px; height: 4px; border-radius: 2px; }
.up-bg { background: var(--up); }
.down-bg { background: var(--down); }
.warn-bg { background: var(--warn); }
.sc-bar:hover rect:nth-child(3) { filter: brightness(1.3); }

@media (max-width: 1200px) {
    .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
    .mc-tools { margin-left: 0; width: 100%; }
    .mc-stats { gap: 1rem; }
    .chart-loading { min-height: 360px; }
    .hide-xs { display: none; }
    .sc-legend { right: .9rem; }
    .heat-scale { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .market { grid-template-columns: 1fr 1fr; }
    .market-cell:nth-child(2) { border-right: 0; }
    .market-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
    body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.55); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 0 1rem; }
    .content { padding: 1.25rem 1rem 3rem; }
    .clock { display: none; }
}
@media (max-width: 600px) {
    .stats { grid-template-columns: minmax(0, 1fr); }
    .market { grid-template-columns: minmax(0, 1fr); }
    .market-cell { border-right: 0; border-bottom: 1px solid var(--line-soft); }
    .market-cell:last-child { border-bottom: 0; }
    th, td { padding: .7rem .9rem; }
}
.card-head p.scan-summary { color: var(--text-2); margin-top: .35rem; }
.scan-summary b { font-family: var(--mono); color: var(--text); }
