/**
 * public/css/dashboard.css
 * ─────────────────────────────────────────────────────────────────────────────
 * All styles for the BookNow Fast Trade Scanner dashboard.
 *
 * Organisation:
 *   1. CSS custom properties (design tokens)
 *   2. Reset and base styles
 *   3. Scrollbar
 *   4. Header / topbar
 *   5. Stat pills
 *   6. Main grid layout
 *   7. Auto-trade control bar
 *   8. Toggle switch component
 *   9. Scanner table
 *  10. Empty state
 *  11. Right panel
 *  12. Position cards
 *  13. Trade log entries
 *  14. Manual order form
 *  15. Toast notifications
 *  16. Utility / animations
 */

/* ── 1. Design tokens ──────────────────────────────────────────────────────── */
:root {
    --bg:       #080d14;
    --s1:       #0f1724;
    --s2:       #141f2e;
    --s3:       #1b2a3d;
    --border:   #1e3050;
    --border2:  #253a55;
    --blue:     #3b82f6;
    --indigo:   #6366f1;
    --green:    #10b981;
    --green2:   #059669;
    --gdim:     rgba(16, 185, 129, .12);
    --red:      #ef4444;
    --rdim:     rgba(239, 68, 68, .12);
    --yellow:   #f59e0b;
    --ydim:     rgba(245, 158, 11, .10);
    --cyan:     #06b6d4;
    --text:     #e2e8f0;
    --dim:      #64748b;
    --muted:    #334155;
    --mono:     'JetBrains Mono', monospace;
    --radius:   10px;
}

/* ── 2. Reset & base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  background: #0b0e11;
  color: #fff;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── 3. Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── 4. Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    height: 60px;
    background: var(--s1);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon {
    width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), var(--indigo));
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    box-shadow: 0 0 12px rgba(99, 102, 241, .4);
}
.logo h1 {
    font-size: 16px; font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.live-badge {
    display: flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--dim);
    margin-left: auto;
}
.live-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--red);
    transition: background .3s;
}
.live-dot.live { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* ── 5. Stat pills ─────────────────────────────────────────────────────────── */
.stat-pill {
    display: flex; align-items: center; gap: 6px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
}
.sp-label { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .6px; }
.sp-val { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.sp-val.green  { color: var(--green); }
.sp-val.red    { color: var(--red); }
.sp-val.yellow { color: var(--yellow); }
.sp-val.blue   { color: var(--blue); }

/* ── 6. Main grid layout ─────────────────────────────────────────────────── */
.grid {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.left {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 400px;
}
.right {
    width: 420px;
    display: flex;
    flex-direction: column;
    background: var(--s1);
    border-left: 1px solid var(--border);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}
.right.collapsed {
    width: 0 !important;
    border-left: none;
}

/* RESIZER */
.resizer {
    width: 6px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.2s;
    z-index: 10;
}
.resizer:hover {
    background: var(--blue);
}
.resizer:active {
    background: var(--indigo);
    width: 8px;
}
.panel {
    flex: 1; overflow-y: auto;
    border-bottom: 1px solid var(--border);
}
.panel:last-child { border-bottom: none; }
.ptitle {
    font-size: 10px; text-transform: uppercase; letter-spacing: .8px;
    color: var(--dim); padding: 10px 14px 6px;
    font-weight: 700; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--s1); z-index: 3;
}

/* ── 7. Auto-trade control bar ─────────────────────────────────────────────── */
.auto-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px;
    background: var(--s2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.auto-bar label { font-size: 11px; color: var(--dim); }
.auto-bar input[type=number] {
    width: 58px;
    background: var(--s3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 7px;
    color: var(--text);
    font-size: 12px;
    font-family: var(--mono);
    outline: none;
    transition: border-color .2s;
}
.auto-bar input[type=number]:focus { border-color: var(--blue); }
.sep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }

/* ── 8. Toggle switch ──────────────────────────────────────────────────────── */
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; inset: 0;
    background: var(--border2);
    border-radius: 24px;
    cursor: pointer; transition: .3s;
}
.slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .3s;
}
.toggle input:checked ~ .slider { background: var(--green); }
.toggle input:checked ~ .slider::before { transform: translateX(18px); }

