/* Bot UI inside the terminal: toolbar chips, side panel, bottom "Bots" drawer. Uses the terminal theme
   variables, so light and dark both work. */
:root {
    --bot-ok: #089981;
    --bot-trade: #2962ff;
    --bot-warn: #ff9800;
    --bot-off: #9598a1;
    --drawer-h: 46%;
}

/* ---------- toolbar chips ---------- */
.tb-bots { display: inline-flex; gap: 4px; margin: 0 2px; flex: 0 0 auto; }
.tb-bot {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg);
    color: var(--text); font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tb-bot:hover { background: var(--bg-hover); }
.tb-bot.is-focus { border-color: var(--blue); background: var(--blue-soft); }
.tb-bot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bot-off); flex: 0 0 auto; }
.tb-bot.is-ok::before { background: var(--bot-ok); }
.tb-bot.is-trade::before { background: var(--bot-trade); box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.25); }
.tb-bot.is-warn::before { background: var(--bot-warn); }
.tb-bot-state { font-size: 10px; letter-spacing: 0.4px; color: var(--text-muted); }
.tb-bot-pnl { font-family: var(--font-mono); font-size: 11px; }
.is-up { color: var(--green); }
.is-down { color: var(--red); }

/* status line inside the setup dropdown */
.strat-live { margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--bot-off); }
.strat-live.is-ok { color: var(--bot-ok); }
.strat-live.is-trade { color: var(--bot-trade); }
.strat-live.is-warn { color: var(--bot-warn); }