.mode-badge {
    font-size: 10px; padding: 3px 8px; border-radius: 4px;
    font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.mode-sim  { background: rgba(245, 158, 11, .15); color: var(--yellow); border: 1px solid rgba(245, 158, 11, .3); }
.mode-live { background: rgba(239, 68, 68, .15);  color: var(--red);    border: 1px solid rgba(239, 68, 68, .3); }

/* ── 9. Scanner table ──────────────────────────────────────────────────────── */
.scanner-wrap { flex: 1; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    position: sticky; top: 0; z-index: 5;
    background: var(--s2);
    color: var(--dim);
    font-size: 10px; text-transform: uppercase; letter-spacing: .7px;
    padding: 8px 12px; text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap; font-weight: 600;
}
tbody tr {
    border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background .12s;
}
tbody tr:hover { background: var(--s2); }
tbody tr.has-pos {
    background: var(--gdim);
    border-left: 2px solid var(--green);
}
tbody tr.has-pos:hover { background: rgba(16, 185, 129, .18); }
td { padding: 9px 12px; white-space: nowrap; }

.sym    { font-weight: 700; font-size: 13px; font-family: 'Inter', sans-serif; }
.signal-tag {
    display: inline-block;
    font-size: 9px; padding: 2px 7px; border-radius: 4px;
    font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}
/* Signal colours */
.s-usf57   { background: rgba(236, 72, 153, .25);  color: #f472b6; } /* Pink - extremely hot */
.s-uf35    { background: rgba(139, 92, 246, .25);  color: #a78bfa; } /* Violet */
.s-sf23    { background: rgba(59, 130, 246, .2);   color: #60a5fa; } /* Blue */
.s-lt2min { background: rgba(239, 68, 68, .2);   color: #f87171; }
.s-uf03   { background: rgba(249, 115, 22, .2);  color: #fb923c; }
.s-uf02   { background: rgba(234, 179, 8, .2);   color: #facc15; }
.s-uf23   { background: rgba(168, 85, 247, .2);  color: #c084fc; }
.s-fm     { background: rgba(59, 130, 246, .15); color: #60a5fa; }

.price { font-family: var(--mono); font-size: 12px; }
.pnl   { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.pnl.pos { color: var(--green); }
.pnl.neg { color: var(--red); }
.pnl.nil { color: var(--dim); }
.held  { font-family: var(--mono); font-size: 11px; color: var(--dim); }

/* Mode Tabs in Order Form */
.mode-tabs { display: flex; gap: 4px; flex: 1; background: rgba(0,0,0,0.2); padding: 2px; border-radius: 4px; }
.m-tab {
    flex: 1; border: none; background: transparent; color: var(--dim);
    font-size: 10px; font-weight: 700; padding: 4px; border-radius: 3px;
    cursor: pointer; transition: all 0.2s;
}
.m-tab.active { background: var(--border); color: #fff; }

/* Binance Style Terminal */
.terminal-tabs { 
    display: flex; 
    gap: 20px; 
    border-bottom: 1px solid var(--border); 
    margin-bottom: 12px; 
    padding: 0 20px;
}
.t-tab {
    background: transparent; border: none; color: #848e9c;
    font-size: 12px; font-weight: 800; padding: 8px 0; cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.t-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.terminal-layout { 
    display: flex; 
    gap: 30px; 
    padding: 5px 20px 10px; 
    max-width: 900px; 
    margin: 0 auto; 
    justify-content: center;
}
.term-col { 
    flex: 0 1 300px; 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
}
.term-header { 
    font-size: 11px; 
    font-weight: 800; 
    margin-bottom: 2px; 
    text-transform: uppercase; 
    color: var(--dim); 
    letter-spacing: 0.5px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}
.term-field {
    display: flex; 
    align-items: center; 
    background: #fff;
    border: 1px solid #d2d6dc; 
    border-radius: 6px; 
    padding: 0 10px;
    height: 36px;
    transition: all 0.2s;
    width: 100%;
}
.term-field:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.term-lbl { 
    font-size: 10px; 
    color: #848e9c; 
    width: 50px; 
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.term-field input {
    flex: 1; 
    border: none !important; 
    background: transparent !important;
    color: #1e2329 !important; 
    font-weight: 700 !important; 
    padding: 4px 0 !important;
    text-align: right; 
    box-shadow: none !important;
    font-size: 13px !important;
    font-family: var(--mono);
    width: 100%;
}
.term-unit { 
    font-size: 11px; 
    color: #1e2329; 
    margin-left: 8px; 
    width: 40px; 
    text-align: right; 
    font-weight: 700; 
}

.term-btn {
    margin-top: 8px; 
    padding: 10px; 
    border: none; 
    border-radius: 4px;
    font-weight: 800; 
    font-size: 14px; 
    cursor: pointer; 
    color: #fff;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.term-btn.buy  { background: var(--green); color: #fff; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2); }
.term-btn.sell { background: var(--red); color: #fff; box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2); }
.term-btn:hover { 
    transform: translateY(-1px);
    opacity: 0.95;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.term-btn:active { transform: translateY(0); }

/* Table Row Inputs */
.row-limit-inp {
    width: 90px;
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
    border-radius: 3px;
    padding: 3px 5px;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    font-family: 'Roboto Mono', monospace;
    appearance: textfield; /* Hide spinners in Firefox */
}

/* Hide spinners in Chrome/Safari/Edge */
.row-limit-inp::-webkit-outer-spin-button,
.row-limit-inp::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.row-limit-inp:focus {
    border-color: var(--blue) !important;
    outline: none;
    background: #f0f7ff !important;
}

/* Order Form Inputs (Old legacy override for safety) */
.order-form input {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 4px;
    font-weight: 600;
    width: 100%;
}
.order-form input:focus {
    border-color: var(--blue);
    outline: none;
    box-shadow: 0 0 4px var(--blue);
}

.btn-tiny {
    background: var(--border); border: none; color: #fff;
    padding: 2px 6px; border-radius: 3px; font-size: 10px; cursor: pointer;
}

/* Analysis badges in table */
.analysis-cell { display: flex; flex-direction: column; gap: 2px; }
.rec-badge {
    display: inline-block; font-size: 9px; font-weight: 800; padding: 2px 6px;
    border-radius: 4px; text-transform: uppercase; white-space: nowrap; width: fit-content;
    border: 1px solid transparent;
}
.score-small { font-size: 10px; font-family: var(--mono); color: var(--dim); }

.rec-strong-buy { background: rgba(34, 197, 94, .2);    color: #4ade80; border-color: rgba(34, 197, 94, .4); }
.rec-buy        { background: rgba(134, 239, 172, .15); color: #86efac; border-color: rgba(134, 239, 172, .3); }
.rec-neutral    { background: rgba(245, 158, 11, .1);   color: #fbbf24; border-color: rgba(245, 158, 11, .3); }
.rec-wait       { background: rgba(251, 146, 60, .1);   color: #fb923c; border-color: rgba(251, 146, 60, .3); }
.rec-dont-buy   { background: rgba(239, 68, 68, .15);   color: #f87171; border-color: rgba(239, 68, 68, .3); }

/* Table action buttons */
.btn { padding: 4px 10px; border-radius: 5px; border: none; cursor: pointer; font-size: 11px; font-weight: 700; transition: all .15s; font-family: 'Inter', sans-serif; }
.btn-buy  { background: var(--gdim); color: var(--green); border: 1px solid rgba(16, 185, 129, .3); }
.btn-buy:hover  { background: var(--green); color: #fff; }
.btn-sell { background: var(--rdim); color: var(--red);   border: 1px solid rgba(239, 68, 68, .3); }
.btn-sell:hover { background: var(--red); color: #fff; }
.btn-binance { background: rgba(240, 185, 11, 0.15); color: #f0b90b; border: 1px solid rgba(240, 185, 11, 0.3); }
.btn-binance:hover { background: #f0b90b; color: #000; }
.action-group { display: flex; gap: 4px; }

/* ── 10. Empty state ───────────────────────────────────────────────────────── */
.empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 200px; color: var(--muted);
}
.empty .icon { font-size: 40px; margin-bottom: 10px; opacity: .5; }
.empty p { font-size: 13px; }

/* ── 11. Right panel shared ────────────────────────────────────────────────── */
.no-pos { color: var(--muted); font-size: 12px; text-align: center; padding: 20px; }

/* ── 12. Position cards ────────────────────────────────────────────────────── */
.pos-card {
    margin: 8px 10px; padding: 10px 12px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.pos-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.pos-sym { font-weight: 700; font-size: 14px; }
.pos-sig { font-size: 9px; color: var(--dim); }
.pos-row { display: flex; justify-content: space-between; margin-bottom: 2px; }
.pos-row .lbl { font-size: 10px; color: var(--dim); }
.pos-row .val { font-family: var(--mono); font-size: 11px; }
.pos-pnl {
    font-size: 18px; font-weight: 800;
    font-family: var(--mono);
    text-align: center;
    margin: 6px 0;
}
.pos-pnl.pos { color: var(--green); }
.pos-pnl.neg { color: var(--red); }
.sell-now {
    width: 100%; padding: 6px;
    border-radius: 6px; border: none;
    background: var(--red); color: #fff;
    font-weight: 700; font-size: 12px;
    cursor: pointer; transition: opacity .2s;
    font-family: 'Inter', sans-serif;
}
.sell-now:hover { opacity: .85; }

/* ── 13. Trade log entries ─────────────────────────────────────────────────── */
.trade-entry {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}
.trade-entry:last-child { border-bottom: none; }
.te-action {
    width: 36px; text-align: center;
    padding: 2px 0; border-radius: 4px;
    font-weight: 700; font-size: 10px;
}
.te-buy  { background: var(--gdim); color: var(--green); }
.te-sell { background: var(--rdim); color: var(--red); }
.te-sym  { font-weight: 600; flex: 1; font-family: 'Inter', sans-serif; }
.te-pnl  { font-family: var(--mono); font-weight: 600; }
.te-pnl.pos { color: var(--green); }
.te-pnl.neg { color: var(--red); }
.te-time { color: var(--dim); font-size: 10px; white-space: nowrap; }
.te-sim  { font-size: 9px; padding: 1px 5px; background: var(--ydim); color: var(--yellow); border-radius: 3px; }

/* ── 14. Manual order form ─────────────────────────────────────────────────── */
.order-form { padding: 10px 12px; }
.form-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.form-row label { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }
.form-row input {
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text);
    font-size: 12px;
    font-family: var(--mono);
    outline: none;
    transition: border-color .2s;
}
.form-row input:focus { border-color: var(--blue); }
.order-actions { display: flex; gap: 8px; }
.order-actions button {
    flex: 1; padding: 8px;
    border-radius: 6px; border: none;
    font-weight: 700; font-size: 13px;
    cursor: pointer; transition: all .2s;
    font-family: 'Inter', sans-serif;
}
.ob { background: var(--green); color: #fff; }
.ob:hover { background: var(--green2); }
.os { background: var(--red); color: #fff; }
.os:hover { background: #dc2626; }

/* ── 15. Toast notifications ───────────────────────────────────────────────── */
#toast {
    position: fixed; bottom: 16px; right: 16px;
    z-index: 999;
    display: flex; flex-direction: column; gap: 6px;
}
.toast-item {
    background: var(--s2); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 14px;
    max-width: 260px; font-size: 12px;
    animation: slideIn .25s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .5);
}
.toast-item.g { border-color: var(--green); background: rgba(16, 185, 129, .08); }
.toast-item.r { border-color: var(--red);   background: rgba(239, 68, 68, .08); }
.toast-item.y { border-color: var(--yellow); background: rgba(245, 158, 11, .08); }

/* ── 16. Animations ────────────────────────────────────────────────────────── */
@keyframes slideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}
.blinking { animation: pulse 1.5s infinite; }

/* ── 17. Service control bar (Stop / Clear Cache / Start) ──────────────────── */

/* Wrapper: groups the three buttons + status dot in a row */
.svc-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 4px;
    padding: 3px 6px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 22px;
}

/* Base button shared by all three */
.svc-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 16px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background .18s, border-color .18s, box-shadow .18s, transform .1s;
    white-space: nowrap;
    letter-spacing: .3px;
    line-height: 1;
}
.svc-btn:active  { transform: scale(.95); }
.svc-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}
.svc-icon { font-size: 12px; }
.svc-label { font-size: 11px; }

/* STOP — red */
.svc-stop {
    background: rgba(239, 68, 68, .10);
    color: var(--red);
    border-color: rgba(239, 68, 68, .30);
}
.svc-stop:hover {
    background: rgba(239, 68, 68, .22);
    border-color: var(--red);
    box-shadow: 0 0 10px rgba(239, 68, 68, .25);
}

/* CLEAR CACHE — amber */
.svc-flush {
    background: rgba(245, 158, 11, .10);
    color: var(--yellow);
    border-color: rgba(245, 158, 11, .30);
}
.svc-flush:hover {
    background: rgba(245, 158, 11, .22);
    border-color: var(--yellow);
    box-shadow: 0 0 10px rgba(245, 158, 11, .25);
}

/* START — green */
.svc-start {
    background: rgba(16, 185, 129, .10);
    color: var(--green);
    border-color: rgba(16, 185, 129, .30);
}
.svc-start:hover {
    background: rgba(16, 185, 129, .22);
    border-color: var(--green);
    box-shadow: 0 0 10px rgba(16, 185, 129, .25);
}

/* Service status indicator (dot + label) */
.svc-status {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 4px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
    font-size: 10px;
    color: var(--dim);
    white-space: nowrap;
}
.svc-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--dim);
    flex-shrink: 0;
    transition: background .3s;
}
.svc-dot.running { background: var(--green); box-shadow: 0 0 6px var(--green); }
.svc-dot.stopped { background: var(--red);   box-shadow: 0 0 6px var(--red); }

/* Spin animation used for loading state on any svc button */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.svc-btn .spinning {
    display: inline-block;
    animation: spin .8s linear infinite;
}

/* ── 18. Bot Positions Full-Width Strip ─────────────────────────────────────── */

/* Outer container — sits between topbar and main grid, full viewport width */
.bot-strip {
    margin: 0 0 8px;
    padding: 0 16px 10px;
    background: var(--s1);
    border-bottom: 1px solid var(--border);
}

/* Strip header bar */
.bot-strip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 6px;
}
.bot-strip-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .3px;
    color: var(--cyan);
}
.bot-strip-count {
    font-size: 11px;
    font-family: var(--mono);
    background: rgba(6, 182, 212, .12);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, .25);
    border-radius: 20px;
    padding: 2px 10px;
}
.bot-strip-hint {
    font-size: 10px;
    color: var(--dim);
    margin-left: auto;
}

/* Horizontal scrolling track */
.bot-strip-track {
    display: flex;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.bot-strip-track::-webkit-scrollbar { height: 4px; }
.bot-strip-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Empty state inside the track */
.bot-strip-empty {
    width: 100%;
    text-align: center;
    padding: 18px 0;
    color: var(--dim);
    font-size: 12px;
    font-style: italic;
}

/* ── Large Bot Position Card ────────────────────────────────────────────────── */
.bot-card {
    flex: 0 0 280px;           /* Fixed width — landscape card */
    min-width: 280px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-top: 3px solid var(--cyan);
    border-radius: 12px;
    padding: 14px 16px 12px;
    position: relative;
    transition: box-shadow .2s, border-color .2s, transform .15s;
    display: flex;
    flex-direction: column;
    gap: 0;
}
/* Glow states based on P&L */
.bot-card.in-profit {
    border-top-color: var(--green);
    box-shadow: 0 0 18px rgba(34, 197, 94, .18), 0 2px 12px rgba(0,0,0,.3);
}
.bot-card.in-loss {
    border-top-color: #f59e0b;
    box-shadow: 0 0 14px rgba(245, 158, 11, .14), 0 2px 12px rgba(0,0,0,.3);
}
.bot-card:hover { transform: translateY(-2px); }

.bot-card.is-pending {
    border-top-color: var(--blue);
    box-shadow: 0 0 14px rgba(59, 130, 246, .14), 0 2px 12px rgba(0,0,0,.3);
    background: rgba(59, 130, 246, 0.05);
}

.price-reached-hint {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
    padding: 6px;
    border-radius: 6px;
    text-align: center;
    margin-bottom: 12px;
    border: 1px dashed var(--green);
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Card: Top row — symbol + BOT badge ── */
.bc-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.bc-sym {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -.3px;
    flex: 1;
}
.bc-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .8px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(6, 182, 212, .14);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, .28);
}
/* Purple variant for dashboard-originated manual buys */
.bc-badge.manual {
    background: rgba(168, 85, 247, .15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, .3);
}
.bc-time {
    font-size: 10px;
    color: var(--dim);
    font-family: var(--mono);
}

/* ── Card: BIG P&L display ── */
.bc-pnl-wrap {
    text-align: center;
    margin-bottom: 12px;
    padding: 8px 0;
    border-radius: 8px;
    background: rgba(255,255,255,.02);
}
.bc-pnl-num {
    font-family: var(--mono);
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
}
.bc-pnl-num.pos { color: var(--green); text-shadow: 0 0 20px rgba(34,197,94,.4); }
.bc-pnl-num.neg { color: #f59e0b;      text-shadow: 0 0 16px rgba(245,158,11,.35); }
.bc-pnl-num.nil { color: var(--dim); }
.bc-pnl-label {
    font-size: 10px;
    color: var(--dim);
    margin-top: 2px;
    letter-spacing: .4px;
}

/* ── Card: Price grid (2 columns) ── */
.bc-prices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    margin-bottom: 10px;
}
.bc-price-item { display: flex; flex-direction: column; gap: 2px; }
.bc-price-item.span2 { grid-column: span 2; }
.bc-price-lbl {
    font-size: 9px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.bc-price-val {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
}
.bc-price-val.green { color: var(--green); }
.bc-price-val.amber { color: #f59e0b; }

/* ── Card: Progress bar ── */
.bc-progress-wrap {
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}
.bc-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width .6s ease;
    background: linear-gradient(90deg, var(--green), #86efac);
}
.bc-progress-bar.neg { background: linear-gradient(90deg, #f59e0b, #fcd34d); }

/* ── Card: Big sell button ── */
.bc-sell-btn {
    width: 100%;
    padding: 10px 0;
    border-radius: 9px;
    border: none;
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font);
    cursor: pointer;
    letter-spacing: .3px;
    transition: background .18s, box-shadow .2s, transform .12s;
    margin-top: auto;
}
.bc-sell-btn:active   { transform: scale(.97); }
.bc-sell-btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.bc-sell-btn.profit {
    background: linear-gradient(135deg, rgba(34,197,94,.25), rgba(34,197,94,.12));
    color: var(--green);
    border: 1px solid rgba(34,197,94,.45);
}
.bc-sell-btn.profit:hover {
    background: linear-gradient(135deg, rgba(34,197,94,.4), rgba(34,197,94,.22));
    box-shadow: 0 0 16px rgba(34,197,94,.35);
}
.bc-sell-btn.loss {
    background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(245,158,11,.08));
    color: #f59e0b;
    border: 1px solid rgba(245,158,11,.35);
}
.bc-sell-btn.loss:hover {
    background: linear-gradient(135deg, rgba(245,158,11,.3), rgba(245,158,11,.15));
    box-shadow: 0 0 12px rgba(245,158,11,.25);
}
.bc-sell-btn .spinning {
    display: inline-block;
    animation: spin .8s linear infinite;
}

/* ── 19. Bot Sell History rows ────────────────────────────────────────────── */
.bot-sell-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    transition: background .15s;
}
.bot-sell-row:last-child { border-bottom: none; }
.bot-sell-row:hover      { background: rgba(255,255,255,.03); }

.bsr-left {
    display: flex;
    flex-direction: column;
    min-width: 80px;
}
.bsr-sym {
    font-weight: 800;
    font-size: 12px;
}
.bsr-ts  { color: var(--dim); font-size: 9px; }

.bsr-mid {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}
.bsr-lbl { color: var(--dim); margin-right: 2px; }
.bsr-val { font-family: var(--mono); }

.bsr-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 70px;
}
.bsr-pnl  { font-family: var(--mono); font-weight: 800; font-size: 12px; }
.bsr-usdt { font-family: var(--mono); font-size: 10px; }
.bsr-pnl.pos, .bsr-usdt.pos { color: var(--green); }
.bsr-pnl.neg, .bsr-usdt.neg { color: var(--red); }

/* ═══════════════════════════════════════════════════════════════════════════════
   COIN ANALYSIS MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Overlay */
.modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn .18s ease;
}

/* Box */
.modal-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: min(780px, 96vw);
    max-height: 88vh;
    overflow-y: auto;
    padding: 28px 32px;
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
    animation: slideUp .22s cubic-bezier(.34,1.56,.64,1);
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

/* Header */
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px;
}
.modal-title-wrap { display: flex; align-items: center; gap: 12px; }
.modal-symbol {
    font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: .5px;
}
.modal-rec-badge {
    font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
    padding: 4px 12px; border-radius: 20px; border: 1px solid transparent;
    transition: all .3s;
}
.modal-close {
    background: rgba(255,255,255,.07); border: 1px solid var(--border);
    color: var(--text); font-size: 16px; border-radius: 50%;
    width: 32px; height: 32px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.modal-close:hover { background: rgba(255,255,255,.14); }

/* Loading */
.modal-loading {
    display: flex; align-items: center; justify-content: center;
    gap: 14px; padding: 50px 0; color: var(--dim); font-size: 14px;
}
.modal-spinner {
    width: 24px; height: 24px;
    border: 3px solid rgba(255,255,255,.12);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

/* Score ring row */
.modal-score-row {
    display: flex; gap: 24px; align-items: flex-start;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: 12px; padding: 20px;
    margin-bottom: 22px;
}
.modal-score-wrap { position: relative; flex-shrink: 0; width: 80px; height: 80px; }
.score-ring { width: 80px; height: 80px; transform: rotate(-90deg); }
.sr-bg   { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 7; }
.sr-fill {
    fill: none; stroke-width: 7; stroke-linecap: round;
    transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1), stroke .4s;
}
.score-center {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center; flex-direction: row; gap: 2px;
}
.score-num   { font-size: 22px; font-weight: 900; color: var(--text); }
.score-denom { font-size: 11px; color: var(--dim); margin-top: 4px; }

.modal-summary { flex: 1; }
.modal-rec-label {
    font-size: 16px; font-weight: 800; letter-spacing: .5px; margin-bottom: 8px;
}
.modal-reason {
    font-size: 11.5px; color: var(--dim); line-height: 1.7;
    max-height: 80px; overflow-y: auto;
}

/* Section titles */
.modal-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .9px; color: var(--dim);
    margin: 20px 0 10px;
}

/* Price grid */
.modal-price-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    margin-bottom: 6px;
}
.mpg-item {
    background: rgba(255,255,255,.04); border: 1px solid var(--border);
    border-radius: 10px; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 4px;
}
.mpg-lbl { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .6px; }
.mpg-val { font-size: 14px; font-weight: 700; font-family: var(--mono); color: var(--text); }
.mpg-val.green { color: var(--green); }
.mpg-val.red   { color: var(--red); }

/* Position gauge */
.modal-gauge-wrap {
    display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.gauge-label-l, .gauge-label-r {
    font-size: 10px; color: var(--dim); white-space: nowrap; width: 28px;
}
.gauge-label-r { text-align: right; }
.modal-gauge {
    flex: 1; height: 10px; background: rgba(255,255,255,.07);
    border-radius: 5px; position: relative; overflow: visible;
}
.gauge-fill {
    height: 100%; border-radius: 5px; transition: width .5s ease, background .4s;
}
.gauge-needle {
    position: absolute; top: -4px; width: 3px; height: 18px;
    background: #fff; border-radius: 2px; transform: translateX(-50%);
    box-shadow: 0 0 6px rgba(255,255,255,.6);
    transition: left .5s ease;
}
.gauge-pct-label {
    font-size: 11px; color: var(--dim); text-align: center; margin-bottom: 2px;
}
.gauge-pct-label strong { color: var(--text); }

/* Volume grid */
.modal-vol-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-bottom: 12px;
}
.mvg-item {
    background: rgba(255,255,255,.04); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 4px;
}
.mvg-lbl { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .6px; }
.mvg-val { font-size: 13px; font-weight: 700; font-family: var(--mono); color: var(--text); }

/* Volume bar */
.modal-vol-bar-wrap { display: flex; align-items: center; gap: 12px; }
.modal-vol-bar {
    flex: 1; height: 8px; background: rgba(255,255,255,.07);
    border-radius: 4px; overflow: hidden;
}
.vol-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease, background .4s; }
.vol-bar-label { font-size: 11px; color: var(--dim); white-space: nowrap; min-width: 80px; }

/* Analyze button in scanner */
.btn-analyze {
    background: rgba(168,85,247,.14);
    color: #c084fc;
    border: 1px solid rgba(168,85,247,.3);
    font-size: 14px; padding: 3px 8px;
    border-radius: 6px; cursor: pointer;
    transition: background .2s, transform .1s;
}
.btn-analyze:hover {
    background: rgba(168,85,247,.28);
    transform: scale(1.08);
}

/* Responsive */
@media (max-width: 600px) {
    .modal-price-grid { grid-template-columns: repeat(2,1fr); }
    .modal-vol-grid   { grid-template-columns: repeat(2,1fr); }
    .modal-box        { padding: 18px 16px; }
}

/* Order Cards & Statuses */
.order-card {
    border-left: 3px solid var(--blue);
    background: var(--s2);
}
.p-status {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    background: var(--s3);
}
.status-new { color: var(--blue); background: rgba(52,152,219,0.1); }
.status-partially_filled { color: #f39c12; background: rgba(243,156,18,0.1); }
.status-filled { color: var(--green); background: rgba(46,204,113,0.1); }

/* Sidebar Redesign: Manager Panel & Tabs */
.manager-panel {
    display: flex;
    flex-direction: column;
    height: 400px;
    padding: 0 !important;
    overflow: hidden;
}
.side-tabs {
    display: flex;
    background: var(--s2);
    border-bottom: 1px solid var(--border);
}
.s-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: var(--dim);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 2px solid transparent;
}
.s-tab.active {
    color: var(--blue);
    background: var(--s1);
    border-bottom-color: var(--blue);
}
.side-tab-content {
    display: none;
    flex-direction: column;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}
.side-tab-content.active {
    display: flex;
}
.sub-section {
    margin-bottom: 20px;
}
.stitle {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--dim);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.no-pos-small {
    font-size: 11px;
    color: var(--dim);
    text-align: center;
    padding: 10px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    opacity: 0.6;
}

/* Compact Scanner Empty State */
tr.empty-row td {
    padding: 2px !important;
}
.empty-compact {
    padding: 4px;
    text-align: center;
    color: var(--dim);
    font-size: 10px;
    font-weight: 500;
    background: var(--s2);
    border-radius: 4px;
}

/* Terminal Estimation Label */
.term-estimate {
    font-size: 11px;
    color: var(--dim);
    margin-top: -6px;
    margin-bottom: 10px;
    padding-left: 5px;
    font-family: var(--mono);
    font-weight: 500;
}

/* Cancel Order Button */
.btn-cancel {
    width: 100%;
    margin-top: 10px;
    padding: 6px;
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-cancel:hover {
    background: #ff4444;
    color: white;
}

/* Mini Tables for Sidebar */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--s2);
}
.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.mini-table th {
    text-align: left;
    padding: 8px;
    color: var(--dim);
    text-transform: uppercase;
    font-size: 9px;
    border-bottom: 1px solid var(--border);
}
.mini-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}
.mini-table tr:last-child td { border-bottom: none; }

/* Status Pills */
.status-pill {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}
.status-pill.new { background: var(--ydim); color: var(--yellow); }
.status-pill.filled { background: var(--gdim); color: var(--green); }
.status-pill.partially_filled { background: var(--gdim); color: var(--blue); }
.status-pill.canceled { background: var(--rdim); color: var(--red); }

/* At Risk Row */
tr.at-risk {
    background: rgba(255, 68, 68, 0.05);
    border-left: 2px solid var(--red);
}

.mini-table .btn-cancel {
    padding: 2px 6px;
    margin-top: 0;
    font-size: 9px;
}

/* Pending/Cancel button style in bot strip */
.bc-sell-btn.pending {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
}
.bc-sell-btn.pending:hover {
    background: #ff4444;
    color: white;
}

/* Bot Card Action Container */
.bc-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
}

/* Fade out animation for removed cards */
.order-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.order-card.fade-out {
    opacity: 0;
    transform: scale(0.95);
}

/* Scalper Matrix Styles */
.matrix-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 60px;
    margin: 0 auto;
}
.m-item {
    font-size: 10px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    background: #2a2d35;
    opacity: 0.4;
    transition: all 0.2s;
}
.m-item.pass {
    background: #00c853;
    color: #fff;
    opacity: 1;
    box-shadow: 0 0 5px rgba(0,200,83,0.4);
}
.m-item.fail {
    background: #ff5252;
    color: #fff;
    opacity: 0.8;
}
.matrix-grid-placeholder {
    color: #444;
    font-size: 10px;
    text-align: center;
}