/* ---------- side panel ---------- */
.bp-live { display: grid; gap: 6px; }
.bp-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bp-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bot-off); }
.bp-dot.is-ok { background: var(--bot-ok); }
.bp-dot.is-trade { background: var(--bot-trade); }
.bp-dot.is-warn { background: var(--bot-warn); }
.bp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.bp-row b { font-family: var(--font-mono); font-weight: 600; text-align: right; }
.bp-gates { display: grid; gap: 2px; padding: 6px 8px; background: var(--bg-subtle); border-radius: var(--radius); }
.bp-gate { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.bp-gate span { text-transform: capitalize; color: var(--text-muted); }
.bp-gate em { font-style: normal; font-family: var(--font-mono); text-align: right; }
.bp-gate.is-blocked em { color: var(--bot-warn); }
.bp-trade { display: grid; gap: 4px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.bp-trade > b { font-size: 12px; }
.bp-range { position: relative; height: 6px; border-radius: 3px; background: var(--bg-hover); margin: 4px 0; }
.bp-range i { position: absolute; top: -3px; width: 4px; height: 12px; border-radius: 2px; background: var(--blue); transform: translateX(-50%); }
.bp-error { font-size: 12px; color: var(--red); background: var(--red-soft); padding: 6px 8px; border-radius: var(--radius); margin-bottom: 6px; }
.bp-form { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.bp-form h3 { font-size: 12px; font-weight: 600; }
.bp-field { display: grid; gap: 2px; font-size: 12px; }
.bp-field input {
    height: 32px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--bg); color: var(--text); font-family: var(--font-mono); font-size: 13px;
}
.bp-field input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.bp-actions { display: flex; align-items: center; gap: 10px; }
.bp-msg:empty { display: none; }

/* ---------- bottom "Bots" drawer ---------- */
.bots-drawer {
    flex: 0 0 var(--drawer-h); min-height: 0; display: flex; flex-direction: column;
    border-top: 2px solid var(--border-strong); background: var(--bg-subtle);
}
.drawer-bar {
    display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px 0 12px; flex: 0 0 auto;
    border-bottom: 1px solid var(--border); background: var(--bg); font-size: 13px;
}
.drawer-bar .toolbar-spacer { flex: 1; }
.drawer-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
#view-chart .chart-area.has-drawer .chart-body { flex: 1 1 0 !important; height: auto !important; min-height: 120px !important; }

@media (max-width: 860px) {
    .tb-bot-name, .tb-bot-state { display: none; }
    .bots-drawer { position: fixed; inset: var(--toolbar-h) 0 calc(56px + var(--safe-bottom)) 0; z-index: 40; border-top: 0; }
}

/* the dashboard cards are designed on a light surface; keep it light in the dark theme too */
.drawer-body { background: #f4f6fb; color: #131722; }

/* ---------- Neo-TradingView Live Trade Ribbon (Sample 2 Trader Precision) ---------- */
.live-trade-ribbon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 32px;
    padding: 5px 16px;
    background: #ecfdf5;
    border-bottom: 1px solid #86efac;
    color: #15803d;
    font-size: 11.5px;
    font-weight: 600;
    font-family: var(--font-sans);
    z-index: 5;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.live-trade-ribbon.is-short {
    background: #fef2f2;
    border-bottom: 1px solid #fca5a5;
    color: #b91c1c;
}
.live-trade-ribbon.is-standby {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
}
.live-trade-ribbon .ltr-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.live-trade-ribbon .ltr-sep {
    color: rgba(148, 163, 184, 0.5);
    font-weight: 300;
}
.live-trade-ribbon strong {
    font-family: var(--font-mono);
    font-weight: 700;
}
.live-trade-ribbon .ltr-pnl {
    font-size: 12.5px;
    color: #16a34a;
}
.live-trade-ribbon.is-short .ltr-pnl {
    color: #dc2626;
}


/* ---------- Neo-TradingView Top Bar Live Trade Pill (Trader Precision) ---------- */
.tb-live-trade {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    margin-left: 6px;
    flex: 0 0 auto;
    transition: all 0.15s ease;
}
.tb-live-trade.is-short {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.tb-live-trade.is-standby {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
}
.tb-live-trade .tlt-dot {
    font-size: 10px;
    line-height: 1;
}
.tb-live-trade strong {
    font-family: var(--font-mono);
    font-weight: 700;
}
.tb-live-trade .tlt-sep {
    color: rgba(148, 163, 184, 0.6);
}

/* ---------- Compact Minimal Strategy Dropdown (No Bloat / No AI Slop) ---------- */
.strategy-menu {
    left: 0 !important;
    right: auto !important;
    width: 250px !important;
    padding: 4px !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}
.strategy-opt {
    display: block !important;
    width: 100% !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    text-align: left !important;
    transition: background 0.12s ease !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
}
.strategy-opt:hover {
    background: #f1f5f9 !important;
}
.strategy-opt.is-active {
    background: #eff6ff !important;
}
.strat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 6px;
}
.strat-title {
    font-weight: 600;
    font-size: 12px !important;
    color: #0f172a !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.strat-badge {
    font-size: 10px !important;
    font-weight: 600 !important;
    padding: 1px 5px !important;
    border-radius: 3px !important;
    background: #f1f5f9 !important;
    color: #64748b !important;
    font-family: var(--font-mono) !important;
}
.strat-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 3px 0;
}


/* ---------- TOP BAR INLINE LIVE TRADE STATUS ---------- */
.tb-bots {
    display: none !important;
}
.tb-live-trade {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
    margin: 0 6px;
    flex: 0 0 auto;
}
.tb-live-trade.is-short {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}
.tb-live-trade.is-standby {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
}
.tb-live-trade .tlt-dot {
    font-size: 9px;
    line-height: 1;
}
.tb-live-trade strong {
    font-family: var(--font-mono);
    font-weight: 700;
}
.tb-live-trade .tlt-sep {
    color: #cbd5e1;
    font-weight: 400;
}
.tb-live-trade .tlt-pnl strong {
    font-size: 11.5px;
}

/* Hide old ribbon completely */
.live-trade-ribbon {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* ---------- COMPACT MINIMAL SETUP CHANGE BOX (No AI Slop) ---------- */
.strategy-menu {
    left: 0 !important;
    right: auto !important;
    width: 270px !important;
    padding: 4px !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}
.strategy-opt {
    display: block !important;
    width: 100% !important;
    padding: 6px 8px !important;
    border-radius: 4px !important;
    text-align: left !important;
    transition: background 0.1s ease !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    margin: 1px 0 !important;
}
.strategy-opt:hover {
    background: #f8fafc !important;
}
.strategy-opt[aria-checked="true"],
.strategy-opt.is-active {
    background: #f1f5f9 !important;
}
.strat-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 6px !important;
    margin-bottom: 2px !important;
}
.strat-title {
    font-weight: 600 !important;
    font-size: 11.5px !important;
    color: #0f172a !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.strat-badge {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    padding: 1px 5px !important;
    border-radius: 3px !important;
    background: #e2e8f0 !important;
    color: #334155 !important;
    font-family: var(--font-mono) !important;
    flex-shrink: 0 !important;
}
.strat-live {
    font-size: 10.5px !important;
    color: #64748b !important;
    font-family: var(--font-mono) !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}
.strat-live.is-in-trade,
.strat-live.is-in_trade {
    color: #dc2626 !important;
    font-weight: 600 !important;
}
.strat-live.is-scanning {
    color: #16a34a !important;
}
.strat-divider {
    height: 1px !important;
    background: #e2e8f0 !important;
    margin: 3px 0 !important;
}

#nifty-candle-timer, .candle-timer-chip { display: none !important; }
